@modern-js/repo-generator 0.0.0-next-20241014055508 → 0.0.0-next-20241014070959

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -143,13 +143,6 @@
143
143
  module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithNpmUtils"];
144
144
  }
145
145
  });
146
- // globals:@modern-js/codesmith-utils/ora
147
- var require_ora = __commonJS({
148
- "globals:@modern-js/codesmith-utils/ora" (exports, module1) {
149
- "use strict";
150
- module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithOraUtils"];
151
- }
152
- });
153
146
  // globals:@modern-js/codesmith-utils/semver
154
147
  var require_semver = __commonJS({
155
148
  "globals:@modern-js/codesmith-utils/semver" (exports, module1) {
@@ -157,6 +150,13 @@
157
150
  module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithSemverUtils"];
158
151
  }
159
152
  });
153
+ // globals:@modern-js/codesmith-utils/ora
154
+ var require_ora = __commonJS({
155
+ "globals:@modern-js/codesmith-utils/ora" (exports, module1) {
156
+ "use strict";
157
+ module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithOraUtils"];
158
+ }
159
+ });
160
160
  // globals:@modern-js/codesmith-utils/chalk
161
161
  var require_chalk = __commonJS({
162
162
  "globals:@modern-js/codesmith-utils/chalk" (exports, module1) {
@@ -19593,14 +19593,12 @@ function encode_char(c) {
19593
19593
  }
19594
19594
  }
19595
19595
  // ../../generator-plugin/dist/esm/index.js
19596
- var import_codesmith6 = __toESM(require_codesmith());
19596
+ var import_codesmith7 = __toESM(require_codesmith());
19597
19597
  var import_fs_extra3 = __toESM(require_fs_extra());
19598
19598
  var import_lodash5 = __toESM(require_lodash());
19599
19599
  // ../../generator-utils/dist/esm/index.js
19600
- var import_execa2 = __toESM(require_execa());
19600
+ var import_codesmith = __toESM(require_codesmith());
19601
19601
  var import_fs_extra = __toESM(require_fs_extra());
19602
- var import_npm2 = __toESM(require_npm());
19603
- var import_ora = __toESM(require_ora());
19604
19602
  // ../../generator-utils/dist/esm/locale/index.js
19605
19603
  var import_plugin_i18n2 = __toESM(require_plugin_i18n());
19606
19604
  // ../../generator-utils/dist/esm/locale/en.js
@@ -20832,46 +20830,19 @@ function encode_char(c) {
20832
20830
  var lib = JSON5;
20833
20831
  var dist_default = lib;
20834
20832
  // ../../generator-utils/dist/esm/index.js
20835
- var import_npm3 = __toESM(require_npm());
20833
+ var import_npm2 = __toESM(require_npm());
20836
20834
  var import_fs_extra2 = __toESM(require_fs_extra());
20837
- var import_ora2 = __toESM(require_ora());
20835
+ var import_ora = __toESM(require_ora());
20838
20836
  var import_semver2 = __toESM(require_semver());
20839
- var import_execa3 = __toESM(require_execa());
20837
+ var import_execa2 = __toESM(require_execa());
20840
20838
  var import_chalk = __toESM(require_chalk());
20841
- function getPackageVersion(packageName, registry) {
20839
+ function getPackageVersion(packageName, registryUrl) {
20842
20840
  return __async(this, null, function*() {
20843
- const spinner = (0, import_ora.ora)({
20844
- text: "Load Generator...",
20845
- spinner: "runner"
20846
- }).start();
20847
- if (yield (0, import_npm2.canUsePnpm)()) {
20848
- const args = [
20849
- "info",
20850
- packageName,
20851
- "version"
20852
- ];
20853
- if (registry) {
20854
- args.push(`--registry=${registry}`);
20855
- }
20856
- const result = yield (0, import_execa2.execa)("pnpm", args);
20857
- spinner.stop();
20858
- return stripAnsi(result.stdout);
20859
- }
20860
- if (yield (0, import_npm2.canUseNpm)()) {
20861
- const args = [
20862
- "view",
20863
- packageName,
20864
- "version"
20865
- ];
20866
- if (registry) {
20867
- args.push(`--registry=${registry}`);
20868
- }
20869
- const result = yield (0, import_execa2.execa)("npm", args);
20870
- spinner.stop();
20871
- return stripAnsi(result.stdout);
20872
- }
20873
- spinner.stop();
20874
- throw new Error("not found npm, please install npm before");
20841
+ const { name, version } = (0, import_codesmith.getPackageInfo)(packageName);
20842
+ return (0, import_codesmith.getNpmVersion)(name, {
20843
+ version,
20844
+ registryUrl
20845
+ });
20875
20846
  });
20876
20847
  }
20877
20848
  function getModernPluginVersion(_0, _1) {
@@ -20929,7 +20900,7 @@ function encode_char(c) {
20929
20900
  return Constructor;
20930
20901
  }
20931
20902
  // ../../generator-plugin/dist/esm/context/file.js
20932
- var import_codesmith = __toESM(require_codesmith());
20903
+ var import_codesmith2 = __toESM(require_codesmith());
20933
20904
  var import_codesmith_api_json = __toESM(require_codesmith_api_json());
20934
20905
  var import_globby = __toESM(require_globby());
20935
20906
  var FileType;
@@ -21305,7 +21276,7 @@ function encode_char(c) {
21305
21276
  return __generator(this, function(_state) {
21306
21277
  switch(_state.label){
21307
21278
  case 0:
21308
- fsMaterial = new import_codesmith.FsMaterial(_this.projectPath);
21279
+ fsMaterial = new import_codesmith2.FsMaterial(_this.projectPath);
21309
21280
  return [
21310
21281
  4,
21311
21282
  _this.jsonAPI.update(fsMaterial.get(fileName), {
@@ -21845,7 +21816,7 @@ function encode_char(c) {
21845
21816
  });
21846
21817
  }
21847
21818
  // ../../new-action/dist/esm/mwa.js
21848
- var import_codesmith2 = __toESM(require_codesmith());
21819
+ var import_codesmith3 = __toESM(require_codesmith());
21849
21820
  var import_codesmith_formily = __toESM(require_codesmith_formily());
21850
21821
  var import_lodash2 = __toESM(require_lodash());
21851
21822
  // ../../new-action/dist/esm/constants.js
@@ -21866,7 +21837,7 @@ function encode_char(c) {
21866
21837
  i18n.changeLanguage({
21867
21838
  locale: language
21868
21839
  });
21869
- const smith = new import_codesmith2.CodeSmith({
21840
+ const smith = new import_codesmith3.CodeSmith({
21870
21841
  debug,
21871
21842
  registryUrl: registry
21872
21843
  });
@@ -21947,7 +21918,7 @@ function encode_char(c) {
21947
21918
  });
21948
21919
  });
21949
21920
  // ../../new-action/dist/esm/module.js
21950
- var import_codesmith3 = __toESM(require_codesmith());
21921
+ var import_codesmith4 = __toESM(require_codesmith());
21951
21922
  var import_codesmith_formily2 = __toESM(require_codesmith_formily());
21952
21923
  var import_lodash3 = __toESM(require_lodash());
21953
21924
  var ModuleNewAction = (options)=>__async(void 0, null, function*() {
@@ -21962,7 +21933,7 @@ function encode_char(c) {
21962
21933
  i18n.changeLanguage({
21963
21934
  locale: language
21964
21935
  });
21965
- const smith = new import_codesmith3.CodeSmith({
21936
+ const smith = new import_codesmith4.CodeSmith({
21966
21937
  debug,
21967
21938
  registryUrl: registry
21968
21939
  });
@@ -22328,7 +22299,7 @@ function encode_char(c) {
22328
22299
  en: EN_LOCALE3
22329
22300
  });
22330
22301
  // ../../generator-plugin/dist/esm/utils/index.js
22331
- var import_codesmith5 = __toESM(require_codesmith());
22302
+ var import_codesmith6 = __toESM(require_codesmith());
22332
22303
  // ../../generator-plugin/dist/esm/utils/module.js
22333
22304
  var import_lodash4 = __toESM(require_lodash());
22334
22305
  function requireModule(modulePath) {
@@ -22338,7 +22309,7 @@ function encode_char(c) {
22338
22309
  ]) || module1;
22339
22310
  }
22340
22311
  // ../../generator-plugin/dist/esm/utils/getPackageMeta.js
22341
- var import_codesmith4 = __toESM(require_codesmith());
22312
+ var import_codesmith5 = __toESM(require_codesmith());
22342
22313
  var NPM_API_TIMEOUT = 3e4;
22343
22314
  function getPackageMeta(packageName, packageVersion, options) {
22344
22315
  return _getPackageMeta.apply(this, arguments);
@@ -22360,10 +22331,10 @@ function encode_char(c) {
22360
22331
  params.push("--registry");
22361
22332
  params.push(registryUrl);
22362
22333
  }
22363
- getPkgInfoPromise = (0, import_execa3.execa)("npm", params);
22334
+ getPkgInfoPromise = (0, import_execa2.execa)("npm", params);
22364
22335
  return [
22365
22336
  4,
22366
- (0, import_codesmith4.timeoutPromise)(getPkgInfoPromise, NPM_API_TIMEOUT, "Get npm version of '".concat(packageName, "'"))
22337
+ (0, import_codesmith5.timeoutPromise)(getPkgInfoPromise, NPM_API_TIMEOUT, "Get npm version of '".concat(packageName, "'"))
22367
22338
  ];
22368
22339
  case 1:
22369
22340
  stdout = _state.sent().stdout;
@@ -22428,10 +22399,10 @@ function encode_char(c) {
22428
22399
  }
22429
22400
  ];
22430
22401
  }
22431
- _getPackageInfo = (0, import_codesmith5.getPackageInfo)(plugin), name = _getPackageInfo.name, version = _getPackageInfo.version;
22402
+ _getPackageInfo = (0, import_codesmith6.getPackageInfo)(plugin), name = _getPackageInfo.name, version = _getPackageInfo.version;
22432
22403
  return [
22433
22404
  4,
22434
- (0, import_codesmith5.downloadPackage)(name, version, {
22405
+ (0, import_codesmith6.downloadPackage)(name, version, {
22435
22406
  registryUrl,
22436
22407
  install: true
22437
22408
  })
@@ -22526,7 +22497,7 @@ function encode_char(c) {
22526
22497
  6
22527
22498
  ];
22528
22499
  case 4:
22529
- _getPackageInfo = (0, import_codesmith6.getPackageInfo)(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
22500
+ _getPackageInfo = (0, import_codesmith7.getPackageInfo)(plugin), name = _getPackageInfo.name, pkgVersion = _getPackageInfo.version;
22530
22501
  return [
22531
22502
  4,
22532
22503
  getPackageMeta(name, pkgVersion, {
@@ -22934,6 +22905,15 @@ function encode_char(c) {
22934
22905
  var src_default = (context, generator)=>__async(void 0, null, function*() {
22935
22906
  var _a;
22936
22907
  process.setMaxListeners(20);
22908
+ const { distTag } = context.config;
22909
+ yield generator.prepareGlobal();
22910
+ yield generator.prepareGenerators([
22911
+ `@modern-js/repo-generator@${distTag || "latest"}`,
22912
+ `@modern-js/base-generator@${distTag || "latest"}`,
22913
+ `@modern-js/mwa-generator@${distTag || "latest"}`,
22914
+ `@modern-js/entry-generator@${distTag || "latest"}`,
22915
+ `@modern-js/module-generator@${distTag || "latest"}`
22916
+ ]);
22937
22917
  const appApi = new import_codesmith_api_app.AppAPI(context, generator);
22938
22918
  const { locale } = context.config;
22939
22919
  i18n.changeLanguage({
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-20241014055508",
18
+ "version": "0.0.0-next-20241014070959",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,14 +30,14 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@modern-js/base-generator": "0.0.0-next-20241014055508",
34
- "@modern-js/generator-plugin": "0.0.0-next-20241014055508",
35
- "@modern-js/module-generator": "0.0.0-next-20241014055508",
36
- "@modern-js/generator-utils": "0.0.0-next-20241014055508",
37
- "@modern-js/generator-common": "0.0.0-next-20241014055508",
38
- "@modern-js/mwa-generator": "0.0.0-next-20241014055508",
39
- "@scripts/build": "0.0.0-next-20241014055508",
40
- "@scripts/jest-config": "0.0.0-next-20241014055508"
33
+ "@modern-js/base-generator": "0.0.0-next-20241014070959",
34
+ "@modern-js/generator-common": "0.0.0-next-20241014070959",
35
+ "@modern-js/module-generator": "0.0.0-next-20241014070959",
36
+ "@modern-js/generator-utils": "0.0.0-next-20241014070959",
37
+ "@modern-js/mwa-generator": "0.0.0-next-20241014070959",
38
+ "@scripts/build": "0.0.0-next-20241014070959",
39
+ "@scripts/jest-config": "0.0.0-next-20241014070959",
40
+ "@modern-js/generator-plugin": "0.0.0-next-20241014070959"
41
41
  },
42
42
  "sideEffects": false,
43
43
  "publishConfig": {
package/src/index.ts CHANGED
@@ -90,6 +90,18 @@ const handlePlugin = async (
90
90
  export default async (context: GeneratorContext, generator: GeneratorCore) => {
91
91
  process.setMaxListeners(20);
92
92
 
93
+ const { distTag } = context.config;
94
+
95
+ // avoid create tools version is older
96
+ await generator.prepareGlobal();
97
+ await generator.prepareGenerators([
98
+ `@modern-js/repo-generator@${distTag || 'latest'}`,
99
+ `@modern-js/base-generator@${distTag || 'latest'}`,
100
+ `@modern-js/mwa-generator@${distTag || 'latest'}`,
101
+ `@modern-js/entry-generator@${distTag || 'latest'}`,
102
+ `@modern-js/module-generator@${distTag || 'latest'}`,
103
+ ]);
104
+
93
105
  const appApi = new AppAPI(context, generator);
94
106
 
95
107
  const { locale } = context.config;