@modern-js/repo-generator 0.0.0-nightly-20231005160631 → 0.0.0-nightly-20231007160533
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 +13 -110
- package/package.json +11 -11
- package/src/index.ts +4 -12
package/dist/index.js
CHANGED
@@ -124789,10 +124789,9 @@ var require_env2 = __commonJS({
|
|
124789
124789
|
var env_exports = {};
|
124790
124790
|
__export2(env_exports, {
|
124791
124791
|
getNodeEnv: () => getNodeEnv,
|
124792
|
+
isBrowser: () => isBrowser,
|
124792
124793
|
isDev: () => isDev,
|
124793
|
-
isFastRefresh: () => isFastRefresh,
|
124794
124794
|
isProd: () => isProd,
|
124795
|
-
isProdProfile: () => isProdProfile,
|
124796
124795
|
isTest: () => isTest
|
124797
124796
|
});
|
124798
124797
|
module2.exports = __toCommonJS2(env_exports);
|
@@ -124800,39 +124799,6 @@ var require_env2 = __commonJS({
|
|
124800
124799
|
var isDev = () => getNodeEnv() === "development";
|
124801
124800
|
var isProd = () => getNodeEnv() === "production";
|
124802
124801
|
var isTest = () => getNodeEnv() === "test";
|
124803
|
-
var isProdProfile = () => isProd() && process.argv.includes("--profile");
|
124804
|
-
var isFastRefresh = () => isDev() && process.env.FAST_REFRESH !== "false";
|
124805
|
-
}
|
124806
|
-
});
|
124807
|
-
|
124808
|
-
// ../../../toolkit/utils/dist/cjs/cli/is/platform.js
|
124809
|
-
var require_platform2 = __commonJS({
|
124810
|
-
"../../../toolkit/utils/dist/cjs/cli/is/platform.js"(exports, module2) {
|
124811
|
-
"use strict";
|
124812
|
-
var __defProp2 = Object.defineProperty;
|
124813
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
124814
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
124815
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
124816
|
-
var __export2 = (target, all) => {
|
124817
|
-
for (var name in all)
|
124818
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
124819
|
-
};
|
124820
|
-
var __copyProps2 = (to, from, except, desc) => {
|
124821
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
124822
|
-
for (let key of __getOwnPropNames2(from))
|
124823
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
124824
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
124825
|
-
}
|
124826
|
-
return to;
|
124827
|
-
};
|
124828
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
124829
|
-
var platform_exports = {};
|
124830
|
-
__export2(platform_exports, {
|
124831
|
-
isBrowser: () => isBrowser,
|
124832
|
-
isNodeJS: () => isNodeJS
|
124833
|
-
});
|
124834
|
-
module2.exports = __toCommonJS2(platform_exports);
|
124835
|
-
var isNodeJS = () => typeof process !== "undefined" && process.versions != null && process.versions.node != null && process.versions.electron == null;
|
124836
124802
|
var isBrowser = () => typeof window !== "undefined";
|
124837
124803
|
}
|
124838
124804
|
});
|
@@ -125253,7 +125219,6 @@ var require_is2 = __commonJS({
|
|
125253
125219
|
var is_exports = {};
|
125254
125220
|
module2.exports = __toCommonJS2(is_exports);
|
125255
125221
|
__reExport(is_exports, require_env2(), module2.exports);
|
125256
|
-
__reExport(is_exports, require_platform2(), module2.exports);
|
125257
125222
|
__reExport(is_exports, require_type2(), module2.exports);
|
125258
125223
|
__reExport(is_exports, require_config4(), module2.exports);
|
125259
125224
|
__reExport(is_exports, require_project2(), module2.exports);
|
@@ -125770,30 +125735,13 @@ var require_alias2 = __commonJS({
|
|
125770
125735
|
__export2(alias_exports, {
|
125771
125736
|
getAliasConfig: () => getAliasConfig,
|
125772
125737
|
getUserAlias: () => getUserAlias,
|
125773
|
-
mergeAlias: () => mergeAlias
|
125774
|
-
validAlias: () => validAlias
|
125738
|
+
mergeAlias: () => mergeAlias
|
125775
125739
|
});
|
125776
125740
|
module2.exports = __toCommonJS2(alias_exports);
|
125777
125741
|
var import_fs = __toESM2(require("fs"));
|
125778
125742
|
var import_path19 = __toESM2(require("path"));
|
125779
|
-
var import_compiled = require_compiled2();
|
125780
125743
|
var import_get = require_get3();
|
125781
125744
|
var import_applyOptionsChain = require_applyOptionsChain2();
|
125782
|
-
var validAlias = (modernConfig, { tsconfigPath }) => {
|
125783
|
-
const { source: { alias } } = modernConfig;
|
125784
|
-
if (!alias) {
|
125785
|
-
return null;
|
125786
|
-
}
|
125787
|
-
const isTsProject = import_fs.default.existsSync(tsconfigPath);
|
125788
|
-
if (!isTsProject) {
|
125789
|
-
return null;
|
125790
|
-
}
|
125791
|
-
const userAlias = getUserAlias(alias);
|
125792
|
-
if (Object.keys(userAlias).length > 0) {
|
125793
|
-
return import_compiled.chalk.red('Note: Please use `compilerOptions.paths` in "tsconfig.json" file replace `source.alias` config in "modern.config.js/ts" when project is typescript');
|
125794
|
-
}
|
125795
|
-
return null;
|
125796
|
-
};
|
125797
125745
|
var mergeAlias = (alias) => (0, import_applyOptionsChain.applyOptionsChain)({}, alias);
|
125798
125746
|
var getAliasConfig = (aliasOption, option) => {
|
125799
125747
|
var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
|
@@ -126081,7 +126029,6 @@ var require_monorepo2 = __commonJS({
|
|
126081
126029
|
findMonorepoRoot: () => findMonorepoRoot,
|
126082
126030
|
getMonorepoPackages: () => getMonorepoPackages2,
|
126083
126031
|
isLerna: () => isLerna,
|
126084
|
-
isModernjsMonorepo: () => isModernjsMonorepo,
|
126085
126032
|
isMonorepo: () => isMonorepo,
|
126086
126033
|
isPnpmWorkspaces: () => isPnpmWorkspaces,
|
126087
126034
|
isYarnWorkspaces: () => isYarnWorkspaces
|
@@ -126108,18 +126055,6 @@ var require_monorepo2 = __commonJS({
|
|
126108
126055
|
};
|
126109
126056
|
var isPnpmWorkspaces = (root) => import_fs.default.existsSync(import_path19.default.join(root, WORKSPACE_FILES.PNPM));
|
126110
126057
|
var isMonorepo = (root) => isLerna(root) || isYarnWorkspaces(root) || isPnpmWorkspaces(root);
|
126111
|
-
var isModernjsMonorepo = (root) => {
|
126112
|
-
const pkgJsonPath = import_path19.default.join(root, "package.json");
|
126113
|
-
if (!import_fs.default.existsSync(pkgJsonPath)) {
|
126114
|
-
return false;
|
126115
|
-
}
|
126116
|
-
const json = JSON.parse(import_fs.default.readFileSync(pkgJsonPath, "utf8"));
|
126117
|
-
const deps = {
|
126118
|
-
...json.dependencies || {},
|
126119
|
-
...json.devDependencies || {}
|
126120
|
-
};
|
126121
|
-
return Boolean(deps["@modern-js/monorepo-tools"]);
|
126122
|
-
};
|
126123
126058
|
var findMonorepoRoot = (appDirectory, maxDepth = PACKAGE_MAX_DEPTH) => {
|
126124
126059
|
let inMonorepo = false;
|
126125
126060
|
for (let depth = 0; depth < maxDepth; depth++) {
|
@@ -146026,9 +145961,7 @@ var ZH_LOCALE2 = {
|
|
146026
145961
|
sub_solution: {
|
146027
145962
|
self: "请选择你想创建的工程类型",
|
146028
145963
|
mwa: "Web 应用",
|
146029
|
-
|
146030
|
-
module: "Npm 模块",
|
146031
|
-
inner_module: "Npm 模块(内部)"
|
145964
|
+
module: "Npm 模块"
|
146032
145965
|
},
|
146033
145966
|
action: {
|
146034
145967
|
self: "请选择你想要的操作",
|
@@ -146124,9 +146057,7 @@ var EN_LOCALE2 = {
|
|
146124
146057
|
sub_solution: {
|
146125
146058
|
self: "Please select the type of project you want to create:",
|
146126
146059
|
mwa: "Web App",
|
146127
|
-
mwa_test: "Web App (Test)",
|
146128
146060
|
module: "Npm Module",
|
146129
|
-
inner_module: "Npm Module (Inner)",
|
146130
146061
|
monorepo: "Monorepo"
|
146131
146062
|
},
|
146132
146063
|
action: {
|
@@ -146235,9 +146166,7 @@ var Solution;
|
|
146235
146166
|
var SubSolution;
|
146236
146167
|
(function(SubSolution22) {
|
146237
146168
|
SubSolution22["MWA"] = "mwa";
|
146238
|
-
SubSolution22["MWATest"] = "mwa_test";
|
146239
146169
|
SubSolution22["Module"] = "module";
|
146240
|
-
SubSolution22["InnerModule"] = "inner_module";
|
146241
146170
|
})(SubSolution || (SubSolution = {}));
|
146242
146171
|
var SolutionText = {
|
146243
146172
|
[Solution.MWA]: () => i18n2.t(localeKeys2.solution.mwa),
|
@@ -146246,24 +146175,13 @@ var SolutionText = {
|
|
146246
146175
|
};
|
146247
146176
|
var SubSolutionText = {
|
146248
146177
|
[SubSolution.MWA]: () => i18n2.t(localeKeys2.sub_solution.mwa),
|
146249
|
-
[SubSolution.
|
146250
|
-
[SubSolution.Module]: () => i18n2.t(localeKeys2.sub_solution.module),
|
146251
|
-
[SubSolution.InnerModule]: () => i18n2.t(localeKeys2.sub_solution.inner_module)
|
146178
|
+
[SubSolution.Module]: () => i18n2.t(localeKeys2.sub_solution.module)
|
146252
146179
|
};
|
146253
146180
|
var SolutionToolsMap = {
|
146254
146181
|
[Solution.MWA]: "@modern-js/app-tools",
|
146255
146182
|
[Solution.Module]: "@modern-js/module-tools",
|
146256
146183
|
[Solution.Monorepo]: "@modern-js/monorepo-tools"
|
146257
146184
|
};
|
146258
|
-
function getSolutionNameFromSubSolution(solution) {
|
146259
|
-
if (solution === SubSolution.MWATest) {
|
146260
|
-
return Solution.MWA;
|
146261
|
-
}
|
146262
|
-
if (solution === SubSolution.InnerModule) {
|
146263
|
-
return Solution.Module;
|
146264
|
-
}
|
146265
|
-
return solution;
|
146266
|
-
}
|
146267
146185
|
var getSolutionSchema = (extra = {}) => {
|
146268
146186
|
return {
|
146269
146187
|
type: "object",
|
@@ -146293,7 +146211,7 @@ var getSolutionSchema = (extra = {}) => {
|
|
146293
146211
|
};
|
146294
146212
|
};
|
146295
146213
|
var getScenesSchema = (extra = {}) => {
|
146296
|
-
const hasPlugin = (extra === null || extra === void 0 ? void 0 : extra.customPlugin) && extra.customPlugin[
|
146214
|
+
const hasPlugin = (extra === null || extra === void 0 ? void 0 : extra.customPlugin) && extra.customPlugin[extra === null || extra === void 0 ? void 0 : extra.solution] && extra.customPlugin[extra === null || extra === void 0 ? void 0 : extra.solution].length > 0;
|
146297
146215
|
return {
|
146298
146216
|
type: "object",
|
146299
146217
|
properties: hasPlugin ? {
|
@@ -146301,7 +146219,7 @@ var getScenesSchema = (extra = {}) => {
|
|
146301
146219
|
type: "string",
|
146302
146220
|
title: i18n2.t(localeKeys2.scenes.self),
|
146303
146221
|
enum: (() => {
|
146304
|
-
const solution =
|
146222
|
+
const solution = extra === null || extra === void 0 ? void 0 : extra.solution;
|
146305
146223
|
const items = ((extra === null || extra === void 0 ? void 0 : extra.customPlugin) ? (extra === null || extra === void 0 ? void 0 : extra.customPlugin[solution]) || [] : []).map((plugin) => ({
|
146306
146224
|
value: plugin.key,
|
146307
146225
|
label: extra.locale === "zh" ? plugin.name_zh || plugin.name : plugin.name
|
@@ -146326,9 +146244,7 @@ var SolutionGenerator = {
|
|
146326
146244
|
};
|
146327
146245
|
var SubSolutionGenerator = {
|
146328
146246
|
[SubSolution.MWA]: "@modern-js/mwa-generator",
|
146329
|
-
[SubSolution.
|
146330
|
-
[SubSolution.Module]: "@modern-js/module-generator",
|
146331
|
-
[SubSolution.InnerModule]: "@modern-js/module-generator"
|
146247
|
+
[SubSolution.Module]: "@modern-js/module-generator"
|
146332
146248
|
};
|
146333
146249
|
|
146334
146250
|
// ../../generator-common/dist/esm-node/common/language.js
|
@@ -146924,20 +146840,10 @@ var getMonorepoNewActionSchema = (extra = {}) => {
|
|
146924
146840
|
};
|
146925
146841
|
var MonorepoNewActionConfig = {
|
146926
146842
|
[SubSolution.MWA]: {
|
146927
|
-
isMonorepoSubProject: true
|
146928
|
-
isTest: false
|
146929
|
-
},
|
146930
|
-
[SubSolution.MWATest]: {
|
146931
|
-
isMonorepoSubProject: true,
|
146932
|
-
isTest: true
|
146843
|
+
isMonorepoSubProject: true
|
146933
146844
|
},
|
146934
146845
|
[SubSolution.Module]: {
|
146935
|
-
isMonorepoSubProject: true
|
146936
|
-
isPublic: true
|
146937
|
-
},
|
146938
|
-
[SubSolution.InnerModule]: {
|
146939
|
-
isMonorepoSubProject: true,
|
146940
|
-
isPublic: false
|
146846
|
+
isMonorepoSubProject: true
|
146941
146847
|
}
|
146942
146848
|
};
|
146943
146849
|
|
@@ -150056,14 +149962,11 @@ var getNeedRunPlugin = (context, generatorPlugin) => {
|
|
150056
149962
|
return false;
|
150057
149963
|
}
|
150058
149964
|
const { extendPlugin, customPlugin } = generatorPlugin;
|
150059
|
-
const {
|
150060
|
-
|
150061
|
-
|
150062
|
-
return (extendPlugin == null ? void 0 : extendPlugin[pluginSolution]) && extendPlugin[pluginSolution].length > 0;
|
149965
|
+
const { solution, scenes } = context.config;
|
149966
|
+
if (!scenes || scenes === solution) {
|
149967
|
+
return (extendPlugin == null ? void 0 : extendPlugin[solution]) && extendPlugin[solution].length > 0;
|
150063
149968
|
}
|
150064
|
-
return Boolean(
|
150065
|
-
(_a2 = customPlugin[pluginSolution]) == null ? void 0 : _a2.find((plugin) => plugin.key === scenes)
|
150066
|
-
);
|
149969
|
+
return Boolean((_a2 = customPlugin[solution]) == null ? void 0 : _a2.find((plugin) => plugin.key === scenes));
|
150067
149970
|
};
|
150068
149971
|
var handleTemplateFile = async (context, generator, appApi, generatorPlugin) => {
|
150069
149972
|
const { isMonorepo } = context.config;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "0.0.0-nightly-
|
18
|
+
"version": "0.0.0-nightly-20231007160533",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"main": "./dist/index.js",
|
21
21
|
"files": [
|
@@ -29,16 +29,16 @@
|
|
29
29
|
"@types/node": "^14",
|
30
30
|
"jest": "^29",
|
31
31
|
"typescript": "^5",
|
32
|
-
"@modern-js/base-generator": "0.0.0-nightly-
|
33
|
-
"@modern-js/generator-common": "0.0.0-nightly-
|
34
|
-
"@modern-js/generator-plugin": "0.0.0-nightly-
|
35
|
-
"@modern-js/generator-utils": "0.0.0-nightly-
|
36
|
-
"@modern-js/module-generator": "0.0.0-nightly-
|
37
|
-
"@modern-js/monorepo-generator": "0.0.0-nightly-
|
38
|
-
"@modern-js/mwa-generator": "0.0.0-nightly-
|
39
|
-
"@modern-js/utils": "0.0.0-nightly-
|
40
|
-
"@scripts/build": "0.0.0-nightly-
|
41
|
-
"@scripts/jest-config": "0.0.0-nightly-
|
32
|
+
"@modern-js/base-generator": "0.0.0-nightly-20231007160533",
|
33
|
+
"@modern-js/generator-common": "0.0.0-nightly-20231007160533",
|
34
|
+
"@modern-js/generator-plugin": "0.0.0-nightly-20231007160533",
|
35
|
+
"@modern-js/generator-utils": "0.0.0-nightly-20231007160533",
|
36
|
+
"@modern-js/module-generator": "0.0.0-nightly-20231007160533",
|
37
|
+
"@modern-js/monorepo-generator": "0.0.0-nightly-20231007160533",
|
38
|
+
"@modern-js/mwa-generator": "0.0.0-nightly-20231007160533",
|
39
|
+
"@modern-js/utils": "0.0.0-nightly-20231007160533",
|
40
|
+
"@scripts/build": "0.0.0-nightly-20231007160533",
|
41
|
+
"@scripts/jest-config": "0.0.0-nightly-20231007160533"
|
42
42
|
},
|
43
43
|
"sideEffects": false,
|
44
44
|
"publishConfig": {
|
package/src/index.ts
CHANGED
@@ -13,7 +13,6 @@ import {
|
|
13
13
|
SubSolution,
|
14
14
|
SubSolutionGenerator,
|
15
15
|
MonorepoNewActionConfig,
|
16
|
-
getSolutionNameFromSubSolution,
|
17
16
|
getScenesSchema,
|
18
17
|
} from '@modern-js/generator-common';
|
19
18
|
import { GeneratorPlugin } from '@modern-js/generator-plugin';
|
@@ -47,18 +46,11 @@ const getNeedRunPlugin = (
|
|
47
46
|
return false;
|
48
47
|
}
|
49
48
|
const { extendPlugin, customPlugin } = generatorPlugin;
|
50
|
-
const {
|
51
|
-
|
52
|
-
|
53
|
-
: solution;
|
54
|
-
if (!scenes || scenes === pluginSolution) {
|
55
|
-
return (
|
56
|
-
extendPlugin?.[pluginSolution] && extendPlugin[pluginSolution].length > 0
|
57
|
-
);
|
49
|
+
const { solution, scenes } = context.config;
|
50
|
+
if (!scenes || scenes === solution) {
|
51
|
+
return extendPlugin?.[solution] && extendPlugin[solution].length > 0;
|
58
52
|
}
|
59
|
-
return Boolean(
|
60
|
-
customPlugin[pluginSolution]?.find(plugin => plugin.key === scenes),
|
61
|
-
);
|
53
|
+
return Boolean(customPlugin[solution]?.find(plugin => plugin.key === scenes));
|
62
54
|
};
|
63
55
|
|
64
56
|
const handleTemplateFile = async (
|