@infly/libs 2.0.43 → 2.0.45
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/README.md +104 -67
- package/{module → adapters/vue2/module}/Permission.js +2 -2
- package/{module → adapters/vue2/module}/REST.js +32 -20
- package/{module → adapters/vue2/module}/TokenService.js +10 -1
- package/adapters/vue2/module/file-export.js +18 -0
- package/adapters/vue2/postinstall.js +46 -0
- package/adapters/vue2/project-preview.js +152 -0
- package/adapters/vue2/script-config.js +26 -0
- package/adapters/vue2/store/index.js +1 -0
- package/{store → adapters/vue2/store}/modules/user.js +1 -1
- package/adapters/vue2/vite/index.js +95 -0
- package/adapters/vue2/vite/jest.config.js +11 -0
- package/{build → adapters/vue2}/webpack5/webpack.base.js +26 -79
- package/bin/cli.js +71 -71
- package/build/build-dist/index.js +863 -863
- package/build/build-dist/script-management.js +5 -5
- package/{script/build → build/build-utils}/command.js +13 -4
- package/{script/build → build/build-utils}/deps.js +1 -1
- package/{script/build → build/build-utils}/git.js +6 -4
- package/{script/build → build/build-utils}/preview.js +4 -1
- package/{script/webhook/webhook.js → build/build-utils/webhook-single.js} +7 -2
- package/{script/build → build/build-utils}/webhook.js +3 -2
- package/build/docker/compose-command.js +74 -74
- package/build/docker/compose-release.js +91 -91
- package/compat/init.js +9 -0
- package/index.js +8 -20
- package/module/Uts.js +77 -7265
- package/module/cjs/{request-url-rules.cjs → request-url-rules.js} +6 -0
- package/module/cjs/rest-error-rules.js +33 -0
- package/package.json +124 -92
- package/script/git-automation/git-clone.js +3 -4
- package/script/git-automation/git-configure.js +29 -0
- package/script/git-automation/index.js +0 -14
- package/script/git-automation/submodule-status.js +113 -0
- package/script/git-automation/submodule-utils.js +18 -0
- package/script/index.js +1 -26
- package/tools/auto-export.js +1 -2
- package/tools/concurrency.js +30 -0
- package/tools/progress.js +63 -0
- package/tools/project-command.js +198 -194
- package/tools/project-preview.js +1 -148
- package/tools/select-option.js +60 -60
- package/tools/workspace-config.js +145 -0
- package/.prettierrc +0 -5
- package/build/build-dist/script-management.test.js +0 -16
- package/build/docker/compose-command.test.js +0 -148
- package/build/docker/compose-release.test.js +0 -101
- package/build/docker/docker-build-push.test.js +0 -124
- package/build/webpack5/remove-legacy-assets-plugin.js +0 -84
- package/build/webpack5/webpack.base.test.js +0 -59
- package/lib/index.js +0 -6
- package/lib/server/connect.js +0 -3011
- package/lib/server/serve-static.js +0 -4848
- package/module/cjs/deep-merge.cjs +0 -38
- package/script/pts/cloud-scenes.mjs +0 -65
- package/script/pts/cloud.js +0 -151
- package/script/pts/generate-cloud-params.mjs +0 -210
- package/script/pts/generate-cloud-params.test.mjs +0 -67
- package/store/index.js +0 -0
- package/tools/file-export.js +0 -165
- package/tools/project-command.test.js +0 -267
- package/tools/select-option.test.js +0 -52
- package/webpack.config.js +0 -38
- /package/{module → adapters/vue2/module}/Router.js +0 -0
- /package/{build → adapters/vue2}/webpack5/inline-runtime-plugin.js +0 -0
- /package/{script/build → build/build-utils}/env.js +0 -0
- /package/module/cjs/{page-config.cjs → page-config.js} +0 -0
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const InlineRuntimePlugin = require("./inline-runtime-plugin");
|
|
5
|
-
const RemoveLegacyAssetsPlugin = require("./remove-legacy-assets-plugin");
|
|
6
|
-
|
|
7
5
|
// 环境变量与常量配置
|
|
8
6
|
const ENV = {
|
|
9
7
|
IS_PROD: ["production", "staging"].includes(process.env.NODE_ENV),
|
|
@@ -11,13 +9,6 @@ const ENV = {
|
|
|
11
9
|
IS_DEV: process.env.ENV === "development"
|
|
12
10
|
};
|
|
13
11
|
|
|
14
|
-
// 强制禁用 modern mode(staging 环境)
|
|
15
|
-
if (ENV.IS_STAGING) {
|
|
16
|
-
process.env.VUE_CLI_MODERN_MODE = "false";
|
|
17
|
-
process.env.VUE_CLI_MODERN_BUILD = "false";
|
|
18
|
-
console.log("\n\x1b[36m⚡ Building for STAGING with Modern Bundle only (仅现代浏览器)...\x1b[0m");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
12
|
/**
|
|
22
13
|
* 解析项目路径(兼容monorepo)
|
|
23
14
|
* @param {string} dir 相对路径
|
|
@@ -94,7 +85,7 @@ function configureWebpack(extraConfig = {}) {
|
|
|
94
85
|
},
|
|
95
86
|
fallback: createNodePolyfills(),
|
|
96
87
|
// 优化模块解析
|
|
97
|
-
extensions: [".js", ".vue", ".json", ".jsx"],
|
|
88
|
+
extensions: [".js", ".vue", ".json", ".jsx", ".ts", ".tsx"],
|
|
98
89
|
modules: ["node_modules"]
|
|
99
90
|
},
|
|
100
91
|
target: ["web", "es5"],
|
|
@@ -151,76 +142,32 @@ function chainWebpack(config, options = {}) {
|
|
|
151
142
|
});
|
|
152
143
|
}
|
|
153
144
|
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
// 关键:重写 templateParameters 来阻止 modern mode 注入
|
|
175
|
-
const originalTemplateParameters = args[0].templateParameters || {};
|
|
176
|
-
args[0].templateParameters = (compilation, assets, assetTags, options) => {
|
|
177
|
-
const params =
|
|
178
|
-
typeof originalTemplateParameters === "function"
|
|
179
|
-
? originalTemplateParameters(compilation, assets, assetTags, options)
|
|
180
|
-
: originalTemplateParameters;
|
|
181
|
-
|
|
182
|
-
// 移除 modern/legacy 相关的参数
|
|
183
|
-
if (params) {
|
|
184
|
-
delete params.modernBuild;
|
|
185
|
-
delete params.legacyBuild;
|
|
186
|
-
delete params.modernManifest;
|
|
187
|
-
delete params.legacyManifest;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return params;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
return args;
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// 添加自定义插件来处理 legacy 文件问题
|
|
197
|
-
config.plugin("remove-legacy-assets").use(RemoveLegacyAssetsPlugin);
|
|
198
|
-
|
|
199
|
-
// Babel 配置:只转译现代浏览器
|
|
200
|
-
config.module
|
|
201
|
-
.rule("js")
|
|
202
|
-
.use("babel-loader")
|
|
203
|
-
.tap((options) => ({
|
|
204
|
-
...options,
|
|
205
|
-
presets: [
|
|
206
|
-
[
|
|
207
|
-
"@babel/preset-env",
|
|
208
|
-
{
|
|
209
|
-
targets: {
|
|
210
|
-
esmodules: true,
|
|
211
|
-
chrome: "60",
|
|
212
|
-
firefox: "60",
|
|
213
|
-
safari: "11",
|
|
214
|
-
edge: "79"
|
|
215
|
-
},
|
|
216
|
-
modules: false
|
|
217
|
-
}
|
|
218
|
-
]
|
|
145
|
+
// Babel 配置:只转译现代浏览器 + TypeScript(支持 @infly/ts-libs)
|
|
146
|
+
config.module
|
|
147
|
+
.rule("js")
|
|
148
|
+
.test(/\.(js|ts)x?$/)
|
|
149
|
+
.use("babel-loader")
|
|
150
|
+
.tap((options) => ({
|
|
151
|
+
...options,
|
|
152
|
+
presets: [
|
|
153
|
+
[
|
|
154
|
+
"@babel/preset-env",
|
|
155
|
+
{
|
|
156
|
+
targets: {
|
|
157
|
+
esmodules: true,
|
|
158
|
+
chrome: "60",
|
|
159
|
+
firefox: "60",
|
|
160
|
+
safari: "11",
|
|
161
|
+
edge: "79"
|
|
162
|
+
},
|
|
163
|
+
modules: false
|
|
164
|
+
}
|
|
219
165
|
],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
166
|
+
"@babel/preset-typescript"
|
|
167
|
+
],
|
|
168
|
+
cacheDirectory: true,
|
|
169
|
+
cacheCompression: false
|
|
170
|
+
}));
|
|
224
171
|
|
|
225
172
|
// 注册 runtime 内联插件
|
|
226
173
|
config.plugin("inline-runtime").use(InlineRuntimePlugin);
|
package/bin/cli.js
CHANGED
|
@@ -5,73 +5,73 @@ function loadBuildDist() {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
function loadPreview() {
|
|
8
|
-
return require("../
|
|
8
|
+
return require("../adapters/vue2/project-preview");
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function parseArgs(argv) {
|
|
12
|
-
const options = { env: "prod", local: false, dryRun: false };
|
|
13
|
-
const valueOptions = {
|
|
14
|
-
"--env": "env",
|
|
15
|
-
"--cicd-url": "cicdUrl",
|
|
16
|
-
"--project-dir": "projectDir",
|
|
17
|
-
"--file": "file",
|
|
11
|
+
function parseArgs(argv) {
|
|
12
|
+
const options = { env: "prod", local: false, dryRun: false };
|
|
13
|
+
const valueOptions = {
|
|
14
|
+
"--env": "env",
|
|
15
|
+
"--cicd-url": "cicdUrl",
|
|
16
|
+
"--project-dir": "projectDir",
|
|
17
|
+
"--file": "file",
|
|
18
18
|
"--bump": "bump",
|
|
19
19
|
"--config": "config",
|
|
20
|
-
"--target": "target",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let i = 0;
|
|
24
|
-
while (i < argv.length) {
|
|
25
|
-
const arg = argv[i];
|
|
26
|
-
const equalsIndex = arg.indexOf("=");
|
|
27
|
-
if (equalsIndex > 0) {
|
|
28
|
-
const flag = arg.slice(0, equalsIndex);
|
|
29
|
-
const key = valueOptions[flag];
|
|
30
|
-
if (key) {
|
|
31
|
-
const value = arg.slice(equalsIndex + 1);
|
|
32
|
-
if (!value) throw new Error(`${flag} requires a value.`);
|
|
33
|
-
options[key] = value;
|
|
34
|
-
i++;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (arg === "--local") {
|
|
40
|
-
options.local = true;
|
|
41
|
-
i++;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (arg === "--dry-run") {
|
|
45
|
-
options.dryRun = true;
|
|
46
|
-
i++;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (arg === "--push") {
|
|
50
|
-
options.push = true;
|
|
51
|
-
i++;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const key = valueOptions[arg];
|
|
56
|
-
if (key) {
|
|
57
|
-
const value = argv[i + 1];
|
|
58
|
-
if (!value || value.startsWith("--")) throw new Error(`${arg} requires a value.`);
|
|
59
|
-
options[key] = value;
|
|
60
|
-
i += 2;
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
i++;
|
|
65
|
-
}
|
|
66
|
-
return options;
|
|
20
|
+
"--target": "target",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let i = 0;
|
|
24
|
+
while (i < argv.length) {
|
|
25
|
+
const arg = argv[i];
|
|
26
|
+
const equalsIndex = arg.indexOf("=");
|
|
27
|
+
if (equalsIndex > 0) {
|
|
28
|
+
const flag = arg.slice(0, equalsIndex);
|
|
29
|
+
const key = valueOptions[flag];
|
|
30
|
+
if (key) {
|
|
31
|
+
const value = arg.slice(equalsIndex + 1);
|
|
32
|
+
if (!value) throw new Error(`${flag} requires a value.`);
|
|
33
|
+
options[key] = value;
|
|
34
|
+
i++;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (arg === "--local") {
|
|
40
|
+
options.local = true;
|
|
41
|
+
i++;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (arg === "--dry-run") {
|
|
45
|
+
options.dryRun = true;
|
|
46
|
+
i++;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (arg === "--push") {
|
|
50
|
+
options.push = true;
|
|
51
|
+
i++;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const key = valueOptions[arg];
|
|
56
|
+
if (key) {
|
|
57
|
+
const value = argv[i + 1];
|
|
58
|
+
if (!value || value.startsWith("--")) throw new Error(`${arg} requires a value.`);
|
|
59
|
+
options[key] = value;
|
|
60
|
+
i += 2;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
return options;
|
|
67
|
+
}
|
|
68
|
+
function parseProjectArgs(argv) {
|
|
69
|
+
const options = parseArgs(argv);
|
|
70
|
+
const hasExplicitEnv = argv.some((arg) => arg === "--env" || arg.startsWith("--env="));
|
|
71
|
+
delete options.local;
|
|
72
|
+
if (!hasExplicitEnv) delete options.env;
|
|
73
|
+
return options;
|
|
67
74
|
}
|
|
68
|
-
function parseProjectArgs(argv) {
|
|
69
|
-
const options = parseArgs(argv);
|
|
70
|
-
const hasExplicitEnv = argv.some((arg) => arg === "--env" || arg.startsWith("--env="));
|
|
71
|
-
delete options.local;
|
|
72
|
-
if (!hasExplicitEnv) delete options.env;
|
|
73
|
-
return options;
|
|
74
|
-
}
|
|
75
75
|
async function main(argv = process.argv.slice(2)) {
|
|
76
76
|
const command = argv[0];
|
|
77
77
|
const commandMap = {
|
|
@@ -89,15 +89,15 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
89
89
|
"build:docker": () => {
|
|
90
90
|
const opts = parseArgs(argv.slice(1));
|
|
91
91
|
return require("../build/docker/docker-build-push").dockerBuildPush(opts);
|
|
92
|
-
},
|
|
93
|
-
"docker:compose": () => {
|
|
94
|
-
const opts = parseArgs(argv.slice(1));
|
|
95
|
-
return require("../build/docker/compose-command").runComposeCommand(opts);
|
|
96
|
-
},
|
|
97
|
-
project: () => {
|
|
98
|
-
const action = argv[1] && !argv[1].startsWith("--") ? argv[1] : undefined;
|
|
99
|
-
const opts = parseProjectArgs(argv.slice(action ? 2 : 1));
|
|
100
|
-
return require("../tools/project-command").runProjectCommand({ ...opts, action });
|
|
92
|
+
},
|
|
93
|
+
"docker:compose": () => {
|
|
94
|
+
const opts = parseArgs(argv.slice(1));
|
|
95
|
+
return require("../build/docker/compose-command").runComposeCommand(opts);
|
|
96
|
+
},
|
|
97
|
+
project: () => {
|
|
98
|
+
const action = argv[1] && !argv[1].startsWith("--") ? argv[1] : undefined;
|
|
99
|
+
const opts = parseProjectArgs(argv.slice(action ? 2 : 1));
|
|
100
|
+
return require("../tools/project-command").runProjectCommand({ ...opts, action });
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
|