zhaochengyang 5 years ago
parent
commit
9016a67cbe
100 changed files with 4213 additions and 173 deletions
  1. 58 0
      RubikCube/.laya/_compile_1597930428371.js
  2. 314 0
      RubikCube/.laya/_publish_1597930428349.js
  3. 178 0
      RubikCube/.laya/_publish_bdgame_1597930428247.js
  4. 447 0
      RubikCube/.laya/_publish_oppogame_1597930428196.js
  5. 89 0
      RubikCube/.laya/_publish_qqgame_1597930428263.js
  6. 732 0
      RubikCube/.laya/_publish_vivogame_1597930428149.js
  7. 418 0
      RubikCube/.laya/_publish_wxgame_1597930428301.js
  8. 519 0
      RubikCube/.laya/_publish_xmgame_1597930428099.js
  9. 26 11
      RubikCube/.laya/compile.js
  10. 79 19
      RubikCube/.laya/publish.js
  11. 136 0
      RubikCube/.laya/publish_alipaygame.js
  12. 21 10
      RubikCube/.laya/publish_bdgame.js
  13. 27 16
      RubikCube/.laya/publish_oppogame.js
  14. 264 9
      RubikCube/.laya/publish_qqgame.js
  15. 128 75
      RubikCube/.laya/publish_vivogame.js
  16. 35 15
      RubikCube/.laya/publish_wxgame.js
  17. 33 16
      RubikCube/.laya/publish_xmgame.js
  18. 1 1
      RubikCube/.laya/wxgame.json
  19. 13 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/05e77883499b421406ccbc545a473792a605e915
  20. 19 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/0defb2ce0ae7e3087eea59a9c6fb153b3325fd86
  21. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/1d69c0ebd39a31aaffe3fbb413dc48d6ed2270e0
  22. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/1dcd0577dabd120359b630eee23a90d1be9712e2
  23. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/215edee67516625981f1a34a10a9059638ddfddc
  24. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/2430cec0063d49d8aa45d2826f89d3414c2f05c0
  25. 14 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/29273151bf631bc76a253b1149721f25e551e79d
  26. 16 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/33207b1f3167bef823b37f805b157fba52bb6286
  27. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/388d4ecbe81d36e9d713fa32bd4a5b2727a157c7
  28. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/3952e431c0dac4293d230a733d2e431b445d2ab5
  29. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/43f98a9fc9b84077a1e6ce99204e9b6d46e8ded6
  30. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/5a605b3f3e17a141a31baaf59f497059209b9dd3
  31. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/64141059d0ab4df162b2367befd2457893d43c95
  32. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/662804772048460bb67eaf611476de69e81d76c5
  33. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/6e66a1892e2109e428960e1487f4294233a48ef5
  34. 11 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/6fbdbac47186bbdff0dabf5eaeb6ec77c2dfd276
  35. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/72f795edd2081dc0efbf236e567fbd1282465ebd
  36. 14 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/73599a09562a737fdad88707e1d54ab15f771402
  37. 14 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/73f804c8c08e20faa8f810f703c45a89b35f0b57
  38. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/750585efa191d909d58cc8f66e2b8ce990182c5e
  39. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7693a06f36ecd5f3c5250035cec18e275b6373dd
  40. 7 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7bee1bde101b4663df27f62d570b59db49985a0d
  41. 10 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7c85aad6cf4a7d189001056afce9aa61112093bb
  42. 15 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/9c12306284e32ab6c9df058d04e9f78850da6a40
  43. 22 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/a667558afd5dc96b1637fef6f35516469bab3db5
  44. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/b653185851a3113c7652410d943ee0f8df9a539b
  45. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c0a298ee3fc98ea82215c38c64183f2513909ae3
  46. 11 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c10a97c9bffd9053d72eb6bc5f497aeeff17a4c3
  47. 9 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c2ada570396c8b2f1da731584ffde54bd5813866
  48. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c61928fbe2602351863652a8b766eaba444451cd
  49. 14 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/ca5e10acd5fe63ce3b6f42a80d403e7bdde6419e
  50. 10 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/d0cb81d3a6431bc8044a11664512bd3f78dfb712
  51. 8 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e4dde9eb49c3f7caaa2607dd24fe4d8a59407c0f
  52. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e701fc81888b1d1bac838bc8fc5989ccee3a9b42
  53. 5 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e9c2de8f1fe45dea719ac946bc150890ce236c7c
  54. 12 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/f9c249d1a1e47d3cf70272133f4df0a118289dea
  55. 1 1
      RubikCube/.rpt2_cache/rpt2_ce064c5d7e31dc12b03871ed8c081d634013faa7/code/cache/f3b0063f87abe92819f6b3682cc54de9a3234c30
  56. 0 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/508e5ed3e3f8c99ac64a923d3f23c8af98467cf5
  57. 0 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/66bf06b3a9ec1f59758b09016e9f3d67747f8576
  58. 0 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/e55730a85acdf7bea118bd0f7877b16a1163a0eb
  59. 0 0
      RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/e921e8d054107575a68a30c69d4eaec9ef2a325e
  60. 13 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/05e77883499b421406ccbc545a473792a605e915
  61. 11 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/0b28bb8f7703dd22c8df92bb0d92a3b769d5de70
  62. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/215edee67516625981f1a34a10a9059638ddfddc
  63. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/2430cec0063d49d8aa45d2826f89d3414c2f05c0
  64. 14 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/29273151bf631bc76a253b1149721f25e551e79d
  65. 16 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/33207b1f3167bef823b37f805b157fba52bb6286
  66. 8 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/388d4ecbe81d36e9d713fa32bd4a5b2727a157c7
  67. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/43f98a9fc9b84077a1e6ce99204e9b6d46e8ded6
  68. 8 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/5a605b3f3e17a141a31baaf59f497059209b9dd3
  69. 20 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/5d90f475b99f5abd60aeeafae456a11e7861ef6d
  70. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/64141059d0ab4df162b2367befd2457893d43c95
  71. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/662804772048460bb67eaf611476de69e81d76c5
  72. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/6e66a1892e2109e428960e1487f4294233a48ef5
  73. 8 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/72f795edd2081dc0efbf236e567fbd1282465ebd
  74. 14 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/73599a09562a737fdad88707e1d54ab15f771402
  75. 14 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/73f804c8c08e20faa8f810f703c45a89b35f0b57
  76. 8 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/750585efa191d909d58cc8f66e2b8ce990182c5e
  77. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/7693a06f36ecd5f3c5250035cec18e275b6373dd
  78. 10 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/7c85aad6cf4a7d189001056afce9aa61112093bb
  79. 18 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/8569c8a906bccdad004bf4b486a5528260fee157
  80. 15 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/9c12306284e32ab6c9df058d04e9f78850da6a40
  81. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/a451417d99e90286cd4b9c51b4f8440babf24960
  82. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/b653185851a3113c7652410d943ee0f8df9a539b
  83. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/b8dcb3606061ec6c257c67558ec98322dd8d67f6
  84. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c0a298ee3fc98ea82215c38c64183f2513909ae3
  85. 11 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c10a97c9bffd9053d72eb6bc5f497aeeff17a4c3
  86. 9 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c2ada570396c8b2f1da731584ffde54bd5813866
  87. 14 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/ca5e10acd5fe63ce3b6f42a80d403e7bdde6419e
  88. 8 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e4dde9eb49c3f7caaa2607dd24fe4d8a59407c0f
  89. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e701fc81888b1d1bac838bc8fc5989ccee3a9b42
  90. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e9c2de8f1fe45dea719ac946bc150890ce236c7c
  91. 12 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/f9c249d1a1e47d3cf70272133f4df0a118289dea
  92. 5 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/ff94b628d82924a0504a130464e3e5e6db3d362f
  93. 0 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/508e5ed3e3f8c99ac64a923d3f23c8af98467cf5
  94. 0 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/66bf06b3a9ec1f59758b09016e9f3d67747f8576
  95. 0 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/e55730a85acdf7bea118bd0f7877b16a1163a0eb
  96. 0 0
      RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/e921e8d054107575a68a30c69d4eaec9ef2a325e
  97. 13 0
      RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/05e77883499b421406ccbc545a473792a605e915
  98. 19 0
      RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/0defb2ce0ae7e3087eea59a9c6fb153b3325fd86
  99. 5 0
      RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/1d69c0ebd39a31aaffe3fbb413dc48d6ed2270e0
  100. 0 0
      RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/1dcd0577dabd120359b630eee23a90d1be9712e2

+ 58 - 0
RubikCube/.laya/_compile_1597930428371.js

@@ -0,0 +1,58 @@
+// v1.1.0
+//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+let useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+//获取Node插件和工作路径
+let ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+let workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\compile.js", "").replace("/.laya/compile.js", "") : "./../";
+
+const gulp = require(ideModuleDir + "gulp");
+const rollup = require(ideModuleDir + "rollup");
+const typescript = require(ideModuleDir + 'rollup-plugin-typescript2');//typescript2 plugin
+const glsl = require(ideModuleDir + 'rollup-plugin-glsl');
+
+// 如果是发布时调用编译功能,增加prevTasks
+let prevTasks = "";
+if (global.publish) {
+	prevTasks = ["loadConfig"];
+}
+
+//使用browserify,转换ts到js,并输出到bin/js目录
+gulp.task("compile", prevTasks, function () {
+	// 发布时调用编译功能,判断是否点击了编译选项
+	if (global.publish && !global.config.compile) {
+		return;
+	} else if (global.publish && global.config.compile) {
+		// 发布时调用编译,workSpaceDir使用publish.js里的变量
+		workSpaceDir = global.workSpaceDir;
+	}
+
+	return rollup.rollup({
+		input: workSpaceDir + '/src/Main.ts',
+		treeshake: true,//建议忽略
+		plugins: [
+			typescript({
+				check: false, //Set to false to avoid doing any diagnostic checks on the code
+				tsconfigOverride:{compilerOptions:{removeComments: true}}
+			}),
+			glsl({
+				// By default, everything gets included
+				include: /.*(.glsl|.vs|.fs)$/,
+				sourceMap: true,
+				compress:false
+			}),
+			/*terser({
+				output: {
+				},
+				numWorkers:1,//Amount of workers to spawn. Defaults to the number of CPUs minus 1
+				sourcemap: false
+			})*/        
+		]
+	}).then(bundle => {
+		return bundle.write({
+			file: workSpaceDir + '/bin/js/bundle.js',
+			format: 'iife',
+			name: 'laya',
+			sourcemap: true
+		});
+	});
+});

+ 314 - 0
RubikCube/.laya/_publish_1597930428349.js

