@shijiu/jsview 2.1.340-test.0 → 2.1.362-test.0
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/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/target_core_revision.mjs +2 -2
- package/package.json +1 -1
- package/patches/node_modules/@vitejs/plugin-vue/dist/index.mjs +123 -337
- package/patches/node_modules/@vitejs/plugin-vue/package.json +18 -16
- package/patches/node_modules/vite/dist/node/chunks/{dep-V3BH7oO1.js → dep-ed9cb113.js} +45353 -50657
- package/patches/node_modules/vite/dist/node/constants.js +1 -7
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +2 -1
- package/patches/node_modules/vite/package.json +64 -86
- package/tools/jsview-common.mjs +81 -6
- package/tools/jsview-config-app.mjs +47 -0
- package/tools/jsview-module-federation.mjs +365 -0
- package/tools/jsview-post-build.mjs +2 -2
- package/tools/jsview-post-install.mjs +6 -6
- package/tools/jsview-run-tool.mjs +45 -7
|
@@ -5,7 +5,6 @@ import { readFileSync } from 'node:fs';
|
|
|
5
5
|
const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
|
|
6
6
|
const VERSION = version;
|
|
7
7
|
const DEFAULT_MAIN_FIELDS = [
|
|
8
|
-
'browser',
|
|
9
8
|
'module',
|
|
10
9
|
'jsnext:main',
|
|
11
10
|
'jsnext',
|
|
@@ -81,7 +80,6 @@ const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
|
81
80
|
// looked up by mrmime.
|
|
82
81
|
const KNOWN_ASSET_TYPES = [
|
|
83
82
|
// images
|
|
84
|
-
'apng',
|
|
85
83
|
'png',
|
|
86
84
|
'jpe?g',
|
|
87
85
|
'jfif',
|
|
@@ -100,8 +98,6 @@ const KNOWN_ASSET_TYPES = [
|
|
|
100
98
|
'wav',
|
|
101
99
|
'flac',
|
|
102
100
|
'aac',
|
|
103
|
-
'opus',
|
|
104
|
-
'mov',
|
|
105
101
|
// fonts
|
|
106
102
|
'woff2?',
|
|
107
103
|
'eot',
|
|
@@ -125,7 +121,5 @@ const wildcardHosts = new Set([
|
|
|
125
121
|
'::',
|
|
126
122
|
'0000:0000:0000:0000:0000:0000:0000:0000',
|
|
127
123
|
]);
|
|
128
|
-
const DEFAULT_DEV_PORT = 5173;
|
|
129
|
-
const DEFAULT_PREVIEW_PORT = 4173;
|
|
130
124
|
|
|
131
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES,
|
|
125
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
|
@@ -17,7 +17,7 @@ const jsviewConfig = defineConfig({
|
|
|
17
17
|
'qr.js': true,
|
|
18
18
|
},
|
|
19
19
|
emptyOutDir: true,
|
|
20
|
-
minify: false,
|
|
20
|
+
minify: process.env['JSVIEW_DISABLE_MINIFY'] ? false : true,
|
|
21
21
|
modulePreload: {
|
|
22
22
|
polyfill: false
|
|
23
23
|
},
|
|
@@ -35,6 +35,7 @@ const jsviewConfig = defineConfig({
|
|
|
35
35
|
'jsview-forge-define': ['@shijiu/jsview/dom/jsv-forge-define.mjs'],
|
|
36
36
|
'jsview-dom-entry': ['@shijiu/jsview/dom/index.mjs'],
|
|
37
37
|
'jsview-vue-entry': ['@shijiu/jsview-vue/index.js'],
|
|
38
|
+
'jsview-vue-common': ['@shijiu/jsview-vue/bin/jsview-vue-common.mjs'],
|
|
38
39
|
// 'jsview-vue-export-sfc': [], // 将jsview-vue中的export-sfc,防止被集成在jsview-vue-entry中导致import deadloop.
|
|
39
40
|
},
|
|
40
41
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -8,34 +8,19 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"vite": "bin/vite.js"
|
|
10
10
|
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"frontend",
|
|
13
|
-
"framework",
|
|
14
|
-
"hmr",
|
|
15
|
-
"dev-server",
|
|
16
|
-
"build-tool",
|
|
17
|
-
"vite"
|
|
18
|
-
],
|
|
19
11
|
"main": "./dist/node/index.js",
|
|
12
|
+
"module": "./dist/node/index.js",
|
|
20
13
|
"types": "./dist/node/index.d.ts",
|
|
21
14
|
"exports": {
|
|
22
15
|
".": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
"require": {
|
|
28
|
-
"types": "./index.d.cts",
|
|
29
|
-
"default": "./index.cjs"
|
|
30
|
-
}
|
|
16
|
+
"types": "./dist/node/index.d.ts",
|
|
17
|
+
"import": "./dist/node/index.js",
|
|
18
|
+
"require": "./index.cjs"
|
|
31
19
|
},
|
|
32
20
|
"./client": {
|
|
33
21
|
"types": "./client.d.ts"
|
|
34
22
|
},
|
|
35
23
|
"./dist/client/*": "./dist/client/*",
|
|
36
|
-
"./types/*": {
|
|
37
|
-
"types": "./types/*"
|
|
38
|
-
},
|
|
39
24
|
"./package.json": "./package.json"
|
|
40
25
|
},
|
|
41
26
|
"files": [
|
|
@@ -43,11 +28,10 @@
|
|
|
43
28
|
"dist",
|
|
44
29
|
"client.d.ts",
|
|
45
30
|
"index.cjs",
|
|
46
|
-
"index.d.cts",
|
|
47
31
|
"types"
|
|
48
32
|
],
|
|
49
33
|
"engines": {
|
|
50
|
-
"node": "^18.0
|
|
34
|
+
"node": "^14.18.0 || >=16.0.0"
|
|
51
35
|
},
|
|
52
36
|
"repository": {
|
|
53
37
|
"type": "git",
|
|
@@ -57,81 +41,90 @@
|
|
|
57
41
|
"bugs": {
|
|
58
42
|
"url": "https://github.com/vitejs/vite/issues"
|
|
59
43
|
},
|
|
60
|
-
"homepage": "https://vitejs
|
|
61
|
-
"
|
|
44
|
+
"homepage": "https://github.com/vitejs/vite/tree/main/#readme",
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "rimraf dist && pnpm run build-bundle -w",
|
|
47
|
+
"build": "rimraf dist && run-s build-bundle build-types",
|
|
48
|
+
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
|
49
|
+
"build-types": "run-s build-types-temp build-types-pre-patch build-types-roll build-types-post-patch build-types-check",
|
|
50
|
+
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
|
|
51
|
+
"build-types-pre-patch": "tsx scripts/prePatchTypes.ts",
|
|
52
|
+
"build-types-roll": "api-extractor run && rimraf temp",
|
|
53
|
+
"build-types-post-patch": "tsx scripts/postPatchTypes.ts",
|
|
54
|
+
"build-types-check": "tsx scripts/checkBuiltTypes.ts && tsc --project tsconfig.check.json",
|
|
55
|
+
"lint": "eslint --cache --ext .ts src/**",
|
|
56
|
+
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
57
|
+
"prepublishOnly": "npm run build"
|
|
58
|
+
},
|
|
62
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
63
60
|
"dependencies": {
|
|
64
|
-
"esbuild": "^0.
|
|
65
|
-
"postcss": "^8.4.
|
|
66
|
-
"
|
|
61
|
+
"esbuild": "^0.16.3",
|
|
62
|
+
"postcss": "^8.4.19",
|
|
63
|
+
"resolve": "^1.22.1",
|
|
64
|
+
"rollup": "^3.7.0"
|
|
67
65
|
},
|
|
68
66
|
"optionalDependencies": {
|
|
69
|
-
"fsevents": "~2.3.
|
|
67
|
+
"fsevents": "~2.3.2"
|
|
70
68
|
},
|
|
71
69
|
"devDependencies": {
|
|
72
|
-
"@ampproject/remapping": "^2.2.
|
|
73
|
-
"@babel/parser": "^7.
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@rollup/plugin-
|
|
77
|
-
"@rollup/plugin-
|
|
78
|
-
"@rollup/plugin-
|
|
79
|
-
"@rollup/plugin-
|
|
80
|
-
"@rollup/plugin-
|
|
81
|
-
"@rollup/
|
|
82
|
-
"@
|
|
83
|
-
"
|
|
84
|
-
"acorn": "^8.
|
|
85
|
-
"acorn-walk": "^8.3.1",
|
|
70
|
+
"@ampproject/remapping": "^2.2.0",
|
|
71
|
+
"@babel/parser": "^7.20.5",
|
|
72
|
+
"@babel/types": "^7.20.5",
|
|
73
|
+
"@jridgewell/trace-mapping": "^0.3.17",
|
|
74
|
+
"@rollup/plugin-alias": "^4.0.2",
|
|
75
|
+
"@rollup/plugin-commonjs": "^23.0.3",
|
|
76
|
+
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
|
|
77
|
+
"@rollup/plugin-json": "^5.0.2",
|
|
78
|
+
"@rollup/plugin-node-resolve": "15.0.1",
|
|
79
|
+
"@rollup/plugin-typescript": "^10.0.1",
|
|
80
|
+
"@rollup/pluginutils": "^5.0.2",
|
|
81
|
+
"acorn": "^8.8.1",
|
|
82
|
+
"acorn-walk": "^8.2.0",
|
|
86
83
|
"cac": "^6.7.14",
|
|
87
84
|
"chokidar": "^3.5.3",
|
|
88
85
|
"connect": "^3.7.0",
|
|
89
|
-
"
|
|
86
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
87
|
+
"convert-source-map": "^1.9.0",
|
|
90
88
|
"cors": "^2.8.5",
|
|
91
89
|
"cross-spawn": "^7.0.3",
|
|
92
90
|
"debug": "^4.3.4",
|
|
93
91
|
"dep-types": "link:./src/types",
|
|
94
|
-
"dotenv": "^16.3
|
|
95
|
-
"dotenv-expand": "^
|
|
96
|
-
"es-module-lexer": "^1.
|
|
97
|
-
"
|
|
98
|
-
"estree-walker": "^3.0.3",
|
|
92
|
+
"dotenv": "^16.0.3",
|
|
93
|
+
"dotenv-expand": "^9.0.0",
|
|
94
|
+
"es-module-lexer": "^1.1.0",
|
|
95
|
+
"estree-walker": "^3.0.1",
|
|
99
96
|
"etag": "^1.8.1",
|
|
100
|
-
"fast-glob": "^3.
|
|
97
|
+
"fast-glob": "^3.2.12",
|
|
101
98
|
"http-proxy": "^1.18.1",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"lightningcss": "^1.22.1",
|
|
105
|
-
"magic-string": "^0.30.5",
|
|
99
|
+
"launch-editor-middleware": "^2.6.0",
|
|
100
|
+
"magic-string": "^0.27.0",
|
|
106
101
|
"micromatch": "^4.0.5",
|
|
107
|
-
"mlly": "^
|
|
102
|
+
"mlly": "^0.5.17",
|
|
108
103
|
"mrmime": "^1.0.1",
|
|
109
104
|
"okie": "^1.0.1",
|
|
110
|
-
"open": "^8.4.
|
|
105
|
+
"open": "^8.4.0",
|
|
111
106
|
"parse5": "^7.1.2",
|
|
112
|
-
"periscopic": "^
|
|
107
|
+
"periscopic": "^3.0.4",
|
|
113
108
|
"picocolors": "^1.0.0",
|
|
114
109
|
"picomatch": "^2.3.1",
|
|
115
|
-
"postcss-import": "^15.1
|
|
116
|
-
"postcss-load-config": "^4.0.
|
|
110
|
+
"postcss-import": "^15.0.1",
|
|
111
|
+
"postcss-load-config": "^4.0.1",
|
|
117
112
|
"postcss-modules": "^6.0.0",
|
|
118
|
-
"resolve.exports": "^
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"sirv": "^2.0.3",
|
|
113
|
+
"resolve.exports": "^1.1.0",
|
|
114
|
+
"sirv": "^2.0.2",
|
|
115
|
+
"source-map-js": "^1.0.2",
|
|
122
116
|
"source-map-support": "^0.5.21",
|
|
123
|
-
"strip-ansi": "^7.1
|
|
124
|
-
"strip-literal": "^
|
|
125
|
-
"tsconfck": "^
|
|
126
|
-
"tslib": "^2.
|
|
117
|
+
"strip-ansi": "^7.0.1",
|
|
118
|
+
"strip-literal": "^0.4.2",
|
|
119
|
+
"tsconfck": "^2.0.1",
|
|
120
|
+
"tslib": "^2.4.1",
|
|
127
121
|
"types": "link:./types",
|
|
128
|
-
"ufo": "^
|
|
129
|
-
"ws": "^8.
|
|
122
|
+
"ufo": "^0.8.6",
|
|
123
|
+
"ws": "^8.11.0"
|
|
130
124
|
},
|
|
131
125
|
"peerDependencies": {
|
|
132
|
-
"@types/node": "
|
|
126
|
+
"@types/node": ">= 14",
|
|
133
127
|
"less": "*",
|
|
134
|
-
"lightningcss": "^1.21.0",
|
|
135
128
|
"sass": "*",
|
|
136
129
|
"stylus": "*",
|
|
137
130
|
"sugarss": "*",
|
|
@@ -153,23 +146,8 @@
|
|
|
153
146
|
"sugarss": {
|
|
154
147
|
"optional": true
|
|
155
148
|
},
|
|
156
|
-
"lightningcss": {
|
|
157
|
-
"optional": true
|
|
158
|
-
},
|
|
159
149
|
"terser": {
|
|
160
150
|
"optional": true
|
|
161
151
|
}
|
|
162
|
-
},
|
|
163
|
-
"scripts": {
|
|
164
|
-
"dev": "rimraf dist && pnpm run build-bundle -w",
|
|
165
|
-
"build": "rimraf dist && run-s build-bundle build-types",
|
|
166
|
-
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
|
167
|
-
"build-types": "run-s build-types-temp build-types-roll build-types-check",
|
|
168
|
-
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
|
|
169
|
-
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
|
|
170
|
-
"build-types-check": "tsc --project tsconfig.check.json",
|
|
171
|
-
"typecheck": "tsc --noEmit",
|
|
172
|
-
"lint": "eslint --cache --ext .ts src/**",
|
|
173
|
-
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\""
|
|
174
152
|
}
|
|
175
|
-
}
|
|
153
|
+
}
|
package/tools/jsview-common.mjs
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
import childProcess from 'node:child_process';
|
|
5
5
|
import fs from 'node:fs';
|
|
6
|
+
import https from 'node:https';
|
|
6
7
|
import path from 'node:path';
|
|
7
8
|
import { Logger } from "./jsview-logger.js";
|
|
8
9
|
|
|
9
10
|
function printArgumentsUsages(requiredUsages, optionalUsages, helpUsages)
|
|
10
11
|
{
|
|
12
|
+
if(!helpUsages) {
|
|
13
|
+
helpUsages = {
|
|
14
|
+
'-h | --help': 'Print help usages.',
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
let maxLength = 0;
|
|
12
19
|
for (const usage in requiredUsages) {
|
|
13
20
|
maxLength = (maxLength > usage.length ? maxLength : usage.length);
|
|
@@ -40,7 +47,9 @@ function printArgumentsUsages(requiredUsages, optionalUsages, helpUsages)
|
|
|
40
47
|
|
|
41
48
|
function parseArguments(requiredUsages = {},
|
|
42
49
|
optionalUsages = {},
|
|
43
|
-
withoutUnparsed = true
|
|
50
|
+
withoutUnparsed = true,
|
|
51
|
+
ignoreUnknown = false,
|
|
52
|
+
ignoreHelpUsage = false)
|
|
44
53
|
{
|
|
45
54
|
const keySeparator = '|';
|
|
46
55
|
const formatKey = (key) => {
|
|
@@ -109,7 +118,8 @@ function parseArguments(requiredUsages = {},
|
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
let options = {
|
|
112
|
-
unparsed: []
|
|
121
|
+
unparsed: [],
|
|
122
|
+
argumentsLine: '',
|
|
113
123
|
};
|
|
114
124
|
|
|
115
125
|
// arg0: node
|
|
@@ -129,7 +139,8 @@ function parseArguments(requiredUsages = {},
|
|
|
129
139
|
}
|
|
130
140
|
}
|
|
131
141
|
|
|
132
|
-
if (
|
|
142
|
+
if (ignoreUnknown == false
|
|
143
|
+
&& hasKey(helpUsages, key) == false
|
|
133
144
|
&& hasKey(requiredUsages, key) == false
|
|
134
145
|
&& hasKey(optionalUsages, key) == false) {
|
|
135
146
|
Logger.ErrorAndExitNoException('Failed to parse usage: ' + argu);
|
|
@@ -138,11 +149,13 @@ function parseArguments(requiredUsages = {},
|
|
|
138
149
|
let formattedKey = formatKey(key);
|
|
139
150
|
let formattedValue = formatValue(value);
|
|
140
151
|
options[formattedKey] = formattedValue;
|
|
152
|
+
|
|
153
|
+
options.argumentsLine += ' ' + argu;
|
|
141
154
|
}
|
|
142
155
|
|
|
143
156
|
for (const checker in helpUsages) {
|
|
144
157
|
const aliasedOptions = checkAliases(checker, options);
|
|
145
|
-
if (aliasedOptions) {
|
|
158
|
+
if (aliasedOptions && ignoreHelpUsage == false) {
|
|
146
159
|
printArgumentsUsages(requiredUsages, optionalUsages, helpUsages);
|
|
147
160
|
process.exit(0);
|
|
148
161
|
}
|
|
@@ -207,6 +220,8 @@ function getOptions(framework)
|
|
|
207
220
|
}
|
|
208
221
|
|
|
209
222
|
options.appConfigDir = path.resolve(options.projectDir, 'src', 'appConfig');
|
|
223
|
+
options.appConfigFile = path.resolve(options.appConfigDir, 'app.config.mjs');
|
|
224
|
+
options.appJsviewConfigFile = path.resolve(options.appConfigDir, 'jsview.config.mjs');
|
|
210
225
|
options.appPrivKeyFile = path.resolve(options.appConfigDir, 'app_sign_private_key.crt');
|
|
211
226
|
options.appPubKeyFile = path.resolve(options.appConfigDir, 'app_sign_public_key.pem');
|
|
212
227
|
|
|
@@ -234,7 +249,7 @@ function getOptions(framework)
|
|
|
234
249
|
return options;
|
|
235
250
|
}
|
|
236
251
|
|
|
237
|
-
function
|
|
252
|
+
function loadPackageObject(modulePath)
|
|
238
253
|
{
|
|
239
254
|
const pkgFullFile = path.resolve(modulePath, 'package.json');
|
|
240
255
|
if (!fs.existsSync(pkgFullFile)) {
|
|
@@ -246,6 +261,16 @@ function getPackageObject(modulePath)
|
|
|
246
261
|
return pkgObj;
|
|
247
262
|
}
|
|
248
263
|
|
|
264
|
+
function savePackageObject(modulePath, pkgObj)
|
|
265
|
+
{
|
|
266
|
+
const pkgFullFile = path.resolve(modulePath, 'package.json');
|
|
267
|
+
const pkgContent = JSON.stringify(pkgObj, null, 2);
|
|
268
|
+
|
|
269
|
+
fs.writeFileSync(pkgFullFile, pkgContent, 'utf8');
|
|
270
|
+
|
|
271
|
+
return pkgObj;
|
|
272
|
+
}
|
|
273
|
+
|
|
249
274
|
function cpSync(workDir, srcPath, destPath, ignore=[])
|
|
250
275
|
{
|
|
251
276
|
const exists = fs.existsSync(srcPath);
|
|
@@ -383,18 +408,68 @@ function makeZip(zipFilePath, password, ...args)
|
|
|
383
408
|
}
|
|
384
409
|
}
|
|
385
410
|
|
|
411
|
+
function downloadFileAsync(url, localPath, workDir)
|
|
412
|
+
{
|
|
413
|
+
const relativePath = path.relative(workDir, localPath);
|
|
414
|
+
Logger.Info('Downloading ' + url + ' => ' + relativePath);
|
|
415
|
+
|
|
416
|
+
const file = fs.createWriteStream(localPath);
|
|
417
|
+
|
|
418
|
+
return new Promise((resolve, reject) => {
|
|
419
|
+
const request = https.get(url, (response) => {
|
|
420
|
+
response.pipe(file);
|
|
421
|
+
|
|
422
|
+
file.on('finish', () => {
|
|
423
|
+
file.close(() => {
|
|
424
|
+
Logger.Info('Success to download file to ' + relativePath);
|
|
425
|
+
resolve();
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
request.on('error', (err) => {
|
|
431
|
+
fs.unlink(localPath, () => {
|
|
432
|
+
Logger.ErrorAndExit('Failed to download file from ' + url);
|
|
433
|
+
reject(err);
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function unzipFile(zipFilePath, toDir, workDir)
|
|
440
|
+
{
|
|
441
|
+
var relativePath = path.relative(workDir, toDir);
|
|
442
|
+
if(!relativePath) {
|
|
443
|
+
relativePath = './'
|
|
444
|
+
}
|
|
445
|
+
Logger.Info('Unzipping ' + zipFilePath + ' => ' + relativePath);
|
|
446
|
+
|
|
447
|
+
const cmdline = 'npx extract-zip ' + zipFilePath + ' ' + toDir;
|
|
448
|
+
execCommand(cmdline);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function getNpmRegistry()
|
|
452
|
+
{
|
|
453
|
+
return 'https://nexus.cluster.qcast.cn/repository/npm-public';
|
|
454
|
+
}
|
|
455
|
+
|
|
386
456
|
export {
|
|
387
457
|
askAndAnswer,
|
|
388
458
|
checkNodeVersion,
|
|
389
459
|
cpSync,
|
|
460
|
+
downloadFileAsync,
|
|
390
461
|
execCommand,
|
|
391
462
|
getOptions,
|
|
392
|
-
|
|
463
|
+
getNpmRegistry,
|
|
393
464
|
isSymlinkSync,
|
|
465
|
+
loadPackageObject,
|
|
394
466
|
makeZip,
|
|
395
467
|
parseArguments,
|
|
468
|
+
printArgumentsUsages,
|
|
396
469
|
readJsonFile,
|
|
397
470
|
rmSync,
|
|
471
|
+
savePackageObject,
|
|
398
472
|
symlinkSync,
|
|
473
|
+
unzipFile,
|
|
399
474
|
Logger,
|
|
400
475
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {
|
|
7
|
+
checkNodeVersion,
|
|
8
|
+
getOptions,
|
|
9
|
+
parseArguments,
|
|
10
|
+
Logger,
|
|
11
|
+
} from './jsview-common.mjs';
|
|
12
|
+
|
|
13
|
+
function setAppConfig(options)
|
|
14
|
+
{
|
|
15
|
+
let appConfigContent = fs.readFileSync(options.appConfigFile, 'utf8');
|
|
16
|
+
|
|
17
|
+
appConfigContent = appConfigContent.replace(/AppName: .*,/, 'AppName: "' + options.appName + '",');
|
|
18
|
+
appConfigContent = appConfigContent.replace(/AppTitle: .*,/, 'AppTitle: "' + options.appTitle + '",');
|
|
19
|
+
|
|
20
|
+
console.log(appConfigContent)
|
|
21
|
+
|
|
22
|
+
fs.writeFileSync(options.appConfigFile, appConfigContent, 'utf8');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function main(argv) {
|
|
26
|
+
checkNodeVersion();
|
|
27
|
+
|
|
28
|
+
const options = getOptions();
|
|
29
|
+
|
|
30
|
+
options.appName = argv.appName ?? 'JsViewDemo';
|
|
31
|
+
options.appTitle = argv.appTitle ?? 'JsView Demo';
|
|
32
|
+
|
|
33
|
+
Logger.Info();
|
|
34
|
+
Logger.Info('Setting config to app.config.mjs ...');
|
|
35
|
+
setAppConfig(options);
|
|
36
|
+
Logger.Info('Set config finish.');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const requiredUsages = {
|
|
41
|
+
};
|
|
42
|
+
const optionalUsages = {
|
|
43
|
+
'--app-name': 'App name. default is: "JsViewDemo".',
|
|
44
|
+
'--app-title': 'App title. default is: "JsView Demo".',
|
|
45
|
+
};
|
|
46
|
+
const argv = parseArguments(requiredUsages, optionalUsages, false);
|
|
47
|
+
main(argv)
|