@@ -0,0 +1,314 @@
+// v1.5.0
+//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+//获取Node插件和工作路径
+let ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+let workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish.js", "").replace("/.laya/publish.js", "") + "/" : "./../";
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const uglify = require(ideModuleDir + 'gulp-uglify-es').default;
+const jsonminify = require(ideModuleDir + "gulp-jsonminify");
+const image = require(ideModuleDir + "gulp-image");
+const rev = require(ideModuleDir + "gulp-rev");
+const revdel = require(ideModuleDir + "gulp-rev-delete-original");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+const del = require(ideModuleDir + "del");
+const requireDir = require(ideModuleDir + 'require-dir');
+
+global.ideModuleDir = ideModuleDir;
+global.workSpaceDir = workSpaceDir;
+
+// 结合compile.js使用
+global.publish = true;
+const fileList = ["compile.js", "publish_xmgame.js", "publish_oppogame.js", "publish_vivogame.js", "publish_wxgame.js", "publish_bdgame.js", "publish_qqgame.js"];
+requireDir('./', {
+	filter: function (fullPath) {
+		// 只用到了compile.js和publish.js
+		if (fileList.includes(path.basename(fullPath))) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+});
+
+const QUICKGAMELIST = ["xmgame", "oppogame", "vivogame"];
+
+// 清理临时文件夹,加载配置
+let config,
+	releaseDir,
+	binPath,
+	platform,
+	isOpendataProj = false;
+gulp.task("loadConfig", function () {
+	platform = "web"
+	if (!useIDENode && process.argv.length > 5 && process.argv[4] == "--config") {
+		platform = process.argv[5].replace(".json", "");
+	}
+	if (useIDENode && process.argv.length >= 4 && process.argv[3].startsWith("--config") && process.argv[3].endsWith(".json")) {
+		platform = process.argv[3].match(/(\w+).json/)[1];
+	}
+	let _path;
+	if (!useIDENode) {
+		_path = platform + ".json";
+		releaseDir = "../release/" + platform;
+		binPath = "../bin/";
+	}
+	if (useIDENode) {
+		_path = path.join(workSpaceDir, ".laya", `${platform}.json`);
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		binPath = path.join(workSpaceDir, "bin").replace(/\\/g, "/");
+	}
+	global.platform = platform;
+	let file = fs.readFileSync(_path, "utf-8");
+	if (file) {
+		if (QUICKGAMELIST.includes(platform)) {
+			file = file.replace(/\$basePath/g, releaseDir + "/temprelease");
+		} else {
+			file = file.replace(/\$basePath/g, releaseDir);
+		}
+		config = JSON.parse(file);
+		global.config = config;
+	}
+	// 是否是开放域项目
+	let projInfoPath = path.join(workSpaceDir, path.basename(workSpaceDir) + ".laya");
+	let isExist = fs.existsSync(projInfoPath);
+	if (isExist) {
+		try {
+			let projInfo = fs.readFileSync(projInfoPath, "utf8");
+			projInfo = projInfo && JSON.parse(projInfo);
+			isOpendataProj = projInfo.layaProType === 12;
+		} catch (e) {}
+	}
+});
+
+// 清理release文件夹
+gulp.task("clearReleaseDir", ["compile"], function (cb) {
+	if (config.clearReleaseDir) {
+		let delList = [releaseDir, releaseDir + "_pack", config.packfileTargetValue];
+		// 小米快游戏,使用即存的项目,删掉Laya工程文件,保留小米环境项目文件
+		if (platform === "xmgame") {
+			let xmProjSrc = path.join(releaseDir, config.xmInfo.projName);
+			// 不要删掉manifest.json/main.js文件
+			// 这里不是node-glob语法,详见: https://github.com/sindresorhus/del
+			delList = [`${xmProjSrc}/**`, `!${xmProjSrc}`, `!${xmProjSrc}/node_modules/**`, `!${xmProjSrc}/sign/**`, `!${xmProjSrc}/{babel.config.js,main.js,manifest.json,package.json,package-lock.json}`];
+		} else if (platform === "oppogame") {
+			let oppoProjSrc = path.join(releaseDir, config.oppoInfo.projName);
+			delList = [`${oppoProjSrc}/**`, `!${oppoProjSrc}`, `!${oppoProjSrc}/dist/**`, `!${oppoProjSrc}/{manifest.json}`];
+		} else if (platform === "vivogame") {
+			let vvProj = path.join(releaseDir, config.vivoInfo.projName);
+			let vvProjSrc = path.join(vvProj, "src");
+			// 不要删掉manifest.json/main.js文件
+			// 这里不是node-glob语法,详见: https://github.com/sindresorhus/del
+			delList = [`${vvProjSrc}/**`, `!${vvProjSrc}`, `!${vvProjSrc}/sign/**`, `!${vvProjSrc}/{game.js,manifest.json}`];
+			delList = delList.concat(`${vvProj}/engine/**`, `${vvProj}/config/**`);
+		}
+		del(delList, { force: true }).then(paths => {
+			cb();
+		});
+	} else cb();
+});
+
+// copy bin文件到release文件夹
+gulp.task("copyFile", ["clearReleaseDir"], function () {
+	let baseCopyFilter = [`${workSpaceDir}/bin/**/*.*`, `!${workSpaceDir}/bin/indexmodule.html`, `!${workSpaceDir}/bin/import/*.*`];
+	// 只拷贝index.js中引用的类库
+	if (config.onlyIndexJS) {
+		baseCopyFilter = baseCopyFilter.concat(`!${workSpaceDir}/bin/libs/*.*`);
+	}
+	if (platform === "wxgame" && isOpendataProj) { // 开放域项目微信发布,仅拷贝用到的文件
+		config.copyFilesFilter = [`${workSpaceDir}/bin/js/bundle.js`, `${workSpaceDir}/bin/index.js`, `${workSpaceDir}/bin/game.js`];
+		if (config.projectType !== "as") { // 开放域精简类库
+			config.copyFilesFilter.push(`${workSpaceDir}/bin/libs/laya.opendata.js`);
+		}
+	} else if (platform === "wxgame") { // 微信项目,不拷贝index.html,不拷贝百度bin目录中的文件
+		config.copyFilesFilter = baseCopyFilter.concat([`!${workSpaceDir}/bin/index.html`, `!${workSpaceDir}/bin/{project.swan.json,swan-game-adapter.js}`]);
+	} else if (platform === "bdgame") { // 百度项目,不拷贝index.html,不拷贝微信bin目录中的文件
+		config.copyFilesFilter = baseCopyFilter.concat([`!${workSpaceDir}/bin/index.html`, `!${workSpaceDir}/bin/{project.config.json,weapp-adapter.js}`]);
+	} else { // web|QQ项目|bili|快游戏,不拷贝微信、百度在bin目录中的文件
+		config.copyFilesFilter = baseCopyFilter.concat([`!${workSpaceDir}/bin/{game.js,game.json,project.config.json,weapp-adapter.js,project.swan.json,swan-game-adapter.js}`]);
+	}
+	// bili/alipay/qq,不拷贝index.html
+	if (["biligame", "Alipaygame", "qqgame"].includes(platform)) {
+		config.copyFilesFilter = config.copyFilesFilter.concat([`!${workSpaceDir}/bin/index.html`]);
+	}
+	// 快游戏,需要新建一个快游戏项目,拷贝的只是项目的一部分,将文件先拷贝到文件夹的临时目录中去
+	if (QUICKGAMELIST.includes(platform)) {
+		config.copyFilesFilter = config.copyFilesFilter.concat([`!${workSpaceDir}/bin/index.html`]);
+		releaseDir = global.tempReleaseDir = path.join(releaseDir, "temprelease");
+	}
+	if (config.exclude) { // 排除文件
+		config.excludeFilter.forEach(function(item, index, list) {
+			releaseDir = releaseDir.replace(/\\/g, "/");
+			config.excludeFilter[index] = item.replace(releaseDir, binPath);
+		});
+		config.copyFilesFilter = config.copyFilesFilter.concat(config.excludeFilter);
+	}
+	global.releaseDir = releaseDir;
+	var stream = gulp.src(config.copyFilesFilter, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+// copy libs中的js文件到release文件夹
+gulp.task("copyLibsJsFile", ["copyFile"], function () {
+	if (!config.onlyIndexJS) {
+		return;
+	}
+	if (platform === "wxgame" && isOpendataProj) { // 开放域项目微信发布,拷贝文件时已经拷贝类库文件了
+		return;
+	}
+	// 开放域项目,as语言,没有libs目录,mac系统报错
+	let libs = path.join(workSpaceDir, "bin", "libs");
+	if (!fs.existsSync(libs)) {
+		return;
+	}
+	// 分析index.js
+	let indexJSPath = path.join(workSpaceDir, "bin", "index.js");
+	let indexJsContent = fs.readFileSync(indexJSPath, "utf8");
+	let libsList = indexJsContent.match(/loadLib\(['"]libs\/[\w-./]+\.(js|wasm)['"]\)/g);
+	if (!libsList) {
+		libsList = [];
+	}
+	let 
+		item,
+		libsName = "",
+		libsStr = "";
+	for (let i = 0, len = libsList.length; i < len; i++) {
+		item = libsList[i];
+		libsName = item.match(/loadLib\(['"]libs\/([\w-./]+\.(js|wasm))['"]\)/);
+		libsStr += libsStr ? `,${libsName[1]}` : libsName[1];
+	}
+	// 发布web项目,如果使用了physics3D,默认拷贝runtime
+	if (platform === "web" && libsStr.includes("laya.physics3D")) {
+		libsStr += ',laya.physics3D.runtime.js';
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/{${libsStr}}`];
+	if (!libsStr.includes(",")) {
+		copyLibsList = [`${workSpaceDir}/bin/libs/${libsStr}`];
+	}
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+// 压缩json
+gulp.task("compressJson", ["copyLibsJsFile"], function () {
+	if (config.compressJson) {
+		return gulp.src(config.compressJsonFilter, { base: releaseDir })
+			.pipe(jsonminify())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+// 压缩js
+gulp.task("compressJs", ["compressJson"], function () {
+	if (config.compressJs) {
+		return gulp.src(config.compressJsFilter, { base: releaseDir })
+			.pipe(uglify({
+				mangle: {
+					keep_fnames:true
+				}
+			}))
+			.on('error', function (err) {
+				console.warn(err.toString());
+			})
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+// 压缩png,jpg
+gulp.task("compressImage", ["compressJs"], function () {
+	if (config.compressImage) {
+		return gulp.src(config.compressImageFilter, { base: releaseDir })
+			.pipe(image({
+				pngquant: true,			//PNG优化工具
+				optipng: false,			//PNG优化工具
+				zopflipng: true,		//PNG优化工具
+				jpegRecompress: false,	//jpg优化工具
+				mozjpeg: true,			//jpg优化工具
+				guetzli: false,			//jpg优化工具
+				gifsicle: false,		//gif优化工具
+				svgo: false,			//SVG优化工具
+				concurrent: 10,			//并发线程数
+				quiet: true 			//是否是静默方式
+				// optipng: ['-i 1', '-strip all', '-fix', '-o7', '-force'],
+				// pngquant: ['--speed=1', '--force', 256],
+				// zopflipng: ['-y', '--lossy_8bit', '--lossy_transparent'],
+				// jpegRecompress: ['--strip', '--quality', 'medium', '--min', 40, '--max', 80],
+				// mozjpeg: ['-optimize', '-progressive'],
+				// guetzli: ['--quality', 85]
+			}))
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+// 生成版本管理信息
+gulp.task("version1", ["compressImage"], function () {
+	if (config.version) {
+		return gulp.src(config.versionFilter, { base: releaseDir })
+			.pipe(rev())
+			.pipe(gulp.dest(releaseDir))
+			.pipe(revdel())
+			.pipe(rev.manifest("version.json"))
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+// 替换index.js里面的变化的文件名
+gulp.task("version2", ["version1"], function () {
+	if (config.version) {
+		//替换index.html和index.js里面的文件名称
+
+		let htmlPath = releaseDir + "/index.html";
+		let versionPath = releaseDir + "/version.json";
+		let gameJSPath = releaseDir + "/game.js";
+		let mainJSPath = releaseDir + "/main.js";
+		let indexJSPath;
+		let versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+		indexJSPath = releaseDir + "/" + versionCon["index.js"];
+		// 替换config.packfileFullValue中的路径
+		let packfileStr = JSON.stringify(config.packfileFullValue).replace(/\\\\/g, "/");
+		let tempPackfile = `${workSpaceDir}/.laya/configTemp.json`;
+		fs.writeFileSync(tempPackfile, packfileStr, "utf8");
+
+		let srcList = [versionPath, indexJSPath, tempPackfile];
+		if (fs.existsSync(htmlPath)) {
+			srcList.push(htmlPath);
+		}
+		if (fs.existsSync(gameJSPath)) {
+			srcList.push(gameJSPath);
+		}
+		if (fs.existsSync(mainJSPath)) {
+			srcList.push(mainJSPath);
+		}
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+// 筛选4M包
+gulp.task("packfile", ["version2"], function() {
+	if (config.version) {
+		// 从release目录取得带有版本号的目录
+		let tempPackfile = `${workSpaceDir}/.laya/configTemp.json`;
+		let releasePackfile = `${releaseDir}/configTemp.json`;
+		let packfileStr = fs.readFileSync(releasePackfile, "utf8");
+		config.packfileFullValue = JSON.parse(packfileStr);
+		// 删掉临时目录
+		fs.unlinkSync(tempPackfile);
+		fs.unlinkSync(releasePackfile);
+	}
+	if (config.packfile) { // 提取本地包(文件列表形式)
+		return gulp.src(config.packfileFullValue, { base: releaseDir })
+			.pipe(gulp.dest(config.packfileTargetValue || releaseDir + "_pack"));
+	}
+});
+
+// 起始任务
+gulp.task("publish", ["buildXiaomiProj", "buildOPPOProj", "buildVivoProj", "buildWXProj", "buildBDProj", "buildQQProj"], function () {
+	console.log("All tasks completed!");
+});

+ 178 - 0
RubikCube/.laya/_publish_bdgame_1597930428247.js

@@ -0,0 +1,178 @@
+// v1.2.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_bdgame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_bdgame.js", "").replace("/.laya/publish_bdgame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const crypto = require("crypto");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+    releaseDir;
+let isGlobalCli = true;
+let versionCon; // 版本管理version.json
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_BD", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "bdgame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		config = pubsetJson[3];
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		config = global.config;
+	}
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.bdmini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("copyPlatformFile_BD", ["preCreate_BD"], function() {
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return;
+	}
+	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "bdfiles");
+	// 如果新建项目时已经点击了"微信/百度小游戏bin目录快速调试",不再拷贝
+	let isHadBdFiles =
+		fs.existsSync(path.join(workSpaceDir, "bin", "game.js")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "game.json")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "project.swan.json")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "swan-game-adapter.js"));
+	if (isHadBdFiles) {
+		return;
+	}
+	let stream = gulp.src(adapterPath + "/*.*");
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("modifyFile_BD", ["copyPlatformFile_BD"], function() {
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	// 百度小游戏项目,修改index.js
+	let filePath = path.join(releaseDir, indexJsStr);
+	if (!fs.existsSync(filePath)) {
+		return;
+	}
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	fileContent = fileContent.replace(/loadLib(\(['"])/gm, "require$1./");
+	fs.writeFileSync(filePath, fileContent, "utf8");
+});
+
+// 开放域的情况下,合并game.js和index.js,并删除game.js
+gulp.task("openData_BD", ["modifyFile_BD"], function (cb) {
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return cb();
+	}
+	if (config.openDataZone) {
+		let versionCon;
+		if (config.version) {
+			let versionPath = releaseDir + "/version.json";
+			versionCon = fs.readFileSync(versionPath, "utf8");
+			versionCon = JSON.parse(versionCon);
+		}
+		let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+		let indexPath = path.join(releaseDir, indexJsStr);
+		let indexjs = readFile(indexPath);
+		let gamejs = readFile(releaseDir + "/game.js");
+		if (gamejs && indexjs) {
+			gamejs = gamejs.replace(`require("index.js")`, indexjs);
+			fs.writeFileSync(indexPath, gamejs, 'utf-8');
+		}
+		return cb();
+	}
+	cb();
+});
+
+function readFile(path) {
+	if (fs.existsSync(path)) {
+		return fs.readFileSync(path, "utf-8");
+	}
+	return null;
+}
+
+gulp.task("version_BD", ["openData_BD"], function() {
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		let gameJSPath = releaseDir + "/game.js";
+		let srcList = [versionPath, gameJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+gulp.task("optimizeOpen_BD", ["version_BD"], function(cb) {
+	// 如果不是百度小游戏
+	if (platform !== "bdgame") {
+		return cb();
+	}
+	let bdOptimize = config.bdOptimize;
+	if (!bdOptimize || !bdOptimize.useOptimizeOpen) {
+		return cb();
+	}
+	// 首屏加载优化(秒开),修改game.json
+	let filePath = path.join(releaseDir, "game.json");
+	if (!fs.existsSync(filePath)) {
+		return cb();
+	}
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	let fileConObj = JSON.parse(fileContent);
+	if (bdOptimize.preloadRes) {
+		fileConObj.preloadResources = bdOptimize.preloadResList;
+	} else {
+		delete fileConObj.preloadResources;
+	}
+
+	fs.writeFileSync(filePath, JSON.stringify(fileConObj, null, 4), "utf8");
+	return cb();
+});
+
+gulp.task("buildBDProj", ["optimizeOpen_BD"], function() {
+	console.log("all tasks completed");
+});

+ 447 - 0
RubikCube/.laya/_publish_oppogame_1597930428196.js

@@ -0,0 +1,447 @@
+// v1.2.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_oppogame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_oppogame.js", "").replace("/.laya/publish_oppogame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+	releaseDir,
+    toolkitPath,
+    tempReleaseDir, // OPPO临时拷贝目录
+	projDir; // OPPO快游戏工程目录
+let versionCon; // 版本管理version.json
+// 创建OPPO项目前,拷贝OPPO引擎库、修改index.js
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_OPPO", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "oppogame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		releaseDir = tempReleaseDir = path.join(releaseDir, "temprelease");
+		config = pubsetJson[5]; // 只用到了 config.oppoInfo|config.oppoSign
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		tempReleaseDir = global.tempReleaseDir;
+		config = global.config;
+	}
+    toolkitPath = path.join(ideModuleDir, "../", "out", "layarepublic", "oppo", "quickgame-toolkit");
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.quickgamemini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(tempReleaseDir));
+});
+
+// 新建OPPO项目-OPPO项目与其他项目不同,需要安装OPPO quickgame node_modules,并打包成.rpk文件
+gulp.task("installModules_OPPO", ["preCreate_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	releaseDir = path.dirname(releaseDir);
+	projDir = path.join(releaseDir, config.oppoInfo.projName);
+    // 如果IDE里对应OPPO包已经install node_modules了,忽略这一步
+    if (fs.existsSync(path.join(toolkitPath, "node_modules"))) {
+        return;
+    }
+	// 安装OPPO quickgame node_modules
+	return new Promise((resolve, reject) => {
+		console.log("开始安装OPPO quickgame node_modules,请耐心等待...");
+		let cmd = `npm${commandSuffix}`;
+		let args = ["install"];
+        
+        let cp = childProcess.spawn(cmd, args, {
+            cwd: toolkitPath
+        });
+        
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+		
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+		
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+// 拷贝文件到OPPO快游戏
+gulp.task("copyFileToProj_OPPO", ["installModules_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	// 将临时文件夹中的文件,拷贝到项目中去
+	let originalDir = `${tempReleaseDir}/**/*.*`;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(path.join(projDir)));
+});
+
+// 拷贝icon到OPPO快游戏
+gulp.task("copyIconToProj_OPPO", ["copyFileToProj_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	let originalDir = config.oppoInfo.icon;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(path.join(projDir)));
+});
+
+// 清除OPPO快游戏临时目录
+gulp.task("clearTempDir_OPPO", ["copyIconToProj_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	// 删掉临时目录
+	return del([tempReleaseDir], { force: true });
+});
+
+// 生成release签名(私钥文件 private.pem 和证书文件 certificate.pem )
+gulp.task("generateSign_OPPO", ["clearTempDir_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+    }
+    if (!config.oppoSign.generateSign) {
+        return;
+    }
+	// https://doc.quickapp.cn/tools/compiling-tools.html
+	return new Promise((resolve, reject) => {
+		let cmd = "openssl";
+		let args = ["req", "-newkey", "rsa:2048", "-nodes", "-keyout", "private.pem", 
+					"-x509", "-days", "3650", "-out", "certificate.pem"];
+		let opts = {
+			cwd: projDir,
+			shell: true
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			data += "";
+			if (data.includes("Country Name")) {
+				cp.stdin.write(`${config.oppoSign.countryName}\n`);
+				console.log(`Country Name: ${config.oppoSign.countryName}`);
+			} else if (data.includes("Province Name")) {
+				cp.stdin.write(`${config.oppoSign.provinceName}\n`);
+				console.log(`Province Name: ${config.oppoSign.provinceName}`);
+			} else if (data.includes("Locality Name")) {
+				cp.stdin.write(`${config.oppoSign.localityName}\n`);
+				console.log(`Locality Name: ${config.oppoSign.localityName}`);
+			} else if (data.includes("Organization Name")) {
+				cp.stdin.write(`${config.oppoSign.orgName}\n`);
+				console.log(`Organization Name: ${config.oppoSign.orgName}`);
+			} else if (data.includes("Organizational Unit Name")) {
+				cp.stdin.write(`${config.oppoSign.orgUnitName}\n`);
+				console.log(`Organizational Unit Name: ${config.oppoSign.orgUnitName}`);
+			} else if (data.includes("Common Name")) {
+				cp.stdin.write(`${config.oppoSign.commonName}\n`);
+				console.log(`Common Name: ${config.oppoSign.commonName}`);
+			} else if (data.includes("Email Address")) {
+				cp.stdin.write(`${config.oppoSign.emailAddr}\n`);
+				console.log(`Email Address: ${config.oppoSign.emailAddr}`);
+				// cp.stdin.end();
+			}
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+// 拷贝sign文件到指定位置
+gulp.task("copySignFile_OPPO", ["generateSign_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+    }
+    if (config.oppoSign.generateSign) { // 新生成的签名
+        // 移动签名文件到项目中(Laya & OPPO快游戏项目中)
+        let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`,
+            layaDest = `${workSpaceDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest))
+                    .pipe(gulp.dest(layaDest));
+    } else if (config.oppoInfo.useReleaseSign && !config.oppoSign.generateSign) { // 使用release签名,并且没有重新生成
+        // 从项目中将签名拷贝到OPPO快游戏项目中
+        let 
+            privatePem = path.join(workSpaceDir, "sign", "release", "private.pem"),
+            certificatePem = path.join(workSpaceDir, "sign", "release", "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest));
+    }
+});
+
+gulp.task("deleteSignFile_OPPO", ["copySignFile_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	if (config.oppoSign.generateSign) { // 新生成的签名
+		let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+		return del([privatePem, certificatePem], { force: true });
+	}
+});
+
+gulp.task("modifyFile_OPPO", ["deleteSignFile_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	// 修改manifest.json文件
+	let manifestPath = path.join(projDir, "manifest.json");
+	let IDEManifestPath = path.join(toolkitPath, "tpl", "manifest.json");
+	if (!fs.existsSync(IDEManifestPath)) {
+		return;
+	}
+	let manifestContent = fs.readFileSync(IDEManifestPath, "utf8");
+	let manifestJson = JSON.parse(manifestContent);
+	manifestJson.package = config.oppoInfo.package;
+	manifestJson.name = config.oppoInfo.name;
+	manifestJson.orientation = config.oppoInfo.orientation;
+	manifestJson.config.logLevel = config.oppoInfo.logLevel || "off";
+	manifestJson.versionName = config.oppoInfo.versionName;
+	manifestJson.versionCode = config.oppoInfo.versionCode;
+	manifestJson.minPlatformVersion = config.oppoInfo.minPlatformVersion;
+	manifestJson.icon = `./${path.basename(config.oppoInfo.icon)}`;
+	if (config.oppoInfo.subpack) {
+		manifestJson.subpackages = config.oppoSubpack;
+	}
+	fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4), "utf8");
+
+	if (config.version) {
+		let versionPath = projDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	// OPPO项目,修改main.js
+	let filePath = path.join(projDir, "main.js");
+	// 这个地方,1.x IDE和2.x IDE 不一致
+	let fileContent = `window.navigator.userAgent = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 OPPO MiniGame NetType/WIFI Language/zh_CN';
+require("./libs/laya.quickgamemini.js");\nrequire("index.js");`;
+	fs.writeFileSync(filePath, fileContent, "utf8");
+
+	// OPPO项目,修改index.js
+	let indexFilePath = path.join(projDir, indexJsStr);
+	if (!fs.existsSync(indexFilePath)) {
+		return;
+	}
+	let indexFileContent = fs.readFileSync(indexFilePath, "utf8");
+	indexFileContent = indexFileContent.replace(/loadLib(\(['"])/gm, "require$1./");
+	fs.writeFileSync(indexFilePath, indexFileContent, "utf8");
+});
+
+gulp.task("version_OPPO", ["modifyFile_OPPO"], function () {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = projDir + "/version.json";
+		let mainJSPath = projDir + "/main.js";
+		let srcList = [versionPath, mainJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(projDir));
+	}
+});
+
+// 打包rpk
+gulp.task("buildRPK_OPPO", ["version_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	// 在OPPO轻游戏项目目录中执行:
+    // quickgame pack || quickgame pack release
+    // quickgame subpack --no-build-js || quickgame subpack release --no-build-js
+	let cmdStr = "";
+	let packStr = "pack";
+	let nobuildjs = "";
+	if (config.oppoInfo.subpack) {
+		packStr = "subpack";
+		nobuildjs = "--no-build-js";
+	}
+    if (config.oppoInfo.useReleaseSign) {
+        cmdStr = "release";
+    }
+	return new Promise((resolve, reject) => {
+		let cmd = path.join(toolkitPath, "lib", "bin", `quickgame${commandSuffix}`);
+		let args = [packStr, cmdStr, nobuildjs];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn('npx.cmd', ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+gulp.task("pushRPK_OPPO", ["buildRPK_OPPO"], function() {
+	// 如果不是OPPO快游戏
+	if (platform !== "oppogame") {
+		return;
+	}
+	if (!config.oppoInfo.oppoDebug) {
+        return;
+    }
+	// 在OPPO轻游戏项目目录中执行:
+    // adb push dist/game.rpk sdcard/games
+	// adb push idePath/resources/app/out/layarepublic/oppo/instant_app_settings.properties
+	// adb shell am start -n com.nearme.instant.platform/com.oppo.autotest.main.InstantAppActivity
+	return new Promise((resolve, reject) => {
+		let cmd = "adb";
+		let sdGamesPath = config.oppoInfo.subpack ? "sdcard/subPkg" : "sdcard/games";
+		let args = ["push", `dist/${config.oppoInfo.package}${config.oppoInfo.useReleaseSign ? ".signed" : ""}.rpk`, sdGamesPath];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn('npx.cmd', ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`1) push_RPK 子进程退出码:${code}`);
+			resolve();
+		});
+	}).then(() => {
+		return new Promise((resolve, reject) => {
+			// 如果是分包,需要修改里面的内容
+			let oppoPropPath = path.join(ideModuleDir, "../", `/out/layarepublic/oppo/instant_app_settings.properties`);
+			if (config.oppoInfo.subpack) {
+				fs.writeFileSync(oppoPropPath, "default_tab_index=4", "utf8");
+			} else {
+				fs.writeFileSync(oppoPropPath, "default_tab_index=2", "utf8");
+			}
+			let cmd = "adb";
+			let args = ["push", oppoPropPath, "sdcard/"];
+			let opts = {
+				cwd: projDir
+			};
+			let cp = childProcess.spawn(cmd, args, opts);
+			// let cp = childProcess.spawn('npx.cmd', ['-v']);
+			cp.stdout.on('data', (data) => {
+				console.log(`stdout: ${data}`);
+			});
+	
+			cp.stderr.on('data', (data) => {
+				console.log(`stderr: ${data}`);
+				// reject();
+			});
+	
+			cp.on('close', (code) => {
+				console.log(`2) push_RPK 子进程退出码:${code}`);
+				resolve();
+			});
+		});
+	}).then(() => {
+		return new Promise((resolve, reject) => {
+			let cmd = "adb";
+			let args = ["shell", "am", "start", "-n", "com.nearme.instant.platform/com.oppo.autotest.main.InstantAppActivity"];
+			let opts = {
+				cwd: projDir
+			};
+			let cp = childProcess.spawn(cmd, args, opts);
+			// let cp = childProcess.spawn('npx.cmd', ['-v']);
+			cp.stdout.on('data', (data) => {
+				console.log(`stdout: ${data}`);
+			});
+	
+			cp.stderr.on('data', (data) => {
+				console.log(`stderr: ${data}`);
+				// reject();
+			});
+	
+			cp.on('close', (code) => {
+				console.log(`3) push_RPK 子进程退出码:${code}`);
+				resolve();
+			});
+		});
+	});
+});
+
+gulp.task("buildOPPOProj", ["pushRPK_OPPO"], function() {
+	console.log("all tasks completed");
+});

+ 89 - 0
RubikCube/.laya/_publish_qqgame_1597930428263.js

@@ -0,0 +1,89 @@
+// v1.0.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_qqgame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_qqgame.js", "").replace("/.laya/publish_qqgame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const crypto = require("crypto");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+    releaseDir;
+let isGlobalCli = true;
+let versionCon; // 版本管理version.json
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_QQ", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "qqgame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		config = pubsetJson[2];
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		config = global.config;
+	}
+	// 如果不是QQ小游戏
+	if (platform !== "qqgame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.qqmini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("copyPlatformFile_QQ", ["preCreate_QQ"], function() {
+	// 如果不是QQ小游戏
+	if (platform !== "qqgame") {
+		return;
+	}
+	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "qqfiles");
+	let stream = gulp.src(adapterPath + "/*.*");
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("version_QQ", ["copyPlatformFile_QQ"], function() {
+	// 如果不是QQ小游戏
+	if (platform !== "qqgame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		let gameJSPath = releaseDir + "/game.js";
+		let srcList = [versionPath, gameJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+gulp.task("buildQQProj", ["version_QQ"], function() {
+	console.log("all tasks completed");
+});

+ 732 - 0
RubikCube/.laya/_publish_vivogame_1597930428149.js

@@ -0,0 +1,732 @@
+// v1.2.1
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_vivogame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_vivogame.js", "").replace("/.laya/publish_vivogame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const iconv =  require(ideModuleDir + "iconv-lite");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+	releaseDir,
+    tempReleaseDir, // vivo临时拷贝目录
+	projDir, // vivo快游戏工程目录
+	isDealNoCompile = true,
+	physicsLibsPathList = [],
+	isExistEngineFolder = false; // bin目录下是否存在engine文件夹
+let projSrc;
+let versionCon; // 版本管理version.json
+// 创建vivo项目前,拷贝vivo引擎库、修改index.js
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_VIVO", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "vivogame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		releaseDir = tempReleaseDir = path.join(releaseDir, "temprelease");
+		config = pubsetJson[6]; // 只用到了 config.vivoInfo|config.vivoSign
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		tempReleaseDir = global.tempReleaseDir;
+		config = global.config;
+	}
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.vvmini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(tempReleaseDir));
+});
+
+gulp.task("copyPlatformFile_VIVO", ["preCreate_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	let vivoAdapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "vivofiles");
+	let copyLibsList = [`${vivoAdapterPath}/**/*.*`];
+	var stream = gulp.src(copyLibsList);
+	return stream.pipe(gulp.dest(tempReleaseDir));
+});
+
+// 检查是否全局安装了qgame
+gulp.task("createGlobalQGame_VIVO", ["copyPlatformFile_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	releaseDir = path.dirname(releaseDir);
+	projDir = path.join(releaseDir, config.vivoInfo.projName);
+	projSrc = path.join(projDir, "src");
+	// npm view @vivo-minigame/cli version
+	// npm install -g @vivo-minigame/cli
+	let remoteVersion, localVersion;
+	let isGetRemote, isGetLocal;
+	let isUpdateGlobalQGame = true;
+	return new Promise((resolve, reject) => { // 远程版本号
+		childProcess.exec("npm view  @vivo-minigame/cli version", function(error, stdout, stderr) {
+			if (!stdout) { // 获取 @vivo-minigame/cli 远程版本号失败
+				console.log("Failed to get the remote version number");
+				resolve();
+				return;
+			}
+			remoteVersion = stdout;
+			isGetRemote = true;
+			if (isGetRemote && isGetLocal) {
+				isUpdateGlobalQGame = remoteVersion != localVersion;
+				console.log(`remoteVersion: ${remoteVersion}, localVersion: ${localVersion}`);
+				resolve();
+			}
+		});
+		childProcess.exec("mg -v", { cwd: `${projDir}/node_modules` }, function(error, stdout, stderr) {
+			if (!stdout) { // 获取  @vivo-minigame/cli 本地版本号失败
+				console.log("Failed to get the local version number");
+				resolve();
+				return;
+			}
+			localVersion = stdout;
+			isGetLocal = true;
+			if (isGetRemote && isGetLocal) {
+				isUpdateGlobalQGame = remoteVersion != localVersion;
+				console.log(`remoteVersion: ${remoteVersion}, localVersion: ${localVersion}`);
+				resolve();
+			}
+		});
+		setTimeout(() => {
+			if (!isGetLocal || !isGetRemote) {
+				console.log("Failed to get the local or remote version number");
+				resolve();
+				return;
+			}
+		}, 10000);
+	}).then(() => {
+		return new Promise((resolve, reject) => {
+			if (!isUpdateGlobalQGame) {
+				resolve();
+				return;
+			}
+			console.log("全局安装@vivo-minigame/cli");
+			// npm install -g @vivo-minigame/cli
+			let cmd = `npm${commandSuffix}`;
+			let args = ["install", "@vivo-minigame/cli", "-g"];
+			let cp = childProcess.spawn(cmd, args);
+			
+			cp.stdout.on('data', (data) => {
+				console.log(`stdout: ${data}`);
+			});
+	
+			cp.stderr.on('data', (data) => {
+				console.log(`stderr: ${data}`);
+				// reject();
+			});
+	
+			cp.on('close', (code) => {
+				console.log(`2 end) npm install -g @vivo-minigame/cli:${code}`);
+				resolve();
+			});
+		});
+	}).catch((e) => {
+		console.log("catch e", e);
+	});
+});
+
+gulp.task("createProj_VIVO", ["createGlobalQGame_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 如果有即存项目,不再新建
+	let isProjExist = fs.existsSync(projDir + "/node_modules") && 
+					  fs.existsSync(projDir + "/sign");
+	if (isProjExist) {
+		// 检测是否需要升级
+		let packageCon = fs.readFileSync(`${projDir}/package.json`, "utf8");
+		let minigamePath = path.join(projDir, "minigame.config.js");
+		if (packageCon.includes("@vivo-minigame/cli-service") && fs.existsSync(minigamePath)) {
+			return;
+		}
+	}
+	// 如果有即存项目,但是是旧的项目,删掉后重新创建
+	return new Promise((resolve, reject) => {
+		if (!fs.existsSync(projDir)) {
+			return resolve();
+		}
+		let delList = [projDir];
+		del(delList, { force: true }).then(paths => {
+			resolve();
+		});
+	}).then(function() {
+		// 在项目中创建vivo项目
+		return new Promise((resolve, reject) => {
+			console.log("(proj)开始创建vivo快游戏项目");
+			// mg init <project-name>
+			let cmd = `mg${commandSuffix}`;
+			let args = ["init", config.vivoInfo.projName];
+			let opts = {
+				cwd: releaseDir,
+				shell: true
+			};
+
+			let cp = childProcess.spawn(cmd, args, opts);
+			
+			cp.stdout.on('data', (data) => {
+				console.log(`stdout: ${data}`);
+			});
+			
+			cp.stderr.on('data', (data) => {
+				console.log(`stderr: ${data}`);
+				// reject();
+			});
+			
+			cp.on('close', (code) => {
+				cp = null;
+				console.log(`子进程退出码:${code}`);
+				resolve();
+			});
+		});
+	});
+});
+
+// 拷贝文件到vivo快游戏
+gulp.task("copyFileToProj_VIVO", ["createProj_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 如果有js/main.js,将其删除
+	let vivoMainPath = path.join(projDir, "src", "js", "main.js");
+	if (fs.existsSync(vivoMainPath)) {
+		fs.unlinkSync(vivoMainPath);
+	}
+	// 将临时文件夹中的文件,拷贝到项目中去
+	let originalDir = `${tempReleaseDir}/**/*.*`;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(path.join(projSrc)));
+});
+
+// 拷贝icon到vivo快游戏
+gulp.task("copyIconToProj_VIVO", ["copyFileToProj_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	let originalDir = config.vivoInfo.icon;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(projSrc));
+});
+
+// 清除vivo快游戏临时目录
+gulp.task("clearTempDir_VIVO", ["copyIconToProj_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 删掉临时目录
+	return del([tempReleaseDir], { force: true });
+});
+
+// 生成release签名(私钥文件 private.pem 和证书文件 certificate.pem )
+gulp.task("generateSign_VIVO", ["clearTempDir_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+    }
+    if (!config.vivoSign.generateSign) {
+        return;
+    }
+	// https://doc.quickapp.cn/tools/compiling-tools.html
+	return new Promise((resolve, reject) => {
+		let cmd = "openssl";
+		let args = ["req", "-newkey", "rsa:2048", "-nodes", "-keyout", "private.pem", 
+					"-x509", "-days", "3650", "-out", "certificate.pem"];
+		let opts = {
+			cwd: projDir,
+			shell: true
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			data += "";
+			if (data.includes("Country Name")) {
+				cp.stdin.write(`${config.vivoSign.countryName}\n`);
+				console.log(`Country Name: ${config.vivoSign.countryName}`);
+			} else if (data.includes("Province Name")) {
+				cp.stdin.write(`${config.vivoSign.provinceName}\n`);
+				console.log(`Province Name: ${config.vivoSign.provinceName}`);
+			} else if (data.includes("Locality Name")) {
+				cp.stdin.write(`${config.vivoSign.localityName}\n`);
+				console.log(`Locality Name: ${config.vivoSign.localityName}`);
+			} else if (data.includes("Organization Name")) {
+				cp.stdin.write(`${config.vivoSign.orgName}\n`);
+				console.log(`Organization Name: ${config.vivoSign.orgName}`);
+			} else if (data.includes("Organizational Unit Name")) {
+				cp.stdin.write(`${config.vivoSign.orgUnitName}\n`);
+				console.log(`Organizational Unit Name: ${config.vivoSign.orgUnitName}`);
+			} else if (data.includes("Common Name")) {
+				cp.stdin.write(`${config.vivoSign.commonName}\n`);
+				console.log(`Common Name: ${config.vivoSign.commonName}`);
+			} else if (data.includes("Email Address")) {
+				cp.stdin.write(`${config.vivoSign.emailAddr}\n`);
+				console.log(`Email Address: ${config.vivoSign.emailAddr}`);
+				// cp.stdin.end();
+			}
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+// 拷贝sign文件到指定位置
+gulp.task("copySignFile_VIVO", ["generateSign_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+    }
+    if (config.vivoSign.generateSign) { // 新生成的签名
+        // 移动签名文件到项目中(Laya & vivo快游戏项目中)
+        let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`,
+            layaDest = `${workSpaceDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest))
+                    .pipe(gulp.dest(layaDest));
+    } else if (config.vivoInfo.useReleaseSign && !config.vivoSign.generateSign) { // 使用release签名,并且没有重新生成
+        // 从项目中将签名拷贝到vivo快游戏项目中
+        let 
+            privatePem = path.join(workSpaceDir, "sign", "release", "private.pem"),
+            certificatePem = path.join(workSpaceDir, "sign", "release", "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest));
+    }
+});
+
+gulp.task("deleteSignFile_VIVO", ["copySignFile_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (config.vivoSign.generateSign) { // 新生成的签名
+		let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+		return del([privatePem, certificatePem], { force: true });
+	}
+});
+
+gulp.task("modifyFile_VIVO", ["deleteSignFile_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 修改manifest.json文件
+	let manifestPath = path.join(projSrc, "manifest.json");
+	if (!fs.existsSync(manifestPath)) {
+		return;
+	}
+	let manifestContent = fs.readFileSync(manifestPath, "utf8");
+	let manifestJson = JSON.parse(manifestContent);
+	manifestJson.package = config.vivoInfo.package;
+	manifestJson.name = config.vivoInfo.name;
+	manifestJson.orientation = config.vivoInfo.orientation;
+	manifestJson.config.logLevel = config.vivoInfo.logLevel || "off";
+	manifestJson.deviceOrientation = config.vivoInfo.orientation;
+	manifestJson.versionName = config.vivoInfo.versionName;
+	manifestJson.versionCode = config.vivoInfo.versionCode;
+	manifestJson.minPlatformVersion = config.vivoInfo.minPlatformVersion;
+	manifestJson.icon = `/${path.basename(config.vivoInfo.icon)}`;
+	if (config.vivoInfo.subpack) { // 分包
+		manifestJson.subpackages = config.vivoSubpack;
+	} else {
+		delete manifestJson.subpackages;
+	}
+	// 增加thirdEngine字段
+	let EngineVersion = getEngineVersion();
+	if (EngineVersion) {
+		manifestJson.thirdEngine = {
+			"laya": EngineVersion
+		};
+	}
+	fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4), "utf8");
+	
+	if (config.version) {
+		let versionPath = projSrc + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	// 修改game.js文件
+	let content = `require("./qgame-adapter.js");\nif(!window.navigator)\n\twindow.navigator = {};\nwindow.navigator.userAgent = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 VVGame NetType/WIFI Language/zh_CN';
+require("./libs/laya.vvmini.js");\nrequire("./index.js");`;
+	let gameJsPath = path.join(projSrc, "game.js");
+	fs.writeFileSync(gameJsPath, content, "utf8");
+
+	// vivo项目,修改index.js
+	let filePath = path.join(projSrc, indexJsStr);
+	if (!fs.existsSync(filePath)) {
+		return;
+	}
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	fileContent = fileContent.replace(/loadLib(\(['"])/gm, "require$1./");
+	fs.writeFileSync(filePath, fileContent, "utf8");
+})
+
+function getEngineVersion() {
+	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
+	let isHasCoreLib = fs.existsSync(coreLibPath);
+	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let isNewTsProj = fs.existsSync(`${workSpaceDir}/src/tsconfig.json`) && !isHasCoreLib;
+	let EngineVersion;
+	if (isHasCoreLib) {
+		let con = fs.readFileSync(coreLibPath, "utf8");
+		let matchList = con.match(/Laya\.version\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+		if (!Array.isArray(matchList)) {
+			return null;
+		}
+		EngineVersion = matchList[1];
+	} else { // newts项目和旧版本as项目
+		if (isOldAsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "laya", "src", "Laya.as");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/version:String\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		} else if (isNewTsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "Laya.ts");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/static\s*version:\s*string\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		}
+	}
+	return EngineVersion;
+}
+
+gulp.task("version_VIVO", ["modifyFile_VIVO"], function () {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = projSrc + "/version.json";
+		let mainJSPath = projSrc + "/game.js";
+		let srcList = [versionPath, mainJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(projSrc));
+	}
+});
+
+// 处理engine文件夹
+gulp.task("dealEngineFolder1_VIVO", ["version_VIVO"], function() {
+	// 如果项目中有engine文件夹,我们默认该开发者是熟悉VIVO发布流程的,已经处理好所有的逻辑
+	// 值得注意的:
+	// 1) 如果有engine文件夹而未处理2D物理库(box2d.js/physics.js),项目将无法运行
+	// 2) 如果未处理3D物理库(physics3D.js),打包时间将会很长
+
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	let engineFolder = path.join(projDir, "src", "engine");
+	isExistEngineFolder = fs.existsSync(engineFolder);
+	if (!isExistEngineFolder) {
+		return;
+	}
+
+	let adapterOriginalPath = path.join(projDir, "src", "qgame-adapter.js");
+
+	// 不想写一堆task任务,500ms默认拷贝完成吧
+	// 未来有了更好的解决方案再修改
+	return new Promise(function(resolve, reject) {
+		// 将engine文件夹拷贝到projRoot下
+		setTimeout(resolve, 500);
+		var stream = gulp.src([`${engineFolder}/**/*.*`], {base: `${projDir}/src`});
+		return stream.pipe(gulp.dest(projDir));
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			// 将adapter.js拷贝到engine文件夹中
+			setTimeout(resolve, 500);
+			var stream = gulp.src([adapterOriginalPath]);
+			return stream.pipe(gulp.dest(`${projDir}/engine`));
+		});
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			// 删掉src下的engine和adapter
+			setTimeout(resolve, 500);
+			return del([engineFolder, adapterOriginalPath], { force: true });
+		});
+	}).catch(function(err) {
+		console.log(err);
+	});
+});
+
+gulp.task("dealEngineFolder2_VIVO", ["dealEngineFolder1_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (!isExistEngineFolder) {
+		return;
+	}
+	
+	let engineFolder = path.join(projDir, "engine");
+	let engineFileList = fs.readdirSync(engineFolder);
+	// 修改配置文件
+	configVivoConfigFile(engineFileList);
+});
+
+// 如果项目中用到了 box2d.js|laya.physics.js/laya.physics3D.js ,需要特殊处理
+// 之前处理的是有项目中已经存在engine文件夹的情况,现在开始处理没有文件夹的情况
+gulp.task("dealNoCompile1_VIVO", ["dealEngineFolder2_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (!isDealNoCompile) {
+		return;
+	}
+
+	// let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	// let bundleJsStr = (versionCon && versionCon["js/bundle.js"]) ? versionCon["js/bundle.js"] :  "js/bundle.js";
+	// let box2dJsStr = (versionCon && versionCon["libs/box2d.js"]) ? versionCon["libs/box2d.js"] :  "libs/box2d.js";
+	// let physicsJsStr = (versionCon && versionCon["libs/laya.physics.js"]) ? versionCon["libs/laya.physics.js"] :  "libs/laya.physics.js";
+	// let physics3DJsStr = (versionCon && versionCon["libs/laya.physics3D.js"]) ? versionCon["libs/laya.physics3D.js"] :  "libs/laya.physics3D.js";
+
+	// // 修改index.js,去掉物理库前面的libs
+	// let filePath = path.join(projSrc, indexJsStr);
+	// let fileContent = fs.readFileSync(filePath, "utf8");
+	// let physicsNameList = [];
+
+	// if (fileContent.includes(bundleJsStr)) {
+	// 	let adapterJsPath = path.join(projSrc, bundleJsStr);
+	// 	physicsNameList.push(bundleJsStr);
+	// 	physicsLibsPathList.push(adapterJsPath);
+	// }
+	// if (fileContent.includes(box2dJsStr)) {
+	// 	let libPath = path.join(projSrc, box2dJsStr);
+	// 	physicsNameList.push(box2dJsStr);
+	// 	physicsLibsPathList.push(libPath);
+	// }
+	// if (fileContent.includes(physicsJsStr)) {
+	// 	let libPath = path.join(projSrc, physicsJsStr);
+	// 	physicsNameList.push(physicsJsStr);
+	// 	physicsLibsPathList.push(libPath);
+	// }
+	// if (fileContent.includes(physics3DJsStr)) {
+	// 	let libPath = path.join(projSrc, physics3DJsStr);
+	// 	physicsNameList.push(physics3DJsStr);
+	// 	physicsLibsPathList.push(libPath);
+	// }
+	// if (physicsLibsPathList.length > 0) {
+	// 	let adapterJsPath = path.join(projSrc, "qgame-adapter.js");
+	// 	physicsNameList.push("qgame-adapter.js");
+	// 	physicsLibsPathList.push(adapterJsPath);
+	// }
+
+
+	// 将js/bundle.js | libs/*.* qgame-adapter.js 全放到engine文件夹中
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	let bundleJsStr = (versionCon && versionCon["js/bundle.js"]) ? versionCon["js/bundle.js"] :  "js/bundle.js";
+
+	// 修改index.js,去掉物理库前面的libs
+	let filePath = path.join(projSrc, indexJsStr);
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	let physicsNameList = [];
+
+	if (fileContent.includes(bundleJsStr)) {
+		let adapterJsPath = path.join(projSrc, bundleJsStr);
+		physicsNameList.push(bundleJsStr);
+		physicsLibsPathList.push(adapterJsPath);
+	}
+	let libsList = fs.readdirSync(path.join(projSrc, "libs"));
+	let libsFileName, libsFilePath;
+	for (let i = 0, len = libsList.length; i < len; i++) {
+		libsFileName = libsList[i];
+		libsFilePath = path.join(projSrc, "libs", libsFileName);
+		physicsNameList.push(`libs/${libsFileName}`);
+		physicsLibsPathList.push(libsFilePath);
+	}
+	if (physicsLibsPathList.length > 0) {
+		let adapterJsPath = path.join(projSrc, "qgame-adapter.js");
+		physicsNameList.push("qgame-adapter.js");
+		physicsLibsPathList.push(adapterJsPath);
+	}
+
+	// 修改配置文件
+	configVivoConfigFile(physicsNameList);
+
+	// 将物理库、qgame-adapter.js拷贝到engine中
+	var stream = gulp.src(physicsLibsPathList, {base: projSrc});
+	return stream.pipe(gulp.dest(path.join(projDir, "engine")));
+});
+
+function configVivoConfigFile(engineFileList) {
+	let vvConfigPath = path.join(projDir, "minigame.config.js");
+	let content = fs.readFileSync(vvConfigPath, "utf8");
+	let externalsStr = 'const externals = [\n';
+	let libName;
+	for (let i = 0, len = engineFileList.length; i < len; i++) {
+		libName = engineFileList[i];
+		if (i !== 0) {
+			externalsStr += ',\n';
+		}
+		// 不要改这里的缩进,否则最终的结果不好看
+		externalsStr += `{
+		module_name:'./${libName}',
+		module_path:'./${libName}',
+		module_from:'engine/${libName}'
+	}`;
+	}
+	externalsStr += '\t]';
+	content = content.replace(/const externals = \[([^*].|\n|\r)*\]/gm, externalsStr);
+	fs.writeFileSync(vvConfigPath, content, "utf8");
+}
+
+gulp.task("dealNoCompile2_VIVO", ["dealNoCompile1_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	if (!isDealNoCompile || physicsLibsPathList.length === 0) {
+		return;
+	}
+	return del(physicsLibsPathList, { force: true });
+});
+
+// 打包rpk
+gulp.task("buildRPK_VIVO", ["dealNoCompile2_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 在vivo轻游戏项目目录中执行:
+    // npm run build || npm run release
+    let cmdStr = "build";
+    if (config.vivoInfo.useReleaseSign) {
+        cmdStr = "release";
+    }
+	return new Promise((resolve, reject) => {
+		let cmd = `npm${commandSuffix}`;
+		let args = ["run", cmdStr];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			console.log(`stderr(iconv): ${iconv.decode(data, 'gbk')}`);
+			
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+gulp.task("showQRCode_VIVO", ["buildRPK_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// 在vivo轻游戏项目目录中执行:
+	// npm run server
+	return new Promise((resolve, reject) => {
+		let cmd = `npm${commandSuffix}`;
+		let args = ["run", "server"];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`${data}`);
+			// 输出pid,macos要用: macos无法kill进程树,也无法执行命令获取3000端口pid(没有查询权限),导致无法kill这个进程
+			console.log('vv_qrcode_pid:' + cp.pid);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			console.log(`stderr(iconv): ${iconv.decode(data, 'gbk')}`);
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+
+gulp.task("buildVivoProj", ["showQRCode_VIVO"], function() {
+	console.log("all tasks completed");
+});

+ 418 - 0
RubikCube/.laya/_publish_wxgame_1597930428301.js

@@ -0,0 +1,418 @@
+// v1.2.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_wxgame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_wxgame.js", "").replace("/.laya/publish_wxgame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const crypto = require("crypto");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+const provider = "wxe24357b5ce551510";
+const fullRemoteEngineList = ["laya.core.js", "laya.webgl.js", "laya.filter.js", "laya.ani.js", "laya.d3.js", "laya.html.js", "laya.particle.js", "laya.ui.js", "bytebuffer.js"];
+
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+    releaseDir;
+let isGlobalCli = true;
+let isOpendataProj;
+let versionCon; // 版本管理version.json
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_WX", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "wxgame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		config = pubsetJson[1];
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		config = global.config;
+	}
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	// 是否是开放域项目
+	let projInfoPath = path.join(workSpaceDir, path.basename(workSpaceDir) + ".laya");
+	let isExist = fs.existsSync(projInfoPath);
+	if (isExist) {
+		try {
+			let projInfo = fs.readFileSync(projInfoPath, "utf8");
+			projInfo = projInfo && JSON.parse(projInfo);
+			isOpendataProj = projInfo.layaProType === 12;
+		} catch (e) {}
+	}
+	if (isOpendataProj) {
+		return;
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.wxmini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("copyPlatformFile_WX", ["preCreate_WX"], function() {
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return;
+	}
+	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "wxfiles");
+	// 开放域项目
+	if (isOpendataProj) {
+		let platformDir = path.join(adapterPath, "weapp-adapter.js");
+		let stream = gulp.src(platformDir);
+		return stream.pipe(gulp.dest(releaseDir));
+	}
+	// 如果新建项目时已经点击了"微信/百度小游戏bin目录快速调试",不再拷贝
+	let isHadWXFiles =
+		fs.existsSync(path.join(workSpaceDir, "bin", "game.js")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "game.json")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "project.config.json")) &&
+		fs.existsSync(path.join(workSpaceDir, "bin", "weapp-adapter.js"));
+	if (isHadWXFiles) {
+		return;
+	}
+	let copyLibsList = [`${adapterPath}/*.*`];
+	var stream = gulp.src(copyLibsList);
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+// 开放域的情况下,合并game.js和index.js,并删除game.js
+gulp.task("openData_WX", ["copyPlatformFile_WX"], function (cb) {
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return cb();
+	}
+	if (config.openDataZone) {
+		let versionCon;
+		if (config.version) {
+			let versionPath = releaseDir + "/version.json";
+			versionCon = fs.readFileSync(versionPath, "utf8");
+			versionCon = JSON.parse(versionCon);
+		}
+		let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+		let indexPath = path.join(releaseDir, indexJsStr);
+		let indexjs = readFile(indexPath);
+		let gamejs = readFile(releaseDir + "/game.js");
+		if (gamejs && indexjs) {
+			gamejs = gamejs.replace(`require("index.js")`, indexjs);
+			fs.writeFileSync(indexPath, gamejs, 'utf-8');
+		}
+		if (isOpendataProj) {
+			// 开放域项目,将game.js删掉,发布最小包
+			del(`${releaseDir}/game.js`, { force: true }).then(paths => {
+				cb();
+			});
+		} else {
+			cb();
+		}
+	} else {
+		cb();
+	}
+});
+
+function readFile(path) {
+	if (fs.existsSync(path)) {
+		return fs.readFileSync(path, "utf-8");
+	}
+	return null;
+}
+
+gulp.task("version_WX", ["openData_WX"], function() {
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		let gameJSPath = releaseDir + "/game.js";
+		let srcList = [versionPath, gameJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+gulp.task("optimizeOpen_WX", ["version_WX"], function(cb) {
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return cb();
+	}
+	let wxOptimize = config.wxOptimize;
+	if (!wxOptimize || !wxOptimize.useOptimizeOpen) { // 没有使用微信引擎插件,还是像以前一样发布
+		return cb();
+	}
+	// 首屏加载优化(秒开),修改game.json
+	let filePath = path.join(releaseDir, "game.json");
+	if (!fs.existsSync(filePath)) {
+		return cb();
+	}
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	let fileConObj = JSON.parse(fileContent);
+	if (wxOptimize.preloadRes) {
+		fileConObj.preloadResources = wxOptimize.preloadResList;
+	} else {
+		delete fileConObj.preloadResources;
+	}
+	if (wxOptimize.preloadSubpack) {
+		fileConObj.preloadSubpackages = wxOptimize.preloadSubpackList;
+	} else {
+		delete fileConObj.preloadSubpackages;
+	}
+	fs.writeFileSync(filePath, JSON.stringify(fileConObj, null, 4), "utf8");
+	return cb();
+});
+
+gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
+	// 如果不是微信小游戏
+	if (platform !== "wxgame") {
+		return cb();
+	}
+	if (!config.uesEnginePlugin) { // 没有使用微信引擎插件,还是像以前一样发布
+		return cb();
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	
+	// 获取version等信息
+	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
+	let isHasCoreLib = fs.existsSync(coreLibPath);
+	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let EngineVersion = getEngineVersion();
+	if (!EngineVersion) {
+		throw new Error(`读取引擎版本号失败,请于服务提供商联系!`);
+	}
+	if (!EngineVersion || EngineVersion.includes("beta") || !canUsePluginEngine(EngineVersion)) {
+		throw new Error(`该版本引擎无法使用引擎插件功能(engineVersion: ${EngineVersion})`);
+	}
+	console.log(`通过版本号检查:  ${EngineVersion}`);
+	// 使用引擎插件
+	let localUseEngineList = [];
+	let copyEnginePathList;
+	new Promise(function(resolve, reject) {
+		console.log(`修改game.js和game.json`);
+		// 1) 修改game.js和game.json
+		// 修改game.js
+		let gameJsPath = path.join(releaseDir, "game.js");
+		let gameJscontent = `require("weapp-adapter.js");\nrequire("./libs/laya.wxmini.js");\nrequirePlugin('layaPlugin');\nwindow.loadLib = require;\nrequire("./${indexJsStr}");`;
+		fs.writeFileSync(gameJsPath, gameJscontent, "utf8");
+		// 修改game.json,使其支持引擎插件
+		let gameJsonPath = path.join(releaseDir, "game.json");
+		let gameJsonContent = fs.readFileSync(gameJsonPath, "utf8");
+		let conJson = JSON.parse(gameJsonContent);
+		conJson.plugins = {
+			"layaPlugin": {
+				"version": EngineVersion,
+				"provider": provider,
+				"path": "laya-libs"
+			}
+		}
+		gameJsonContent = JSON.stringify(conJson, null, 4);
+		fs.writeFileSync(gameJsonPath, gameJsonContent, "utf8");
+		resolve();
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`确定用到的插件引擎`);
+			// 2) 确定用到了那些插件引擎,并将插件引擎从index.js的引用中去掉
+			let indexJsPath = path.join(releaseDir, indexJsStr);
+			let indexJsCon = fs.readFileSync(indexJsPath, "utf8");
+			let item, fullRequireItem;
+			for (let i = 0, len = fullRemoteEngineList.length; i < len; i++) {
+				item = fullRemoteEngineList[i];
+				fullRequireItem = `loadLib("libs/${item}")`;
+				if (indexJsCon.includes(fullRequireItem)) {
+					localUseEngineList.push(item);
+					indexJsCon = indexJsCon.replace(fullRequireItem, "");
+				}
+			}
+			if (isOldAsProj) { // 如果as语言,开发者将laya.js也写入index.js中了,将其删掉
+				fullRequireItem = `loadLib("laya.js")`;
+				if (indexJsCon.includes(fullRequireItem)) {
+					indexJsCon = indexJsCon.replace(fullRequireItem, "");
+				}
+			}
+			fs.writeFileSync(indexJsPath, indexJsCon, "utf8");
+			// ts/js再次修改game.js,仅引用使用到的类库
+			// as因为本地只有laya.js,无法仅引用使用到的类库
+			if (!isOldAsProj) {
+				let pluginCon = "";
+				localUseEngineList.forEach(function(item) {
+					pluginCon += `requirePlugin("layaPlugin/${item}");\n`;
+				});
+				let gameJsPath = path.join(releaseDir, "game.js");
+				let gameJsCon = fs.readFileSync(gameJsPath, "utf8");
+				gameJsCon = gameJsCon.replace(`requirePlugin('layaPlugin');`, pluginCon);
+				fs.writeFileSync(gameJsPath, gameJsCon, "utf8");
+			}
+			resolve();
+		});
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`将本地的引擎插件移动到laya-libs中`);
+			// 3) 将本地的引擎插件移动到laya-libs中
+			copyEnginePathList = [`${releaseDir}/libs/{${localUseEngineList.join(",")}}`];
+			if (isOldAsProj) { // 单独拷贝laya.js
+				copyEnginePathList = [`${releaseDir}/laya.js`];
+			}
+			gulp.src(copyEnginePathList).pipe(gulp.dest(`${releaseDir}/laya-libs`));
+			setTimeout(resolve, 500);
+		});
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`将libs中的本地引擎插件删掉`);
+			// 4) 将libs中的本地引擎插件删掉
+			del(copyEnginePathList, { force: true }).then(resolve);
+		});
+	}).then(function() {
+		return new Promise(async function(resolve, reject) {
+			console.log(`完善引擎插件目录`);
+			// 5) 引擎插件目录laya-libs中还需要新建几个文件,使该目录能够使用
+			if (isOldAsProj) { // 单独拷贝laya.js
+				localUseEngineList.push("laya.js");
+			}
+			let 
+				layalibsPath = path.join(releaseDir, "laya-libs"),
+				engineIndex = path.join(layalibsPath, "index.js"),
+				engineplugin = path.join(layalibsPath, "plugin.json"),
+				enginesignature = path.join(layalibsPath, "signature.json");
+			// index.js
+			if (!fs.existsSync(layalibsPath)) {
+				throw new Error("引擎插件目录创建失败,请与服务提供商联系!");
+			}
+			let indexCon = "";
+			localUseEngineList.forEach(function(item) {
+				indexCon += `require("./${item}");\n`;
+			});
+			fs.writeFileSync(engineIndex, indexCon, "utf8");
+			// plugin.json
+			let pluginCon = {"main": "index.js"};
+			fs.writeFileSync(engineplugin, JSON.stringify(pluginCon, null, 4), "utf8");
+			// signature.json
+			let signatureCon = {
+				"provider": provider,
+				"signature": []
+			};
+			localUseEngineList.unshift("index.js");
+			let fileName, md5Str;
+			for (let i = 0, len = localUseEngineList.length; i < len; i++) {
+				fileName = localUseEngineList[i];
+				let md5Str = await getFileMd5(path.join(releaseDir, "laya-libs", fileName));
+				signatureCon.signature.push({
+					"path": fileName,
+					"md5": md5Str
+				});
+			}
+			fs.writeFileSync(enginesignature, JSON.stringify(signatureCon, null, 4), "utf8");
+			resolve();
+		});
+	})
+	.then(function() {
+		cb();
+	}).catch(function(e) {
+		throw e;
+	})
+});
+
+function getEngineVersion() {
+	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
+	let isHasCoreLib = fs.existsSync(coreLibPath);
+	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let isNewTsProj = fs.existsSync(`${workSpaceDir}/src/tsconfig.json`) && !isHasCoreLib;
+	let EngineVersion;
+	if (isHasCoreLib) {
+		let con = fs.readFileSync(coreLibPath, "utf8");
+		let matchList = con.match(/Laya\.version\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+		if (!Array.isArray(matchList)) {
+			return null;
+		}
+		EngineVersion = matchList[1];
+	} else { // newts项目和旧版本as项目
+		if (isOldAsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "laya", "src", "Laya.as");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/version:String\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		} else if (isNewTsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "Laya.ts");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/static\s*version:\s*string\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		}
+	}
+	return EngineVersion;
+}
+
+function getFileMd5(filePath) {
+	return new Promise(function(resolve, reject) {
+		let md5 = crypto.createHash('md5');
+		let stream = fs.createReadStream(filePath);
+		stream.on("data", function(data) {
+			md5.update(data);
+		});
+		stream.on("end", function() {
+			let md5Str = md5.digest('hex');
+			return resolve(md5Str);
+		});
+	});
+}
+
+function canUsePluginEngine(version) {
+	const minVersionNum = "2.0.2";
+	let compileMacthList = minVersionNum.match(/^(\d+)\.(\d+)\.(\d+)/);
+	let matchList = version.match(/^(\d+)\.(\d+)\.(\d+)/);
+    if (matchList[1] > compileMacthList[1]) {
+        return true;
+	}
+    if (matchList[1] === compileMacthList[1] && matchList[2] > compileMacthList[2]) {
+        return true;
+    }
+    if (matchList[1] === compileMacthList[1] && matchList[2] === compileMacthList[2] && matchList[3] >= compileMacthList[3]) {
+        return true;
+    }
+    return false;
+}
+
+gulp.task("buildWXProj", ["pluginEngin_WX"], function() {
+	console.log("all tasks completed");
+});

+ 519 - 0
RubikCube/.laya/_publish_xmgame_1597930428099.js

@@ -0,0 +1,519 @@
+// v1.2.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_xmgame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_xmgame.js", "").replace("/.laya/publish_xmgame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const childProcess = require("child_process");
+const del = require(ideModuleDir + "del");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+
+let prevTasks = ["packfile"];
+if (isPublish2) {
+	prevTasks = "";
+}
+
+let 
+    config,
+	platform,
+	releaseDir,
+    tempReleaseDir, // 小米临时拷贝目录
+	projDir; // 小米快游戏工程目录
+let IDEXMProjPath,
+	isUpdateIDEXMProj = false;
+let versionCon; // 版本管理version.json
+// 创建小米项目前,拷贝小米引擎库、修改index.js
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_XM", prevTasks, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "xmgame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		releaseDir = tempReleaseDir = path.join(releaseDir, "temprelease");
+		config = pubsetJson[4]; // 只用到了 config.xmInfo|config.xmSign
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		tempReleaseDir = global.tempReleaseDir;
+		config = global.config;
+	}
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.xmmini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(tempReleaseDir));
+});
+
+gulp.task("copyPlatformFile_XM", ["preCreate_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	let xmAdapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "xmfiles");
+	let copyLibsList = [`${xmAdapterPath}/**/*.*`];
+	var stream = gulp.src(copyLibsList);
+	return stream.pipe(gulp.dest(tempReleaseDir));
+});
+
+// 新建小米项目-小米项目与其他项目不同,需要新建小米快游戏项目,并打包成.rpk文件
+gulp.task("checkIDEProj_XM", ["copyPlatformFile_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	if (!ideModuleDir) {
+		return;
+	}
+	IDEXMProjPath = path.join(ideModuleDir, "../", "out", "layarepublic", "xm");
+	if (process.platform === "darwin") {
+		return;
+	}
+	let ideLastXMProjPath = path.join(IDEXMProjPath, config.xmInfo.projName);
+	// 如果IDE中没有小米项目,跳过这一步
+	let isProjExist = fs.existsSync(ideLastXMProjPath + "/node_modules") && 
+					  fs.existsSync(ideLastXMProjPath + "/sign");
+	if (!isProjExist) {
+		console.log("IDE中没有小米项目,跳过检查小米项目版本号这一步");
+		return;
+	}
+	// 如果IDE中项目已经存在了,检查版本号
+	// npm view quickgame-cli version
+	// npm ls quickgame-cli
+	let remoteVersion, localVersion;
+	let isGetRemote, isGetLocal;
+	return new Promise((resolve, reject) => { // 远程版本号
+		childProcess.exec("npm view quickgame-cli version", function(error, stdout, stderr) {
+			if (!stdout) { // 获取 quickgame-cli 远程版本号失败
+				reject();
+				return;
+			}
+			remoteVersion = stdout;
+			isGetRemote = true;
+			if (isGetRemote && isGetLocal) {
+				resolve();
+			}
+		});
+		childProcess.exec("npm ls quickgame-cli", { cwd: ideLastXMProjPath }, function(error, stdout, stderr) {
+			if (!stdout) { // 获取 quickgame-cli 本地版本号失败
+				reject();
+				return;
+			}
+			localVersion = stdout.match(/quickgame-cli@(.+)/);
+			localVersion = localVersion && localVersion[1];
+			isGetLocal = true;
+			if (isGetRemote && isGetLocal) {
+				resolve();
+			}
+		});
+		setTimeout(() => {
+			if (!isGetLocal || !isGetRemote) {
+				console.log("获取远程版本号或本地版本号失败");
+				reject();
+				return;
+			}
+		}, 10000);
+	}).then(() => { // 比较两个版本号
+		if (!remoteVersion || !localVersion) {
+			console.log("获取远程版本号或本地版本号失败!");
+		}
+		console.log("quickgame-cli -> ", localVersion, "|", remoteVersion);
+		if (remoteVersion.trim() !== localVersion.trim()) { // 仅当两个版本号都获取到并且不相等,置为需要更新(true)
+			isUpdateIDEXMProj = true;
+		}
+	}).catch((e) => {
+		console.log("获取远程版本号或本地版本号失败 -> ", remoteVersion, "|", localVersion);
+		console.log(e);
+	});
+});
+
+gulp.task("createIDEProj_XM", ["checkIDEProj_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	if (!ideModuleDir) {
+		return;
+	}
+	if (process.platform === "darwin") {
+		return;
+	}
+	let ideLastXMProjPath = path.join(IDEXMProjPath, config.xmInfo.projName);
+	// 如果有即存项目,不再新建
+	let isProjExist = fs.existsSync(ideLastXMProjPath + "/node_modules") && 
+					  fs.existsSync(ideLastXMProjPath + "/sign");
+	if (isProjExist && !isUpdateIDEXMProj) { // 项目存在并且不需要更新IDE中的小米项目
+		return;
+	}
+	return new Promise((resolve, reject) => {
+		console.log("(IDE)开始创建小米快游戏项目,请耐心等待(预计需要10分钟)...");
+		let cmd = `npx${commandSuffix}`;
+		let args = ["create-quickgame", config.xmInfo.projName, `path=${IDEXMProjPath}`,
+					`package=${config.xmInfo.package}`, `versionName=${config.xmInfo.versionName}`,
+					`versionCode=${config.xmInfo.versionCode}`, `minPlatformVersion=${config.xmInfo.minPlatformVersion}`,
+                    `icon=/layaicon/${path.basename(config.xmInfo.icon)}`, `name=${config.xmInfo.name}`, `rebuild=true`];
+        console.log(JSON.stringify(args));
+        
+        let cp = childProcess.spawn(cmd, args);
+        
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+		
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+		
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+gulp.task("createProj_XM", ["createIDEProj_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	releaseDir = path.dirname(releaseDir);
+	projDir = path.join(releaseDir, config.xmInfo.projName);
+	// 如果有即存项目,不再新建
+	let isProjExist = fs.existsSync(projDir + "/node_modules") && 
+					  fs.existsSync(projDir + "/sign");
+	if (isProjExist) {
+		return;
+	}
+	// 如果IDE中有即存项目,不再新建,从IDE中拷贝
+	let ideLastXMProjPath = path.join(IDEXMProjPath, config.xmInfo.projName);
+	let isIDEXMProjExist = fs.existsSync(ideLastXMProjPath + "/node_modules") && 
+						fs.existsSync(ideLastXMProjPath + "/sign");
+	if (isIDEXMProjExist) { // 如果用的IDE并且有IDEXM目录
+		console.log("使用IDE中的小米游戏项目,拷贝...");
+		// node-glob语法中,* 无法匹配 .开头的文件(夹),必须手动匹配
+		let IDEXMProjPathStr = [`${IDEXMProjPath}/**/*.*`, `${ideLastXMProjPath}/node_modules/.bin/*.*`];
+		var stream = gulp.src(IDEXMProjPathStr, { base: IDEXMProjPath});
+		return stream.pipe(gulp.dest(releaseDir));
+	}
+	// 在项目中创建小米项目
+	return new Promise((resolve, reject) => {
+		console.log("(proj)开始创建小米快游戏项目,请耐心等待(预计需要10分钟)...");
+		let cmd = `npx${commandSuffix}`;
+		let args = ["create-quickgame", config.xmInfo.projName, `path=${releaseDir}`,
+					`package=${config.xmInfo.package}`, `versionName=${config.xmInfo.versionName}`,
+					`versionCode=${config.xmInfo.versionCode}`, `minPlatformVersion=${config.xmInfo.minPlatformVersion}`,
+                    `icon=/layaicon/${path.basename(config.xmInfo.icon)}`, `name=${config.xmInfo.name}`, `rebuild=true`];
+        console.log(JSON.stringify(args));
+        
+        let cp = childProcess.spawn(cmd, args);
+        
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+		
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+		
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+// 拷贝文件到小米快游戏
+gulp.task("copyFileToProj_XM", ["createProj_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	// 将临时文件夹中的文件,拷贝到项目中去
+	let originalDir = `${tempReleaseDir}/**/*.*`;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(path.join(projDir)));
+});
+
+// 拷贝icon到小米快游戏
+gulp.task("copyIconToProj_XM", ["copyFileToProj_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	let originalDir = config.xmInfo.icon;
+	let stream = gulp.src(originalDir);
+	return stream.pipe(gulp.dest(path.join(projDir, "layaicon")));
+});
+
+// 清除小米快游戏临时目录
+gulp.task("clearTempDir_XM", ["copyIconToProj_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	// 删掉临时目录
+	return del([tempReleaseDir], { force: true });
+});
+
+// 生成release签名(私钥文件 private.pem 和证书文件 certificate.pem )
+gulp.task("generateSign_XM", ["clearTempDir_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+    }
+    if (!config.xmSign.generateSign) {
+        return;
+    }
+	// https://doc.quickapp.cn/tools/compiling-tools.html
+	return new Promise((resolve, reject) => {
+		let cmd = "openssl";
+		let args = ["req", "-newkey", "rsa:2048", "-nodes", "-keyout", "private.pem", 
+					"-x509", "-days", "3650", "-out", "certificate.pem"];
+		let opts = {
+			cwd: projDir,
+			shell: true
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			data += "";
+			if (data.includes("Country Name")) {
+				cp.stdin.write(`${config.xmSign.countryName}\n`);
+				console.log(`Country Name: ${config.xmSign.countryName}`);
+			} else if (data.includes("Province Name")) {
+				cp.stdin.write(`${config.xmSign.provinceName}\n`);
+				console.log(`Province Name: ${config.xmSign.provinceName}`);
+			} else if (data.includes("Locality Name")) {
+				cp.stdin.write(`${config.xmSign.localityName}\n`);
+				console.log(`Locality Name: ${config.xmSign.localityName}`);
+			} else if (data.includes("Organization Name")) {
+				cp.stdin.write(`${config.xmSign.orgName}\n`);
+				console.log(`Organization Name: ${config.xmSign.orgName}`);
+			} else if (data.includes("Organizational Unit Name")) {
+				cp.stdin.write(`${config.xmSign.orgUnitName}\n`);
+				console.log(`Organizational Unit Name: ${config.xmSign.orgUnitName}`);
+			} else if (data.includes("Common Name")) {
+				cp.stdin.write(`${config.xmSign.commonName}\n`);
+				console.log(`Common Name: ${config.xmSign.commonName}`);
+			} else if (data.includes("Email Address")) {
+				cp.stdin.write(`${config.xmSign.emailAddr}\n`);
+				console.log(`Email Address: ${config.xmSign.emailAddr}`);
+				// cp.stdin.end();
+			}
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+// 拷贝sign文件到指定位置
+gulp.task("copySignFile_XM", ["generateSign_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+    }
+    if (config.xmSign.generateSign) { // 新生成的签名
+        // 移动签名文件到项目中(Laya & 小米快游戏项目中)
+        let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`,
+            layaDest = `${workSpaceDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest))
+                    .pipe(gulp.dest(layaDest));
+    } else if (config.xmInfo.useReleaseSign && !config.xmSign.generateSign) { // 使用release签名,并且没有重新生成
+        // 从项目中将签名拷贝到小米快游戏项目中
+        let 
+            privatePem = path.join(workSpaceDir, "sign", "release", "private.pem"),
+            certificatePem = path.join(workSpaceDir, "sign", "release", "certificate.pem");
+        let isSignExits = fs.existsSync(privatePem) && fs.existsSync(certificatePem);
+        if (!isSignExits) {
+            return;
+        }
+        let 
+            xiaomiDest = `${projDir}/sign/release`;
+        let stream = gulp.src([privatePem, certificatePem]);
+        return stream.pipe(gulp.dest(xiaomiDest));
+    }
+});
+
+gulp.task("deleteSignFile_XM", ["copySignFile_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	if (config.xmSign.generateSign) { // 新生成的签名
+		let 
+            privatePem = path.join(projDir, "private.pem"),
+            certificatePem = path.join(projDir, "certificate.pem");
+		return del([privatePem, certificatePem], { force: true });
+	}
+});
+
+gulp.task("modifyFile_XM", ["deleteSignFile_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	// 修改manifest.json文件
+	let manifestPath = path.join(projDir, "manifest.json");
+	if (!fs.existsSync(manifestPath)) {
+		return;
+	}
+	let manifestContent = fs.readFileSync(manifestPath, "utf8");
+	let manifestJson = JSON.parse(manifestContent);
+	manifestJson.package = config.xmInfo.package;
+	manifestJson.name = config.xmInfo.name;
+	manifestJson.orientation = config.xmInfo.orientation;
+	manifestJson.config.logLevel = config.xmInfo.logLevel || "off";
+	manifestJson.versionName = config.xmInfo.versionName;
+	manifestJson.versionCode = config.xmInfo.versionCode;
+	manifestJson.minPlatformVersion = config.xmInfo.minPlatformVersion;
+	manifestJson.icon = `/layaicon/${path.basename(config.xmInfo.icon)}`;
+	fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4), "utf8");
+
+	if (config.version) {
+		let versionPath = projDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	// 修改main.js文件
+	let content = 'require("./qg-adapter.js");\nrequire("./libs/laya.xmmini.js");\nrequire("./index.js");';
+	let mainJsPath = path.join(projDir, "main.js");
+	fs.writeFileSync(mainJsPath, content, "utf8");
+
+	// 小米项目,修改index.js
+	let filePath = path.join(projDir, indexJsStr);
+	if (!fs.existsSync(filePath)) {
+		return;
+	}
+	let fileContent = fs.readFileSync(filePath, "utf8");
+	fileContent = fileContent.replace(/loadLib(\(['"])/gm, "require$1./");
+	fs.writeFileSync(filePath, fileContent, "utf8");
+})
+
+gulp.task("version_XM", ["modifyFile_XM"], function () {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = projDir + "/version.json";
+		let mainJSPath = projDir + "/main.js";
+		let srcList = [versionPath, mainJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(projDir));
+	}
+});
+
+// 打包rpk
+gulp.task("buildRPK_XM", ["version_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	// 在小米轻游戏项目目录中执行:
+    // npm run build || npm run release
+    let cmdStr = "build";
+    if (config.xmInfo.useReleaseSign) {
+        cmdStr = "release";
+    }
+	return new Promise((resolve, reject) => {
+		let cmd = `npm${commandSuffix}`;
+		let args = ["run", cmdStr];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`stdout: ${data}`);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+gulp.task("showQRCode_XM", ["buildRPK_XM"], function() {
+	// 如果不是小米快游戏
+	if (platform !== "xmgame") {
+		return;
+	}
+	// 在小米轻游戏项目目录中执行:
+	// npm run server
+	return new Promise((resolve, reject) => {
+		let cmd = `npm${commandSuffix}`;
+		let args = ["run", "server"];
+		let opts = {
+			cwd: projDir
+		};
+		let cp = childProcess.spawn(cmd, args, opts);
+		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
+		cp.stdout.on('data', (data) => {
+			console.log(`${data}`);
+			// 输出pid,macos要用: macos无法kill进程树,也无法执行命令获取3000端口pid(没有查询权限),导致无法kill这个进程
+			console.log('xm_qrcode_pid:' + cp.pid);
+		});
+
+		cp.stderr.on('data', (data) => {
+			console.log(`stderr: ${data}`);
+			// reject();
+		});
+
+		cp.on('close', (code) => {
+			console.log(`子进程退出码:${code}`);
+			resolve();
+		});
+	});
+});
+
+
+gulp.task("buildXiaomiProj", ["showQRCode_XM"], function() {
+	console.log("all tasks completed");
+});

+ 26 - 11
RubikCube/.laya/compile.js

@@ -1,9 +1,14 @@
-// v1.1.0
+// v1.2.2
 //是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
-let useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+const useCMDNode = process.argv[1].indexOf("layaair2-cmd") > -1 ? true : false;
+
+function useOtherNode(){
+	return useIDENode||useCMDNode;
+}
 //获取Node插件和工作路径
-let ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
-let workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\compile.js", "").replace("/.laya/compile.js", "") : "./../";
+let ideModuleDir = useOtherNode() ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+let workSpaceDir = useOtherNode() ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\compile.js", "").replace("/.laya/compile.js", "") : "./../";
 
 const gulp = require(ideModuleDir + "gulp");
 const rollup = require(ideModuleDir + "rollup");
@@ -16,7 +21,6 @@ if (global.publish) {
 	prevTasks = ["loadConfig"];
 }
 
-//使用browserify,转换ts到js,并输出到bin/js目录
 gulp.task("compile", prevTasks, function () {
 	// 发布时调用编译功能,判断是否点击了编译选项
 	if (global.publish && !global.config.compile) {
@@ -28,16 +32,24 @@ gulp.task("compile", prevTasks, function () {
 
 	return rollup.rollup({
 		input: workSpaceDir + '/src/Main.ts',
-		treeshake: true,//建议忽略
+		onwarn:(waring,warn)=>{
+			if(waring.code == "CIRCULAR_DEPENDENCY"){
+				console.log("warnning Circular dependency:");
+				console.log(waring);
+			}
+		},
+		treeshake: false, //建议忽略
 		plugins: [
 			typescript({
-				check: false, //Set to false to avoid doing any diagnostic checks on the code
-				tsconfigOverride:{compilerOptions:{removeComments: true}}
+				tsconfig:workSpaceDir + "/tsconfig.json",
+				check: true, //Set to false to avoid doing any diagnostic checks on the code
+				tsconfigOverride:{compilerOptions:{removeComments: true}},
+				include:/.*.ts/,
 			}),
 			glsl({
 				// By default, everything gets included
 				include: /.*(.glsl|.vs|.fs)$/,
-				sourceMap: true,
+				sourceMap: false,
 				compress:false
 			}),
 			/*terser({
@@ -52,7 +64,10 @@ gulp.task("compile", prevTasks, function () {
 			file: workSpaceDir + '/bin/js/bundle.js',
 			format: 'iife',
 			name: 'laya',
-			sourcemap: true
+			sourcemap: false
 		});
-	});
+	}).catch(err=>{
+			console.log(err);
+		
+	})
 });

+ 79 - 19
RubikCube/.laya/publish.js

@@ -1,9 +1,14 @@
-// v1.5.0
+// v1.6.5
 //是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
 const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+const useCMDNode = process.argv[1].indexOf("layaair2-cmd") > -1 ? true : false;
+
+function useOtherNode(){
+	return useIDENode||useCMDNode;
+}
 //获取Node插件和工作路径
-let ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
-let workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish.js", "").replace("/.laya/publish.js", "") + "/" : "./../";
+let ideModuleDir = useOtherNode() ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+let workSpaceDir = useOtherNode() ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish.js", "").replace("/.laya/publish.js", "") + "/" : "./../";
 
 //引用插件模块
 const gulp = require(ideModuleDir + "gulp");
@@ -17,13 +22,14 @@ const revdel = require(ideModuleDir + "gulp-rev-delete-original");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 const del = require(ideModuleDir + "del");
 const requireDir = require(ideModuleDir + 'require-dir');
+const babel = require(ideModuleDir + 'gulp-babel');
 
 global.ideModuleDir = ideModuleDir;
 global.workSpaceDir = workSpaceDir;
 
 // 结合compile.js使用
 global.publish = true;
-const fileList = ["compile.js", "publish_xmgame.js", "publish_oppogame.js", "publish_vivogame.js", "publish_wxgame.js", "publish_bdgame.js", "publish_qqgame.js"];
+const fileList = ["compile.js", "publish_xmgame.js", "publish_oppogame.js", "publish_vivogame.js", "publish_alipaygame.js", "publish_wxgame.js", "publish_bdgame.js", "publish_qqgame.js"];
 requireDir('./', {
 	filter: function (fullPath) {
 		// 只用到了compile.js和publish.js
@@ -41,23 +47,51 @@ const QUICKGAMELIST = ["xmgame", "oppogame", "vivogame"];
 let config,
 	releaseDir,
 	binPath,
-	platform,
-	isOpendataProj = false;
+	platform = "web",
+	isOpendataProj = false,
+	platformCopyTask = [],// 平台脚本拷贝任务
+	platformTask = []; // 平台需要执行的任务
+//任务对照列表
+const copyTasks = {
+	"biligame": "copyPlatformFile_Bili",
+	"Alipaygame": "copyPlatformFile_Alipay",
+	"vivogame": "copyPlatformFile_VIVO",
+	"oppogame": "preCreate_OPPO",
+	"xmgame": "copyPlatformFile_XM",
+	"bdgame": "copyPlatformFile_BD",
+	"qqgame": "copyPlatformFile_QQ",
+	"wxgame": "copyPlatformFile_WX",
+	"web": "copyLibsJsFile"
+}
+const tasks = {
+	"biligame": "buildBiliProj",
+	"Alipaygame": "buildAlipayProj",
+	"vivogame": "buildVivoProj",
+	"oppogame": "buildOPPOProj",
+	"xmgame": "buildXiaomiProj",
+	"bdgame": "buildBDProj",
+	"qqgame": "buildQQProj",
+	"wxgame": "buildWXProj",
+	"web": "packfile"
+}
+
+if (!useOtherNode() && process.argv.length > 5 && process.argv[4] == "--config") {
+	platform = process.argv[5].replace(".json", "");
+}
+if (useOtherNode() && process.argv.length >= 4 && process.argv[3].startsWith("--config") && process.argv[3].endsWith(".json")) {
+	platform = process.argv[3].match(/(\w+).json/)[1];
+	platformCopyTask.push(copyTasks[platform]);
+	platformTask.push(tasks[platform]);
+}
+
 gulp.task("loadConfig", function () {
-	platform = "web"
-	if (!useIDENode && process.argv.length > 5 && process.argv[4] == "--config") {
-		platform = process.argv[5].replace(".json", "");
-	}
-	if (useIDENode && process.argv.length >= 4 && process.argv[3].startsWith("--config") && process.argv[3].endsWith(".json")) {
-		platform = process.argv[3].match(/(\w+).json/)[1];
-	}
 	let _path;
-	if (!useIDENode) {
+	if (!useOtherNode()) {
 		_path = platform + ".json";
 		releaseDir = "../release/" + platform;
 		binPath = "../bin/";
 	}
-	if (useIDENode) {
+	if (useOtherNode()) {
 		_path = path.join(workSpaceDir, ".laya", `${platform}.json`);
 		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
 		binPath = path.join(workSpaceDir, "bin").replace(/\\/g, "/");
@@ -88,7 +122,10 @@ gulp.task("loadConfig", function () {
 // 清理release文件夹
 gulp.task("clearReleaseDir", ["compile"], function (cb) {
 	if (config.clearReleaseDir) {
-		let delList = [releaseDir, releaseDir + "_pack", config.packfileTargetValue];
+		let delList = [`${releaseDir}/**`, releaseDir + "_pack"];
+		if (config.packfileTargetValue) {
+			delList.push(config.packfileTargetValue);
+		}
 		// 小米快游戏,使用即存的项目,删掉Laya工程文件,保留小米环境项目文件
 		if (platform === "xmgame") {
 			let xmProjSrc = path.join(releaseDir, config.xmInfo.projName);
@@ -106,6 +143,16 @@ gulp.task("clearReleaseDir", ["compile"], function (cb) {
 			delList = [`${vvProjSrc}/**`, `!${vvProjSrc}`, `!${vvProjSrc}/sign/**`, `!${vvProjSrc}/{game.js,manifest.json}`];
 			delList = delList.concat(`${vvProj}/engine/**`, `${vvProj}/config/**`);
 		}
+		// 保留平台配置文件
+		if (config.keepPlatformFile) {
+			if (platform === "wxgame" || platform === "qqgame") {
+				delList = delList.concat(`!${releaseDir}`, `!${releaseDir}/{game.js,game.json,project.config.json,weapp-adapter.js}`);
+			} else if (platform === "bdgame") {
+				delList = delList.concat(`!${releaseDir}`, `!${releaseDir}/{game.js,game.json,project.swan.json,swan-game-adapter.js}`);
+			} else if (platform === "Alipaygame") {
+				delList = delList.concat(`!${releaseDir}`, `!${releaseDir}/{game.js,game.json,my-adapter.js}`);
+			}
+		}
 		del(delList, { force: true }).then(paths => {
 			cb();
 		});
@@ -193,8 +240,20 @@ gulp.task("copyLibsJsFile", ["copyFile"], function () {
 	return stream.pipe(gulp.dest(releaseDir));
 });
 
+// es6toes5
+gulp.task("es6toes5", platformCopyTask, function() {
+	if (config.es6toes5) {
+		return gulp.src(`${releaseDir}/**/*.js`, { base: releaseDir })
+		.pipe(babel({
+			presets: ['@babel/env'],
+			compact: true
+		})) 
+		.pipe(gulp.dest(releaseDir));
+	}
+})
+
 // 压缩json
-gulp.task("compressJson", ["copyLibsJsFile"], function () {
+gulp.task("compressJson", ["es6toes5"], function () {
 	if (config.compressJson) {
 		return gulp.src(config.compressJsonFilter, { base: releaseDir })
 			.pipe(jsonminify())
@@ -268,7 +327,8 @@ gulp.task("version2", ["version1"], function () {
 		let indexJSPath;
 		let versionCon = fs.readFileSync(versionPath, "utf8");
 		versionCon = JSON.parse(versionCon);
-		indexJSPath = releaseDir + "/" + versionCon["index.js"];
+		let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+		indexJSPath = releaseDir + "/" + indexJsStr;
 		// 替换config.packfileFullValue中的路径
 		let packfileStr = JSON.stringify(config.packfileFullValue).replace(/\\\\/g, "/");
 		let tempPackfile = `${workSpaceDir}/.laya/configTemp.json`;
@@ -309,6 +369,6 @@ gulp.task("packfile", ["version2"], function() {
 });
 
 // 起始任务
-gulp.task("publish", ["buildXiaomiProj", "buildOPPOProj", "buildVivoProj", "buildWXProj", "buildBDProj", "buildQQProj"], function () {
+gulp.task("publish", platformTask , function () {
 	console.log("All tasks completed!");
 });

+ 136 - 0
RubikCube/.laya/publish_alipaygame.js

@@ -0,0 +1,136 @@
+// v1.4.0
+// publish 2.x 也是用这个文件,需要做兼容
+let isPublish2 = process.argv[2].includes("publish_alipaygame.js") && process.argv[3].includes("--evn=publish2");
+// 获取Node插件和工作路径
+let ideModuleDir, workSpaceDir;
+if (isPublish2) {
+	//是否使用IDE自带的node环境和插件,设置false后,则使用自己环境(使用命令行方式执行)
+	const useIDENode = process.argv[0].indexOf("LayaAir") > -1 ? true : false;
+	ideModuleDir = useIDENode ? process.argv[1].replace("gulp\\bin\\gulp.js", "").replace("gulp/bin/gulp.js", "") : "";
+	workSpaceDir = useIDENode ? process.argv[2].replace("--gulpfile=", "").replace("\\.laya\\publish_alipaygame.js", "").replace("/.laya/publish_alipaygame.js", "") + "/" : "./../";
+} else {
+	ideModuleDir = global.ideModuleDir;
+	workSpaceDir = global.workSpaceDir;
+}
+
+//引用插件模块
+const gulp = require(ideModuleDir + "gulp");
+const fs = require("fs");
+const path = require("path");
+const revCollector = require(ideModuleDir + 'gulp-rev-collector');
+let commandSuffix = ".cmd";
+
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
+if (isPublish2) {
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_Alipay"];
+}
+
+let 
+    config,
+	platform,
+    releaseDir;
+let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
+// 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
+gulp.task("preCreate_Alipay", copyLibsTask, function() {
+	if (isPublish2) {
+		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
+		let content = fs.readFileSync(pubsetPath, "utf8");
+		let pubsetJson = JSON.parse(content);
+		platform = "Alipaygame";
+		releaseDir = path.join(workSpaceDir, "release", platform).replace(/\\/g, "/");
+		config = pubsetJson[8];
+	} else {
+		platform = global.platform;
+		releaseDir = global.releaseDir;
+		config = global.config;
+	}
+	// 如果不是Alipay快游戏
+	if (platform !== "Alipaygame") {
+		return;
+	}
+	if (process.platform === "darwin") {
+		commandSuffix = "";
+	}
+	let copyLibsList = [`${workSpaceDir}/bin/libs/laya.Alipaymini.js`];
+	var stream = gulp.src(copyLibsList, { base: `${workSpaceDir}/bin` });
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("copyPlatformFile_Alipay", ["preCreate_Alipay"], function() {
+	// 如果不是Alipay快游戏
+	if (platform !== "Alipaygame") {
+		return;
+	}
+	let isHasPublish = 
+		fs.existsSync(path.join(releaseDir, "game.js")) &&
+		fs.existsSync(path.join(releaseDir, "game.json")) &&
+		fs.existsSync(path.join(releaseDir, "my-adapter.js"));
+	if (isHasPublish) {
+		return;
+	}
+	let AlipayAdapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "Alipayfiles");
+	let copyLibsList = [`${AlipayAdapterPath}/**/*.*`];
+	var stream = gulp.src(copyLibsList);
+	return stream.pipe(gulp.dest(releaseDir));
+});
+
+gulp.task("modifyFile_Alipay", packfiletask, function() {
+	// 如果不是Alipay快游戏
+	if (platform !== "Alipaygame") {
+		return;
+	}
+	// 修改game.json文件
+	let gameJsonPath = path.join(releaseDir, "game.json");
+	let content = fs.readFileSync(gameJsonPath, "utf8");
+	let conJson = JSON.parse(content);
+	conJson.screenOrientation = config.AlipayInfo.screenOrientation;
+	content = JSON.stringify(conJson, null, 4);
+	fs.writeFileSync(gameJsonPath, content, "utf8");
+
+	// 修改game.js
+	let filePath = path.join(releaseDir, "game.js");
+	// 这个地方,1.x IDE和2.x IDE 不一致
+	let fileContent = `require("./my-adapter.js");
+require("./libs/laya.Alipaymini.js");\nrequire("./index.js");`;
+	fs.writeFileSync(filePath, fileContent, "utf8");
+
+	if (config.version || config.enableVersion) {
+		let versionPath = releaseDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	// 修改index.js
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	let indexFilePath = path.join(releaseDir, indexJsStr);
+	if (!fs.existsSync(indexFilePath)) {
+		return;
+	}
+	let indexFileContent = fs.readFileSync(indexFilePath, "utf8");
+	indexFileContent = indexFileContent.replace(/loadLib(\(['"])/gm, "require$1./");
+	fs.writeFileSync(indexFilePath, indexFileContent, "utf8");
+})
+
+gulp.task("version_Alipay", ["modifyFile_Alipay"], function () {
+	// 如果不是Alipay快游戏
+	if (platform !== "Alipaygame") {
+		return;
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		let gameJSPath = releaseDir + "/game.js";
+		let srcList = [versionPath, gameJSPath];
+		return gulp.src(srcList)
+			.pipe(revCollector())
+			.pipe(gulp.dest(releaseDir));
+	}
+});
+
+gulp.task("buildAlipayProj", ["version_Alipay"], function() {
+	console.log("all tasks completed");
+});

+ 21 - 10
RubikCube/.laya/publish_bdgame.js

@@ -1,4 +1,4 @@
-// v1.2.0
+// v1.4.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_bdgame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -17,24 +17,27 @@ if (isPublish2) {
 const gulp = require(ideModuleDir + "gulp");
 const fs = require("fs");
 const path = require("path");
-const crypto = require("crypto");
-const childProcess = require("child_process");
-const del = require(ideModuleDir + "del");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
-let prevTasks = ["packfile"];
+
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_BD"];
 }
 
 let 
     config,
 	platform,
     releaseDir;
-let isGlobalCli = true;
 let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_BD", prevTasks, function() {
+gulp.task("preCreate_BD", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -64,7 +67,7 @@ gulp.task("copyPlatformFile_BD", ["preCreate_BD"], function() {
 	if (platform !== "bdgame") {
 		return;
 	}
-	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "bdfiles");
+	let adapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "bdfiles");
 	// 如果新建项目时已经点击了"微信/百度小游戏bin目录快速调试",不再拷贝
 	let isHadBdFiles =
 		fs.existsSync(path.join(workSpaceDir, "bin", "game.js")) &&
@@ -74,11 +77,19 @@ gulp.task("copyPlatformFile_BD", ["preCreate_BD"], function() {
 	if (isHadBdFiles) {
 		return;
 	}
+	let isHasPublish = 
+		fs.existsSync(path.join(releaseDir, "game.js")) &&
+		fs.existsSync(path.join(releaseDir, "game.json")) &&
+		fs.existsSync(path.join(releaseDir, "project.swan.json")) &&
+		fs.existsSync(path.join(releaseDir, "swan-game-adapter.js"));
+	if (isHasPublish) {
+		return;
+	}
 	let stream = gulp.src(adapterPath + "/*.*");
 	return stream.pipe(gulp.dest(releaseDir));
 });
 
-gulp.task("modifyFile_BD", ["copyPlatformFile_BD"], function() {
+gulp.task("modifyFile_BD", packfiletask, function() {
 	// 如果不是百度小游戏
 	if (platform !== "bdgame") {
 		return;

+ 27 - 16
RubikCube/.laya/publish_oppogame.js

@@ -1,4 +1,4 @@
-// v1.2.0
+// v1.4.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_oppogame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -22,9 +22,11 @@ const del = require(ideModuleDir + "del");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
 
-let prevTasks = ["packfile"];
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["preCreate_OPPO"];
 }
 
 let 
@@ -35,9 +37,13 @@ let
     tempReleaseDir, // OPPO临时拷贝目录
 	projDir; // OPPO快游戏工程目录
 let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
 // 创建OPPO项目前,拷贝OPPO引擎库、修改index.js
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_OPPO", prevTasks, function() {
+gulp.task("preCreate_OPPO", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -52,7 +58,7 @@ gulp.task("preCreate_OPPO", prevTasks, function() {
 		tempReleaseDir = global.tempReleaseDir;
 		config = global.config;
 	}
-    toolkitPath = path.join(ideModuleDir, "../", "out", "layarepublic", "oppo", "quickgame-toolkit");
+    toolkitPath = path.join(layarepublicPath, "oppo", "quickgame-toolkit");
 	// 如果不是OPPO快游戏
 	if (platform !== "oppogame") {
 		return;
@@ -66,7 +72,7 @@ gulp.task("preCreate_OPPO", prevTasks, function() {
 });
 
 // 新建OPPO项目-OPPO项目与其他项目不同,需要安装OPPO quickgame node_modules,并打包成.rpk文件
-gulp.task("installModules_OPPO", ["preCreate_OPPO"], function() {
+gulp.task("installModules_OPPO", packfiletask, function() {
 	// 如果不是OPPO快游戏
 	if (platform !== "oppogame") {
 		return;
@@ -82,10 +88,11 @@ gulp.task("installModules_OPPO", ["preCreate_OPPO"], function() {
 		console.log("开始安装OPPO quickgame node_modules,请耐心等待...");
 		let cmd = `npm${commandSuffix}`;
 		let args = ["install"];
-        
-        let cp = childProcess.spawn(cmd, args, {
-            cwd: toolkitPath
-        });
+        let opts = {
+			cwd: toolkitPath,
+			shell: true
+		};
+        let cp = childProcess.spawn(cmd, args, opts);
         
 		cp.stdout.on('data', (data) => {
 			console.log(`stdout: ${data}`);
@@ -332,7 +339,8 @@ gulp.task("buildRPK_OPPO", ["version_OPPO"], function() {
 		let cmd = path.join(toolkitPath, "lib", "bin", `quickgame${commandSuffix}`);
 		let args = [packStr, cmdStr, nobuildjs];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn('npx.cmd', ['-v']);
@@ -362,14 +370,15 @@ gulp.task("pushRPK_OPPO", ["buildRPK_OPPO"], function() {
     }
 	// 在OPPO轻游戏项目目录中执行:
     // adb push dist/game.rpk sdcard/games
-	// adb push idePath/resources/app/out/layarepublic/oppo/instant_app_settings.properties
+	// adb push layarepublicPath/oppo/instant_app_settings.properties
 	// adb shell am start -n com.nearme.instant.platform/com.oppo.autotest.main.InstantAppActivity
 	return new Promise((resolve, reject) => {
 		let cmd = "adb";
 		let sdGamesPath = config.oppoInfo.subpack ? "sdcard/subPkg" : "sdcard/games";
 		let args = ["push", `dist/${config.oppoInfo.package}${config.oppoInfo.useReleaseSign ? ".signed" : ""}.rpk`, sdGamesPath];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn('npx.cmd', ['-v']);
@@ -389,7 +398,7 @@ gulp.task("pushRPK_OPPO", ["buildRPK_OPPO"], function() {
 	}).then(() => {
 		return new Promise((resolve, reject) => {
 			// 如果是分包,需要修改里面的内容
-			let oppoPropPath = path.join(ideModuleDir, "../", `/out/layarepublic/oppo/instant_app_settings.properties`);
+			let oppoPropPath = path.join(layarepublicPath, "oppo", "instant_app_settings.properties");
 			if (config.oppoInfo.subpack) {
 				fs.writeFileSync(oppoPropPath, "default_tab_index=4", "utf8");
 			} else {
@@ -398,7 +407,8 @@ gulp.task("pushRPK_OPPO", ["buildRPK_OPPO"], function() {
 			let cmd = "adb";
 			let args = ["push", oppoPropPath, "sdcard/"];
 			let opts = {
-				cwd: projDir
+				cwd: projDir,
+				shell: true
 			};
 			let cp = childProcess.spawn(cmd, args, opts);
 			// let cp = childProcess.spawn('npx.cmd', ['-v']);
@@ -421,7 +431,8 @@ gulp.task("pushRPK_OPPO", ["buildRPK_OPPO"], function() {
 			let cmd = "adb";
 			let args = ["shell", "am", "start", "-n", "com.nearme.instant.platform/com.oppo.autotest.main.InstantAppActivity"];
 			let opts = {
-				cwd: projDir
+				cwd: projDir,
+				shell: true
 			};
 			let cp = childProcess.spawn(cmd, args, opts);
 			// let cp = childProcess.spawn('npx.cmd', ['-v']);

+ 264 - 9
RubikCube/.laya/publish_qqgame.js

@@ -1,4 +1,4 @@
-// v1.0.0
+// v1.4.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_qqgame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -18,23 +18,30 @@ const gulp = require(ideModuleDir + "gulp");
 const fs = require("fs");
 const path = require("path");
 const crypto = require("crypto");
-const childProcess = require("child_process");
 const del = require(ideModuleDir + "del");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
-let prevTasks = ["packfile"];
+const provider = "1109625052";
+const fullRemoteEngineList = ["laya.core.js", "laya.webgl.js", "laya.filter.js", "laya.ani.js", "laya.d3.js", "laya.html.js", "laya.particle.js", "laya.ui.js", "bytebuffer.js"];
+
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_QQ"];
 }
 
 let 
     config,
 	platform,
     releaseDir;
-let isGlobalCli = true;
 let versionCon; // 版本管理version.json
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_QQ", prevTasks, function() {
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
+gulp.task("preCreate_QQ", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -64,12 +71,20 @@ gulp.task("copyPlatformFile_QQ", ["preCreate_QQ"], function() {
 	if (platform !== "qqgame") {
 		return;
 	}
-	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "qqfiles");
+	let isHasPublish = 
+		fs.existsSync(path.join(releaseDir, "game.js")) &&
+		fs.existsSync(path.join(releaseDir, "game.json")) &&
+		fs.existsSync(path.join(releaseDir, "project.config.json")) &&
+		fs.existsSync(path.join(releaseDir, "weapp-adapter.js"));
+	if (isHasPublish) {
+		return;
+	}
+	let adapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "qqfiles");
 	let stream = gulp.src(adapterPath + "/*.*");
 	return stream.pipe(gulp.dest(releaseDir));
 });
 
-gulp.task("version_QQ", ["copyPlatformFile_QQ"], function() {
+gulp.task("version_QQ", packfiletask, function() {
 	// 如果不是QQ小游戏
 	if (platform !== "qqgame") {
 		return;
@@ -84,6 +99,246 @@ gulp.task("version_QQ", ["copyPlatformFile_QQ"], function() {
 	}
 });
 
-gulp.task("buildQQProj", ["version_QQ"], function() {
+gulp.task("pluginEngin_QQ", ["version_QQ"], function(cb) {
+	// 如果不是微信小游戏
+	if (platform !== "qqgame") {
+		return cb();
+	}
+	if (!config.uesEnginePlugin) { // 没有使用微信引擎插件,还是像以前一样发布
+		return cb();
+	}
+	if (config.version) {
+		let versionPath = releaseDir + "/version.json";
+		versionCon = fs.readFileSync(versionPath, "utf8");
+		versionCon = JSON.parse(versionCon);
+	}
+	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
+	
+	// 获取version等信息
+	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
+	let isHasCoreLib = fs.existsSync(coreLibPath);
+	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let isNewTsProj = fs.existsSync(`${workSpaceDir}/src/tsconfig.json`) && !isHasCoreLib;
+	let EngineVersion = getEngineVersion();
+	if (!EngineVersion) {
+		throw new Error(`读取引擎版本号失败,请于服务提供商联系!`);
+	}
+	if (!EngineVersion || EngineVersion.includes("beta") || !canUsePluginEngine(EngineVersion)) {
+		throw new Error(`该版本引擎无法使用引擎插件功能(engineVersion: ${EngineVersion})`);
+	}
+	console.log(`通过版本号检查:  ${EngineVersion}`);
+	// 使用引擎插件
+	let localUseEngineList = [];
+	let copyEnginePathList;
+	new Promise(function(resolve, reject) {
+		console.log(`修改game.js和game.json`);
+		// 1) 修改game.js和game.json
+		// 修改game.js
+		let gameJsPath = path.join(releaseDir, "game.js");
+		let gameJscontent = `require("weapp-adapter.js");\nrequire("./libs/laya.qqmini.js");\nrequirePlugin('layaPlugin');\nwindow.loadLib = require;\nrequire("./${indexJsStr}");`;
+		fs.writeFileSync(gameJsPath, gameJscontent, "utf8");
+		// 修改game.json,使其支持引擎插件
+		let gameJsonPath = path.join(releaseDir, "game.json");
+		let gameJsonContent = fs.readFileSync(gameJsonPath, "utf8");
+		let conJson = JSON.parse(gameJsonContent);
+		conJson.plugins = {
+			"layaPlugin": {
+				"version": EngineVersion,
+				"provider": provider,
+				"path": "laya-libs"
+			}
+		}
+		gameJsonContent = JSON.stringify(conJson, null, 4);
+		fs.writeFileSync(gameJsonPath, gameJsonContent, "utf8");
+		// 修改project.config.json
+		let projConfigPath = path.join(releaseDir, "project.config.json");
+		let projConfigcontent = fs.readFileSync(projConfigPath, "utf8");
+		let projConfigConJson = JSON.parse(projConfigcontent);
+		projConfigConJson.compileType = "gamePlugin";
+		projConfigConJson.pluginRoot = "laya-libs";
+		projConfigcontent = JSON.stringify(projConfigConJson, null, 4);
+		fs.writeFileSync(projConfigPath, projConfigcontent, "utf8");
+		resolve();
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`确定用到的插件引擎`);
+			// 2) 确定用到了那些插件引擎,并将插件引擎从index.js的引用中去掉
+			let indexJsPath = path.join(releaseDir, indexJsStr);
+			let indexJsCon = fs.readFileSync(indexJsPath, "utf8");
+			let item, fullRequireItem;
+			for (let i = 0, len = fullRemoteEngineList.length; i < len; i++) {
+				item = fullRemoteEngineList[i];
+				fullRequireItem = `loadLib("libs/${item}")`;
+				if (indexJsCon.includes(fullRequireItem)) {
+					localUseEngineList.push(item);
+					indexJsCon = indexJsCon.replace(fullRequireItem, "");
+				}
+			}
+			if (isOldAsProj || isNewTsProj) { // 如果as||ts_new语言,开发者将laya.js也写入index.js中了,将其删掉
+				fullRequireItem = `loadLib("laya.js")`;
+				if (indexJsCon.includes(fullRequireItem)) {
+					indexJsCon = indexJsCon.replace(fullRequireItem, "");
+				}
+			}
+			fs.writeFileSync(indexJsPath, indexJsCon, "utf8");
+			// ts/js再次修改game.js,仅引用使用到的类库
+			// as||ts_new因为本地只有laya.js,无法仅引用使用到的类库
+			if (!isOldAsProj && !isNewTsProj) {
+				let pluginCon = "";
+				localUseEngineList.forEach(function(item) {
+					pluginCon += `requirePlugin("layaPlugin/${item}");\n`;
+				});
+				let gameJsPath = path.join(releaseDir, "game.js");
+				let gameJsCon = fs.readFileSync(gameJsPath, "utf8");
+				gameJsCon = gameJsCon.replace(`requirePlugin('layaPlugin');`, pluginCon);
+				fs.writeFileSync(gameJsPath, gameJsCon, "utf8");
+			}
+			resolve();
+		});
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`将本地的引擎插件移动到laya-libs中`);
+			// 3) 将本地的引擎插件移动到laya-libs中
+			copyEnginePathList = [`${releaseDir}/libs/{${localUseEngineList.join(",")}}`];
+			if (isOldAsProj || isNewTsProj) { // 单独拷贝laya.js
+				copyEnginePathList = [`${releaseDir}/laya.js`];
+			}
+			gulp.src(copyEnginePathList).pipe(gulp.dest(`${releaseDir}/laya-libs`));
+			setTimeout(resolve, 500);
+		});
+	}).then(function() {
+		return new Promise(function(resolve, reject) {
+			console.log(`将libs中的本地引擎插件删掉`);
+			// 4) 将libs中的本地引擎插件删掉
+			del(copyEnginePathList, { force: true }).then(resolve);
+		});
+	}).then(function() {
+		return new Promise(async function(resolve, reject) {
+			console.log(`完善引擎插件目录`);
+			// 5) 引擎插件目录laya-libs中还需要新建几个文件,使该目录能够使用
+			if (isOldAsProj || isNewTsProj) { // 单独拷贝laya.js
+				localUseEngineList.push("laya.js");
+			}
+			let 
+				layalibsPath = path.join(releaseDir, "laya-libs"),
+				engineIndex = path.join(layalibsPath, "index.js"),
+				engineplugin = path.join(layalibsPath, "plugin.json"),
+				enginesignature = path.join(layalibsPath, "signature.json");
+			// index.js
+			if (!fs.existsSync(layalibsPath)) {
+				throw new Error("引擎插件目录创建失败,请与服务提供商联系!");
+			}
+			let indexCon = "";
+			localUseEngineList.forEach(function(item) {
+				indexCon += `require("./${item}");\n`;
+			});
+			fs.writeFileSync(engineIndex, indexCon, "utf8");
+			// plugin.json
+			let pluginCon = {"main": "index.js"};
+			fs.writeFileSync(engineplugin, JSON.stringify(pluginCon, null, 4), "utf8");
+			// signature.json
+			let signatureCon = {
+				"provider": provider,
+				"signature": []
+			};
+			localUseEngineList.unshift("index.js");
+			let fileName, md5Str;
+			for (let i = 0, len = localUseEngineList.length; i < len; i++) {
+				fileName = localUseEngineList[i];
+				let md5Str = await getFileMd5(path.join(releaseDir, "laya-libs", fileName));
+				signatureCon.signature.push({
+					"path": fileName,
+					"md5": md5Str
+				});
+			}
+			fs.writeFileSync(enginesignature, JSON.stringify(signatureCon, null, 4), "utf8");
+			resolve();
+		});
+	})
+	.then(function() {
+		cb();
+	}).catch(function(e) {
+		throw e;
+	})
+});
+
+function getEngineVersion() {
+	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
+	let isHasCoreLib = fs.existsSync(coreLibPath);
+	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let isNewTsProj = fs.existsSync(`${workSpaceDir}/src/tsconfig.json`) && !isHasCoreLib;
+	let EngineVersion;
+	if (isHasCoreLib) {
+		let con = fs.readFileSync(coreLibPath, "utf8");
+		let matchList = con.match(/Laya\.version\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+		if (!Array.isArray(matchList)) {
+			return null;
+		}
+		EngineVersion = matchList[1];
+	} else { // newts项目和旧版本as项目
+		if (isOldAsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "laya", "src", "Laya.as");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/version:String\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		} else if (isNewTsProj) {
+			let coreLibFilePath = path.join(workSpaceDir, "libs", "Laya.ts");
+			if (!fs.existsSync(coreLibFilePath)) {
+				return null;
+			}
+			let con = fs.readFileSync(coreLibFilePath, "utf8");
+			let matchList = con.match(/static\s*version:\s*string\s*=\s*['"]([0-9\.]+(beta)?.*)['"]/);
+			if (!Array.isArray(matchList)) {
+				return null;
+			}
+			EngineVersion = matchList[1];
+		}
+	}
+	// 特殊处理,因为历史原因,我们有一些4位的正式版本,调整为3位
+	if (EngineVersion && /[\d\.]+/.test(EngineVersion) && EngineVersion.split(".").length > 3) {
+		let verList = EngineVersion.split(".");
+		verList.length = 3;
+		EngineVersion = verList.join(".");
+	}
+	return EngineVersion;
+}
+
+function getFileMd5(filePath) {
+	return new Promise(function(resolve, reject) {
+		let md5 = crypto.createHash('md5');
+		let stream = fs.createReadStream(filePath);
+		stream.on("data", function(data) {
+			md5.update(data);
+		});
+		stream.on("end", function() {
+			let md5Str = md5.digest('hex');
+			return resolve(md5Str);
+		});
+	});
+}
+
+function canUsePluginEngine(version) {
+	const minVersionNum = "2.1.1";
+	let compileMacthList = minVersionNum.match(/^(\d+)\.(\d+)\.(\d+)/);
+	let matchList = version.match(/^(\d+)\.(\d+)\.(\d+)/);
+    if (matchList[1] > compileMacthList[1]) {
+        return true;
+	}
+    if (matchList[1] === compileMacthList[1] && matchList[2] > compileMacthList[2]) {
+        return true;
+    }
+    if (matchList[1] === compileMacthList[1] && matchList[2] === compileMacthList[2] && matchList[3] >= compileMacthList[3]) {
+        return true;
+    }
+    return false;
+}
+
+gulp.task("buildQQProj", ["pluginEngin_QQ"], function() {
 	console.log("all tasks completed");
 });

+ 128 - 75
RubikCube/.laya/publish_vivogame.js

@@ -1,4 +1,4 @@
-// v1.2.1
+// v1.5.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_vivogame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -23,9 +23,11 @@ const iconv =  require(ideModuleDir + "iconv-lite");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
 
-let prevTasks = ["packfile"];
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_VIVO"];
 }
 
 let 
@@ -39,9 +41,13 @@ let
 	isExistEngineFolder = false; // bin目录下是否存在engine文件夹
 let projSrc;
 let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
 // 创建vivo项目前,拷贝vivo引擎库、修改index.js
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_VIVO", prevTasks, function() {
+gulp.task("preCreate_VIVO", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -69,18 +75,19 @@ gulp.task("preCreate_VIVO", prevTasks, function() {
 });
 
 gulp.task("copyPlatformFile_VIVO", ["preCreate_VIVO"], function() {
+	return;
 	// 如果不是vivo快游戏
-	if (platform !== "vivogame") {
-		return;
-	}
-	let vivoAdapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "vivofiles");
-	let copyLibsList = [`${vivoAdapterPath}/**/*.*`];
-	var stream = gulp.src(copyLibsList);
-	return stream.pipe(gulp.dest(tempReleaseDir));
+	// if (platform !== "vivogame") {
+	// 	return;
+	// }
+	// let vivoAdapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "vivofiles");
+	// let copyLibsList = [`${vivoAdapterPath}/**/*.*`];
+	// var stream = gulp.src(copyLibsList);
+	// return stream.pipe(gulp.dest(tempReleaseDir));
 });
 
 // 检查是否全局安装了qgame
-gulp.task("createGlobalQGame_VIVO", ["copyPlatformFile_VIVO"], function() {
+gulp.task("createGlobalQGame_VIVO", packfiletask, function() {
 	// 如果不是vivo快游戏
 	if (platform !== "vivogame") {
 		return;
@@ -108,7 +115,7 @@ gulp.task("createGlobalQGame_VIVO", ["copyPlatformFile_VIVO"], function() {
 				resolve();
 			}
 		});
-		childProcess.exec("mg -v", { cwd: `${projDir}/node_modules` }, function(error, stdout, stderr) {
+		childProcess.exec("mg -v", function(error, stdout, stderr) {
 			if (!stdout) { // 获取  @vivo-minigame/cli 本地版本号失败
 				console.log("Failed to get the local version number");
 				resolve();
@@ -123,8 +130,10 @@ gulp.task("createGlobalQGame_VIVO", ["copyPlatformFile_VIVO"], function() {
 			}
 		});
 		setTimeout(() => {
-			if (!isGetLocal || !isGetRemote) {
-				console.log("Failed to get the local or remote version number");
+			// 如果获取到了本地版本号,但未获取到远程版本号,默认通过
+			if (isGetLocal && !isGetRemote) {
+				isUpdateGlobalQGame = false;
+				console.log("Gets the version number timeout, does not get the remote version number, but the local version number exists, passes by default");
 				resolve();
 				return;
 			}
@@ -139,7 +148,10 @@ gulp.task("createGlobalQGame_VIVO", ["copyPlatformFile_VIVO"], function() {
 			// npm install -g @vivo-minigame/cli
 			let cmd = `npm${commandSuffix}`;
 			let args = ["install", "@vivo-minigame/cli", "-g"];
-			let cp = childProcess.spawn(cmd, args);
+			let opts = {
+				shell: true
+			};
+			let cp = childProcess.spawn(cmd, args, opts);
 			
 			cp.stdout.on('data', (data) => {
 				console.log(`stdout: ${data}`);
@@ -217,8 +229,93 @@ gulp.task("createProj_VIVO", ["createGlobalQGame_VIVO"], function() {
 	});
 });
 
+// 检查是否安装了adapter
+gulp.task("createAdapter_VIVO", ["createProj_VIVO"], function() {
+	// 如果不是vivo快游戏
+	if (platform !== "vivogame") {
+		return;
+	}
+	// npm view @qgame/adapter version
+	// npm i -S @qgame/adapter@latest
+	let remoteVersion, localVersion;
+	let isGetRemote, isGetLocal;
+	let isUpdateAdapter = true;
+	return new Promise((resolve, reject) => { // 远程版本号
+		childProcess.exec("npm view @qgame/adapter version", function(error, stdout, stderr) {
+			if (!stdout) { // 获取 @vivo-minigame/cli 远程版本号失败
+				console.log("Failed to get the remote adapter version number");
+				resolve();
+				return;
+			}
+			remoteVersion = stdout.replace(/[\r\n]/g, "").trim();
+			isGetRemote = true;
+			if (isGetRemote && isGetLocal) {
+				isUpdateAdapter = remoteVersion != localVersion;
+				console.log(`remoteVersion: ${remoteVersion}, localVersion: ${localVersion}`);
+				resolve();
+			}
+		});
+		childProcess.exec("npm ls @qgame/adapter version", { cwd: projDir }, function(error, stdout, stderr) {
+			if (!stdout) { // 获取  @vivo-minigame/cli 本地版本号失败
+				console.log("Failed to get the local adapter version number");
+				resolve();
+				return;
+			}
+			let info = stdout.split("@qgame/adapter@"); //@qgame/adapter@1.0.3
+			info = Array.isArray(info) && info[1] && info[1].replace(/[\r\n]/g, "").trim();
+			localVersion = info;
+			isGetLocal = true;
+			if (isGetRemote && isGetLocal) {
+				isUpdateAdapter = remoteVersion != localVersion;
+				console.log(`remoteVersion: ${remoteVersion}, localVersion: ${localVersion}`);
+				resolve();
+			}
+		});
+		setTimeout(() => {
+			// 如果获取到了本地版本号,但未获取到远程版本号,默认通过
+			if (!isGetLocal || !isGetRemote) {
+				console.log("Failed to get the local or remote version number");
+				resolve();
+				return;
+			}
+		}, 10000);
+	}).then(() => {
+		return new Promise((resolve, reject) => {
+			if (!isUpdateAdapter) {
+				resolve();
+				return;
+			}
+			console.log("安装@qgame/adapter");
+			// npm i -S @qgame/adapter@latest
+			let cmd = `npm${commandSuffix}`;
+			let args = ["install", "-S", "@qgame/adapter@latest"];
+			let opts = {
+				shell: true,
+				cwd: projDir
+			};
+			let cp = childProcess.spawn(cmd, args, opts);
+			
+			cp.stdout.on('data', (data) => {
+				console.log(`stdout: ${data}`);
+			});
+	
+			cp.stderr.on('data', (data) => {
+				console.log(`stderr: ${data}`);
+				// reject();
+			});
+	
+			cp.on('close', (code) => {
+				console.log(`2 end) npm i -S @qgame/adapter@latest:${code}`);
+				resolve();
+			});
+		});
+	}).catch((e) => {
+		console.log("catch e", e);
+	});
+});
+
 // 拷贝文件到vivo快游戏
-gulp.task("copyFileToProj_VIVO", ["createProj_VIVO"], function() {
+gulp.task("copyFileToProj_VIVO", ["createAdapter_VIVO"], function() {
 	// 如果不是vivo快游戏
 	if (platform !== "vivogame") {
 		return;
@@ -406,7 +503,7 @@ gulp.task("modifyFile_VIVO", ["deleteSignFile_VIVO"], function() {
 	}
 	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
 	// 修改game.js文件
-	let content = `require("./qgame-adapter.js");\nif(!window.navigator)\n\twindow.navigator = {};\nwindow.navigator.userAgent = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 VVGame NetType/WIFI Language/zh_CN';
+	let content = `require("@qgame/adapter");\nif(!window.navigator)\n\twindow.navigator = {};\nwindow.navigator.userAgent = 'Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 VVGame NetType/WIFI Language/zh_CN';
 require("./libs/laya.vvmini.js");\nrequire("./index.js");`;
 	let gameJsPath = path.join(projSrc, "game.js");
 	fs.writeFileSync(gameJsPath, content, "utf8");
@@ -494,8 +591,6 @@ gulp.task("dealEngineFolder1_VIVO", ["version_VIVO"], function() {
 		return;
 	}
 
-	let adapterOriginalPath = path.join(projDir, "src", "qgame-adapter.js");
-
 	// 不想写一堆task任务,500ms默认拷贝完成吧
 	// 未来有了更好的解决方案再修改
 	return new Promise(function(resolve, reject) {
@@ -505,16 +600,9 @@ gulp.task("dealEngineFolder1_VIVO", ["version_VIVO"], function() {
 		return stream.pipe(gulp.dest(projDir));
 	}).then(function() {
 		return new Promise(function(resolve, reject) {
-			// 将adapter.js拷贝到engine文件夹中
-			setTimeout(resolve, 500);
-			var stream = gulp.src([adapterOriginalPath]);
-			return stream.pipe(gulp.dest(`${projDir}/engine`));
-		});
-	}).then(function() {
-		return new Promise(function(resolve, reject) {
 			// 删掉src下的engine和adapter
 			setTimeout(resolve, 500);
-			return del([engineFolder, adapterOriginalPath], { force: true });
+			return del([engineFolder], { force: true });
 		});
 	}).catch(function(err) {
 		console.log(err);
@@ -547,47 +635,10 @@ gulp.task("dealNoCompile1_VIVO", ["dealEngineFolder2_VIVO"], function() {
 		return;
 	}
 
-	// let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
-	// let bundleJsStr = (versionCon && versionCon["js/bundle.js"]) ? versionCon["js/bundle.js"] :  "js/bundle.js";
-	// let box2dJsStr = (versionCon && versionCon["libs/box2d.js"]) ? versionCon["libs/box2d.js"] :  "libs/box2d.js";
-	// let physicsJsStr = (versionCon && versionCon["libs/laya.physics.js"]) ? versionCon["libs/laya.physics.js"] :  "libs/laya.physics.js";
-	// let physics3DJsStr = (versionCon && versionCon["libs/laya.physics3D.js"]) ? versionCon["libs/laya.physics3D.js"] :  "libs/laya.physics3D.js";
-
-	// // 修改index.js,去掉物理库前面的libs
-	// let filePath = path.join(projSrc, indexJsStr);
-	// let fileContent = fs.readFileSync(filePath, "utf8");
-	// let physicsNameList = [];
-
-	// if (fileContent.includes(bundleJsStr)) {
-	// 	let adapterJsPath = path.join(projSrc, bundleJsStr);
-	// 	physicsNameList.push(bundleJsStr);
-	// 	physicsLibsPathList.push(adapterJsPath);
-	// }
-	// if (fileContent.includes(box2dJsStr)) {
-	// 	let libPath = path.join(projSrc, box2dJsStr);
-	// 	physicsNameList.push(box2dJsStr);
-	// 	physicsLibsPathList.push(libPath);
-	// }
-	// if (fileContent.includes(physicsJsStr)) {
-	// 	let libPath = path.join(projSrc, physicsJsStr);
-	// 	physicsNameList.push(physicsJsStr);
-	// 	physicsLibsPathList.push(libPath);
-	// }
-	// if (fileContent.includes(physics3DJsStr)) {
-	// 	let libPath = path.join(projSrc, physics3DJsStr);
-	// 	physicsNameList.push(physics3DJsStr);
-	// 	physicsLibsPathList.push(libPath);
-	// }
-	// if (physicsLibsPathList.length > 0) {
-	// 	let adapterJsPath = path.join(projSrc, "qgame-adapter.js");
-	// 	physicsNameList.push("qgame-adapter.js");
-	// 	physicsLibsPathList.push(adapterJsPath);
-	// }
-
-
-	// 将js/bundle.js | libs/*.* qgame-adapter.js 全放到engine文件夹中
+	// 将js/bundle.js | libs/*.* 全放到engine文件夹中
 	let indexJsStr = (versionCon && versionCon["index.js"]) ? versionCon["index.js"] :  "index.js";
 	let bundleJsStr = (versionCon && versionCon["js/bundle.js"]) ? versionCon["js/bundle.js"] :  "js/bundle.js";
+	let layaJsStr = (versionCon && versionCon["laya.js"]) ? versionCon["laya.js"] :  "laya.js";
 
 	// 修改index.js,去掉物理库前面的libs
 	let filePath = path.join(projSrc, indexJsStr);
@@ -599,6 +650,11 @@ gulp.task("dealNoCompile1_VIVO", ["dealEngineFolder2_VIVO"], function() {
 		physicsNameList.push(bundleJsStr);
 		physicsLibsPathList.push(adapterJsPath);
 	}
+	if (fileContent.includes(layaJsStr)) {
+		let layaJsPath = path.join(projSrc, layaJsStr);
+		physicsNameList.push(layaJsStr);
+		physicsLibsPathList.push(layaJsPath);
+	}
 	let libsList = fs.readdirSync(path.join(projSrc, "libs"));
 	let libsFileName, libsFilePath;
 	for (let i = 0, len = libsList.length; i < len; i++) {
@@ -607,16 +663,11 @@ gulp.task("dealNoCompile1_VIVO", ["dealEngineFolder2_VIVO"], function() {
 		physicsNameList.push(`libs/${libsFileName}`);
 		physicsLibsPathList.push(libsFilePath);
 	}
-	if (physicsLibsPathList.length > 0) {
-		let adapterJsPath = path.join(projSrc, "qgame-adapter.js");
-		physicsNameList.push("qgame-adapter.js");
-		physicsLibsPathList.push(adapterJsPath);
-	}
 
 	// 修改配置文件
 	configVivoConfigFile(physicsNameList);
 
-	// 将物理库、qgame-adapter.js拷贝到engine中
+	// 将物理库拷贝到engine中
 	var stream = gulp.src(physicsLibsPathList, {base: projSrc});
 	return stream.pipe(gulp.dest(path.join(projDir, "engine")));
 });
@@ -670,7 +721,8 @@ gulp.task("buildRPK_VIVO", ["dealNoCompile2_VIVO"], function() {
 		let cmd = `npm${commandSuffix}`;
 		let args = ["run", cmdStr];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
@@ -703,7 +755,8 @@ gulp.task("showQRCode_VIVO", ["buildRPK_VIVO"], function() {
 		let cmd = `npm${commandSuffix}`;
 		let args = ["run", "server"];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);

+ 35 - 15
RubikCube/.laya/publish_wxgame.js

@@ -1,4 +1,4 @@
-// v1.2.0
+// v1.4.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_wxgame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -18,16 +18,17 @@ const gulp = require(ideModuleDir + "gulp");
 const fs = require("fs");
 const path = require("path");
 const crypto = require("crypto");
-const childProcess = require("child_process");
 const del = require(ideModuleDir + "del");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
-const provider = "wxe24357b5ce551510";
-const fullRemoteEngineList = ["laya.core.js", "laya.webgl.js", "laya.filter.js", "laya.ani.js", "laya.d3.js", "laya.html.js", "laya.particle.js", "laya.ui.js", "bytebuffer.js"];
+const provider = "wx70d8aa25ec591f7a";
+const fullRemoteEngineList = ["laya.core.js", "laya.webgl.js", "laya.filter.js", "laya.ani.js", "laya.d3.js", "laya.html.js", "laya.particle.js", "laya.ui.js", "laya.d3Plugin.js"];
 
-let prevTasks = ["packfile"];
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_WX"];
 }
 
 let 
@@ -37,8 +38,12 @@ let
 let isGlobalCli = true;
 let isOpendataProj;
 let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_WX", prevTasks, function() {
+gulp.task("preCreate_WX", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -81,7 +86,7 @@ gulp.task("copyPlatformFile_WX", ["preCreate_WX"], function() {
 	if (platform !== "wxgame") {
 		return;
 	}
-	let adapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "wxfiles");
+	let adapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "wxfiles");
 	// 开放域项目
 	if (isOpendataProj) {
 		let platformDir = path.join(adapterPath, "weapp-adapter.js");
@@ -97,13 +102,21 @@ gulp.task("copyPlatformFile_WX", ["preCreate_WX"], function() {
 	if (isHadWXFiles) {
 		return;
 	}
+	let isHasPublish = 
+		fs.existsSync(path.join(releaseDir, "game.js")) &&
+		fs.existsSync(path.join(releaseDir, "game.json")) &&
+		fs.existsSync(path.join(releaseDir, "project.config.json")) &&
+		fs.existsSync(path.join(releaseDir, "weapp-adapter.js"));
+	if (isHasPublish) {
+		return;
+	}
 	let copyLibsList = [`${adapterPath}/*.*`];
 	var stream = gulp.src(copyLibsList);
 	return stream.pipe(gulp.dest(releaseDir));
 });
 
 // 开放域的情况下,合并game.js和index.js,并删除game.js
-gulp.task("openData_WX", ["copyPlatformFile_WX"], function (cb) {
+gulp.task("openData_WX", packfiletask, function (cb) {
 	// 如果不是微信小游戏
 	if (platform !== "wxgame") {
 		return cb();
@@ -207,6 +220,7 @@ gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
 	let coreLibPath = path.join(workSpaceDir, "bin", "libs", "laya.core.js");
 	let isHasCoreLib = fs.existsSync(coreLibPath);
 	let isOldAsProj = fs.existsSync(`${workSpaceDir}/asconfig.json`) && !isHasCoreLib;
+	let isNewTsProj = fs.existsSync(`${workSpaceDir}/src/tsconfig.json`) && !isHasCoreLib;
 	let EngineVersion = getEngineVersion();
 	if (!EngineVersion) {
 		throw new Error(`读取引擎版本号失败,请于服务提供商联系!`);
@@ -254,7 +268,7 @@ gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
 					indexJsCon = indexJsCon.replace(fullRequireItem, "");
 				}
 			}
-			if (isOldAsProj) { // 如果as语言,开发者将laya.js也写入index.js中了,将其删掉
+			if (isOldAsProj || isNewTsProj) { // 如果as||ts_new语言,开发者将laya.js也写入index.js中了,将其删掉
 				fullRequireItem = `loadLib("laya.js")`;
 				if (indexJsCon.includes(fullRequireItem)) {
 					indexJsCon = indexJsCon.replace(fullRequireItem, "");
@@ -262,8 +276,8 @@ gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
 			}
 			fs.writeFileSync(indexJsPath, indexJsCon, "utf8");
 			// ts/js再次修改game.js,仅引用使用到的类库
-			// as因为本地只有laya.js,无法仅引用使用到的类库
-			if (!isOldAsProj) {
+			// as||ts_new因为本地只有laya.js,无法仅引用使用到的类库
+			if (!isOldAsProj && !isNewTsProj) {
 				let pluginCon = "";
 				localUseEngineList.forEach(function(item) {
 					pluginCon += `requirePlugin("layaPlugin/${item}");\n`;
@@ -280,7 +294,7 @@ gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
 			console.log(`将本地的引擎插件移动到laya-libs中`);
 			// 3) 将本地的引擎插件移动到laya-libs中
 			copyEnginePathList = [`${releaseDir}/libs/{${localUseEngineList.join(",")}}`];
-			if (isOldAsProj) { // 单独拷贝laya.js
+			if (isOldAsProj || isNewTsProj) { // 单独拷贝laya.js
 				copyEnginePathList = [`${releaseDir}/laya.js`];
 			}
 			gulp.src(copyEnginePathList).pipe(gulp.dest(`${releaseDir}/laya-libs`));
@@ -296,7 +310,7 @@ gulp.task("pluginEngin_WX", ["optimizeOpen_WX"], function(cb) {
 		return new Promise(async function(resolve, reject) {
 			console.log(`完善引擎插件目录`);
 			// 5) 引擎插件目录laya-libs中还需要新建几个文件,使该目录能够使用
-			if (isOldAsProj) { // 单独拷贝laya.js
+			if (isOldAsProj || isNewTsProj) { // 单独拷贝laya.js
 				localUseEngineList.push("laya.js");
 			}
 			let 
@@ -380,6 +394,12 @@ function getEngineVersion() {
 			EngineVersion = matchList[1];
 		}
 	}
+	// 特殊处理,因为历史原因,我们有一些4位的正式版本,调整为3位
+	if (EngineVersion && /[\d\.]+/.test(EngineVersion) && EngineVersion.split(".").length > 3) {
+		let verList = EngineVersion.split(".");
+		verList.length = 3;
+		EngineVersion = verList.join(".");
+	}
 	return EngineVersion;
 }
 
@@ -398,7 +418,7 @@ function getFileMd5(filePath) {
 }
 
 function canUsePluginEngine(version) {
-	const minVersionNum = "2.0.2";
+	const minVersionNum = "2.0.1";
 	let compileMacthList = minVersionNum.match(/^(\d+)\.(\d+)\.(\d+)/);
 	let matchList = version.match(/^(\d+)\.(\d+)\.(\d+)/);
     if (matchList[1] > compileMacthList[1]) {

+ 33 - 16
RubikCube/.laya/publish_xmgame.js

@@ -1,4 +1,4 @@
-// v1.2.0
+// v1.4.0
 // publish 2.x 也是用这个文件,需要做兼容
 let isPublish2 = process.argv[2].includes("publish_xmgame.js") && process.argv[3].includes("--evn=publish2");
 // 获取Node插件和工作路径
@@ -22,9 +22,11 @@ const del = require(ideModuleDir + "del");
 const revCollector = require(ideModuleDir + 'gulp-rev-collector');
 let commandSuffix = ".cmd";
 
-let prevTasks = ["packfile"];
+let copyLibsTask = ["copyLibsJsFile"];
+let packfiletask = ["packfile"];
 if (isPublish2) {
-	prevTasks = "";
+	copyLibsTask = "";
+	packfiletask = ["copyPlatformFile_XM"];
 }
 
 let 
@@ -36,9 +38,13 @@ let
 let IDEXMProjPath,
 	isUpdateIDEXMProj = false;
 let versionCon; // 版本管理version.json
+let layarepublicPath = path.join(ideModuleDir, "../", "code", "layarepublic");
+if (!fs.existsSync(layarepublicPath)) {
+	layarepublicPath = path.join(ideModuleDir, "../", "out", "layarepublic");
+}
 // 创建小米项目前,拷贝小米引擎库、修改index.js
 // 应该在publish中的,但是为了方便发布2.0及IDE 1.x,放在这里修改
-gulp.task("preCreate_XM", prevTasks, function() {
+gulp.task("preCreate_XM", copyLibsTask, function() {
 	if (isPublish2) {
 		let pubsetPath = path.join(workSpaceDir, ".laya", "pubset.json");
 		let content = fs.readFileSync(pubsetPath, "utf8");
@@ -70,14 +76,14 @@ gulp.task("copyPlatformFile_XM", ["preCreate_XM"], function() {
 	if (platform !== "xmgame") {
 		return;
 	}
-	let xmAdapterPath = path.join(ideModuleDir, "../", "out", "layarepublic", "LayaAirProjectPack", "lib", "data", "xmfiles");
+	let xmAdapterPath = path.join(layarepublicPath, "LayaAirProjectPack", "lib", "data", "xmfiles");
 	let copyLibsList = [`${xmAdapterPath}/**/*.*`];
 	var stream = gulp.src(copyLibsList);
 	return stream.pipe(gulp.dest(tempReleaseDir));
 });
 
 // 新建小米项目-小米项目与其他项目不同,需要新建小米快游戏项目,并打包成.rpk文件
-gulp.task("checkIDEProj_XM", ["copyPlatformFile_XM"], function() {
+gulp.task("checkIDEProj_XM", packfiletask, function() {
 	// 如果不是小米快游戏
 	if (platform !== "xmgame") {
 		return;
@@ -85,7 +91,7 @@ gulp.task("checkIDEProj_XM", ["copyPlatformFile_XM"], function() {
 	if (!ideModuleDir) {
 		return;
 	}
-	IDEXMProjPath = path.join(ideModuleDir, "../", "out", "layarepublic", "xm");
+	IDEXMProjPath = path.join(layarepublicPath, "xm");
 	if (process.platform === "darwin") {
 		return;
 	}
@@ -128,21 +134,21 @@ gulp.task("checkIDEProj_XM", ["copyPlatformFile_XM"], function() {
 		});
 		setTimeout(() => {
 			if (!isGetLocal || !isGetRemote) {
-				console.log("获取远程版本号或本地版本号失败");
+				console.log("Failed to get the remote or local version number");
 				reject();
 				return;
 			}
 		}, 10000);
 	}).then(() => { // 比较两个版本号
 		if (!remoteVersion || !localVersion) {
-			console.log("获取远程版本号或本地版本号失败!");
+			console.log("Failed to get the remote or local version number!");
 		}
 		console.log("quickgame-cli -> ", localVersion, "|", remoteVersion);
 		if (remoteVersion.trim() !== localVersion.trim()) { // 仅当两个版本号都获取到并且不相等,置为需要更新(true)
 			isUpdateIDEXMProj = true;
 		}
 	}).catch((e) => {
-		console.log("获取远程版本号或本地版本号失败 -> ", remoteVersion, "|", localVersion);
+		console.log("Failed to get the remote or local version number -> ", remoteVersion, "|", localVersion);
 		console.log(e);
 	});
 });
@@ -173,8 +179,10 @@ gulp.task("createIDEProj_XM", ["checkIDEProj_XM"], function() {
 					`versionCode=${config.xmInfo.versionCode}`, `minPlatformVersion=${config.xmInfo.minPlatformVersion}`,
                     `icon=/layaicon/${path.basename(config.xmInfo.icon)}`, `name=${config.xmInfo.name}`, `rebuild=true`];
         console.log(JSON.stringify(args));
-        
-        let cp = childProcess.spawn(cmd, args);
+		let opts = {
+			shell: true
+		};
+        let cp = childProcess.spawn(cmd, args, opts);
         
 		cp.stdout.on('data', (data) => {
 			console.log(`stdout: ${data}`);
@@ -225,8 +233,10 @@ gulp.task("createProj_XM", ["createIDEProj_XM"], function() {
 					`versionCode=${config.xmInfo.versionCode}`, `minPlatformVersion=${config.xmInfo.minPlatformVersion}`,
                     `icon=/layaicon/${path.basename(config.xmInfo.icon)}`, `name=${config.xmInfo.name}`, `rebuild=true`];
         console.log(JSON.stringify(args));
-        
-        let cp = childProcess.spawn(cmd, args);
+        let opts = {
+			shell: true
+		};
+        let cp = childProcess.spawn(cmd, args, opts);
         
 		cp.stdout.on('data', (data) => {
 			console.log(`stdout: ${data}`);
@@ -406,6 +416,11 @@ gulp.task("modifyFile_XM", ["deleteSignFile_XM"], function() {
 	manifestJson.versionCode = config.xmInfo.versionCode;
 	manifestJson.minPlatformVersion = config.xmInfo.minPlatformVersion;
 	manifestJson.icon = `/layaicon/${path.basename(config.xmInfo.icon)}`;
+	if (config.xmInfo.subpack) { // 分包
+		manifestJson.subpackages = config.xmSubpack;
+	} else {
+		delete manifestJson.subpackages;
+	}
 	fs.writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4), "utf8");
 
 	if (config.version) {
@@ -460,7 +475,8 @@ gulp.task("buildRPK_XM", ["version_XM"], function() {
 		let cmd = `npm${commandSuffix}`;
 		let args = ["run", cmdStr];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);
@@ -491,7 +507,8 @@ gulp.task("showQRCode_XM", ["buildRPK_XM"], function() {
 		let cmd = `npm${commandSuffix}`;
 		let args = ["run", "server"];
 		let opts = {
-			cwd: projDir
+			cwd: projDir,
+			shell: true
 		};
 		let cp = childProcess.spawn(cmd, args, opts);
 		// let cp = childProcess.spawn(`npx${commandSuffix}`, ['-v']);

+ 1 - 1
RubikCube/.laya/wxgame.json

@@ -64,7 +64,7 @@
     "forceCompile": false,
     "onlyIndexJS": true,
     "projectType": "ts",
-    "pubTime": 1597668814575,
+    "pubTime": 1597753920511,
     "uesEnginePlugin": false,
     "wxOptimize": {
         "useOptimizeOpen": false,

File diff suppressed because it is too large
+ 13 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/05e77883499b421406ccbc545a473792a605e915


File diff suppressed because it is too large
+ 19 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/0defb2ce0ae7e3087eea59a9c6fb153b3325fd86


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/1d69c0ebd39a31aaffe3fbb413dc48d6ed2270e0


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/1dcd0577dabd120359b630eee23a90d1be9712e2


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/215edee67516625981f1a34a10a9059638ddfddc


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/2430cec0063d49d8aa45d2826f89d3414c2f05c0


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/29273151bf631bc76a253b1149721f25e551e79d


File diff suppressed because it is too large
+ 16 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/33207b1f3167bef823b37f805b157fba52bb6286


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/388d4ecbe81d36e9d713fa32bd4a5b2727a157c7


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/3952e431c0dac4293d230a733d2e431b445d2ab5


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/43f98a9fc9b84077a1e6ce99204e9b6d46e8ded6


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/5a605b3f3e17a141a31baaf59f497059209b9dd3


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/64141059d0ab4df162b2367befd2457893d43c95


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/662804772048460bb67eaf611476de69e81d76c5


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/6e66a1892e2109e428960e1487f4294233a48ef5


File diff suppressed because it is too large
+ 11 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/6fbdbac47186bbdff0dabf5eaeb6ec77c2dfd276


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/72f795edd2081dc0efbf236e567fbd1282465ebd


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/73599a09562a737fdad88707e1d54ab15f771402


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/73f804c8c08e20faa8f810f703c45a89b35f0b57


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/750585efa191d909d58cc8f66e2b8ce990182c5e


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7693a06f36ecd5f3c5250035cec18e275b6373dd


File diff suppressed because it is too large
+ 7 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7bee1bde101b4663df27f62d570b59db49985a0d


File diff suppressed because it is too large
+ 10 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/7c85aad6cf4a7d189001056afce9aa61112093bb


File diff suppressed because it is too large
+ 15 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/9c12306284e32ab6c9df058d04e9f78850da6a40


File diff suppressed because it is too large
+ 22 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/a667558afd5dc96b1637fef6f35516469bab3db5


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/b653185851a3113c7652410d943ee0f8df9a539b


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c0a298ee3fc98ea82215c38c64183f2513909ae3


File diff suppressed because it is too large
+ 11 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c10a97c9bffd9053d72eb6bc5f497aeeff17a4c3


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c2ada570396c8b2f1da731584ffde54bd5813866


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/c61928fbe2602351863652a8b766eaba444451cd


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/ca5e10acd5fe63ce3b6f42a80d403e7bdde6419e


File diff suppressed because it is too large
+ 10 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/d0cb81d3a6431bc8044a11664512bd3f78dfb712


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e4dde9eb49c3f7caaa2607dd24fe4d8a59407c0f


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e701fc81888b1d1bac838bc8fc5989ccee3a9b42


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/e9c2de8f1fe45dea719ac946bc150890ce236c7c


File diff suppressed because it is too large
+ 12 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/code/cache/f9c249d1a1e47d3cf70272133f4df0a118289dea


+ 1 - 1
RubikCube/.rpt2_cache/rpt2_ce064c5d7e31dc12b03871ed8c081d634013faa7/code/cache/f3b0063f87abe92819f6b3682cc54de9a3234c30

@@ -1,5 +1,5 @@
 {
-  "code": "export class Global {\r\n}\r\nGlobal.VERSION = \"1.0.1\";\r\nGlobal.CFG = \"123\";\r\n//# sourceMappingURL=Global.js.map",
+  "code": "export class Global {\r\n}\r\nGlobal.VERSION = \"1.0.3\";\r\nGlobal.CFG = \"123\";\r\n//# sourceMappingURL=Global.js.map",
   "references": [],
   "map": "{\"version\":3,\"file\":\"Global.js\",\"sourceRoot\":\"\",\"sources\":[\"../../src/Global.ts\"],\"names\":[],\"mappings\":\"AAAA,MAAM,OAAO,MAAM;;AACR,cAAO,GAAG,OAAO,CAAC;AAClB,UAAG,GAAG,KAAK,CAAC\"}"
 }

+ 0 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/508e5ed3e3f8c99ac64a923d3f23c8af98467cf5


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/66bf06b3a9ec1f59758b09016e9f3d67747f8576


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/e55730a85acdf7bea118bd0f7877b16a1163a0eb


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_0d9f0377d378b6dddeb1400b0ec51cd71a206a97/types/cache/e921e8d054107575a68a30c69d4eaec9ef2a325e


File diff suppressed because it is too large
+ 13 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/05e77883499b421406ccbc545a473792a605e915


File diff suppressed because it is too large
+ 11 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/0b28bb8f7703dd22c8df92bb0d92a3b769d5de70


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/215edee67516625981f1a34a10a9059638ddfddc


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/2430cec0063d49d8aa45d2826f89d3414c2f05c0


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/29273151bf631bc76a253b1149721f25e551e79d


File diff suppressed because it is too large
+ 16 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/33207b1f3167bef823b37f805b157fba52bb6286


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/388d4ecbe81d36e9d713fa32bd4a5b2727a157c7


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/43f98a9fc9b84077a1e6ce99204e9b6d46e8ded6


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/5a605b3f3e17a141a31baaf59f497059209b9dd3


File diff suppressed because it is too large
+ 20 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/5d90f475b99f5abd60aeeafae456a11e7861ef6d


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/64141059d0ab4df162b2367befd2457893d43c95


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/662804772048460bb67eaf611476de69e81d76c5


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/6e66a1892e2109e428960e1487f4294233a48ef5


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/72f795edd2081dc0efbf236e567fbd1282465ebd


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/73599a09562a737fdad88707e1d54ab15f771402


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/73f804c8c08e20faa8f810f703c45a89b35f0b57


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/750585efa191d909d58cc8f66e2b8ce990182c5e


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/7693a06f36ecd5f3c5250035cec18e275b6373dd


File diff suppressed because it is too large
+ 10 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/7c85aad6cf4a7d189001056afce9aa61112093bb


File diff suppressed because it is too large
+ 18 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/8569c8a906bccdad004bf4b486a5528260fee157


File diff suppressed because it is too large
+ 15 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/9c12306284e32ab6c9df058d04e9f78850da6a40


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/a451417d99e90286cd4b9c51b4f8440babf24960


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/b653185851a3113c7652410d943ee0f8df9a539b


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/b8dcb3606061ec6c257c67558ec98322dd8d67f6


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c0a298ee3fc98ea82215c38c64183f2513909ae3


File diff suppressed because it is too large
+ 11 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c10a97c9bffd9053d72eb6bc5f497aeeff17a4c3


File diff suppressed because it is too large
+ 9 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/c2ada570396c8b2f1da731584ffde54bd5813866


File diff suppressed because it is too large
+ 14 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/ca5e10acd5fe63ce3b6f42a80d403e7bdde6419e


File diff suppressed because it is too large
+ 8 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e4dde9eb49c3f7caaa2607dd24fe4d8a59407c0f


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e701fc81888b1d1bac838bc8fc5989ccee3a9b42


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/e9c2de8f1fe45dea719ac946bc150890ce236c7c


File diff suppressed because it is too large
+ 12 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/f9c249d1a1e47d3cf70272133f4df0a118289dea


+ 5 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/code/cache/ff94b628d82924a0504a130464e3e5e6db3d362f

@@ -0,0 +1,5 @@
+{
+  "code": "export class Global {\r\n}\r\nGlobal.VERSION = \"1.0.3\";\r\nGlobal.CFG = \"123\";\r\n//# sourceMappingURL=Global.js.map",
+  "references": [],
+  "map": "{\"version\":3,\"file\":\"Global.js\",\"sourceRoot\":\"\",\"sources\":[\"../../src/Global.ts\"],\"names\":[],\"mappings\":\"AAAA,MAAM,OAAO,MAAM;;AACR,cAAO,GAAG,OAAO,CAAC;AAClB,UAAG,GAAG,KAAK,CAAC\"}"
+}

+ 0 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/508e5ed3e3f8c99ac64a923d3f23c8af98467cf5


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/66bf06b3a9ec1f59758b09016e9f3d67747f8576


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/e55730a85acdf7bea118bd0f7877b16a1163a0eb


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_74259ea4c72f5f35ffb9e00b136975eec62d4d58/types/cache/e921e8d054107575a68a30c69d4eaec9ef2a325e


File diff suppressed because it is too large
+ 13 - 0
RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/05e77883499b421406ccbc545a473792a605e915


File diff suppressed because it is too large
+ 19 - 0
RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/0defb2ce0ae7e3087eea59a9c6fb153b3325fd86


File diff suppressed because it is too large
+ 5 - 0
RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/1d69c0ebd39a31aaffe3fbb413dc48d6ed2270e0


+ 0 - 0
RubikCube/.rpt2_cache/rpt2_97ed5610b207dc73abb0751ff92f34f8fb72fcd3/code/cache/1dcd0577dabd120359b630eee23a90d1be9712e2


Some files were not shown because too many files changed in this diff