sys-shim 0.0.1-12 → 0.0.1-14
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "sys-shim",
|
3
3
|
"private": false,
|
4
4
|
"type": "module",
|
5
|
-
"version": "0.0.1-
|
5
|
+
"version": "0.0.1-14",
|
6
6
|
"main": "./script/npm-pkg/node/main.min.cjs",
|
7
7
|
"module": "./script/npm-pkg/node/main.min.mjs",
|
8
8
|
"browser": {
|
@@ -71,9 +71,8 @@
|
|
71
71
|
"prepare": "husky"
|
72
72
|
},
|
73
73
|
"devDependencies": {
|
74
|
-
"@release-it/conventional-changelog": "^8.0.1",
|
75
|
-
"release-it": "^17.2.1",
|
76
74
|
"@guolao/vue-monaco-editor": "^1.5.1",
|
75
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
77
76
|
"@rollup/plugin-alias": "^5.1.0",
|
78
77
|
"@rollup/plugin-commonjs": "^25.0.7",
|
79
78
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
@@ -86,6 +85,7 @@
|
|
86
85
|
"mitt": "^3.0.1",
|
87
86
|
"npm-run-all": "^4.1.5",
|
88
87
|
"proxy-deep": "^3.1.1",
|
88
|
+
"release-it": "^17.2.1",
|
89
89
|
"rollup": "^4.17.2",
|
90
90
|
"rpc-websockets": "^7.6.0",
|
91
91
|
"sys-shim": "link:",
|
@@ -93,10 +93,11 @@
|
|
93
93
|
"vue": "^3.3.8"
|
94
94
|
},
|
95
95
|
"dependencies": {
|
96
|
-
"
|
96
|
+
"dayjs": "^1.11.11",
|
97
97
|
"download": "^8.0.0",
|
98
98
|
"filenamify": "^6.0.0",
|
99
99
|
"minimist": "^1.2.8",
|
100
|
-
"shelljs": "^0.8.5"
|
100
|
+
"shelljs": "^0.8.5",
|
101
|
+
"shx": "^0.3.4"
|
101
102
|
}
|
102
103
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import cp from 'node:child_process'
|
2
2
|
import fs from 'node:fs'
|
3
|
+
import dayjs from 'dayjs'
|
3
4
|
import path from 'node:path'
|
4
5
|
import url from 'node:url'
|
5
6
|
import os from 'node:os'
|
@@ -33,6 +34,7 @@ function determinePathType(filePath) {
|
|
33
34
|
*/
|
34
35
|
async function parseArgv(argv) {
|
35
36
|
const cfg = {
|
37
|
+
nameSuffix: true,
|
36
38
|
input: ``,
|
37
39
|
icon: ``,
|
38
40
|
out: ``,
|
@@ -88,6 +90,7 @@ function zip(cfg) {
|
|
88
90
|
const out = cfg.out
|
89
91
|
const input = cfg.input
|
90
92
|
const unzip = cfg.unzip
|
93
|
+
const nameSuffix = cfg.nameSuffix
|
91
94
|
|
92
95
|
/**
|
93
96
|
* Path 解压后运行
|
@@ -129,8 +132,8 @@ function zip(cfg) {
|
|
129
132
|
* -ibck 在后台运行 WinRAR
|
130
133
|
* -idv 显示详细输出
|
131
134
|
*/
|
132
|
-
const
|
133
|
-
const cmd = `${zipBin} a -r -ep1 -y -ibck -sfx -iicon"${icon}" -z"${comment}" "${
|
135
|
+
const outName = nameSuffix ? `${out}-${dayjs(Date.now()).format(`YYYY-MM-DD-HH-mm-ss`)}` : out
|
136
|
+
const cmd = `${zipBin} a -r -ep1 -y -ibck -sfx -iicon"${icon}" -z"${comment}" "${outName}" ${input}/*`
|
134
137
|
cp.execSync(cmd, {stdio: `inherit`})
|
135
138
|
}
|
136
139
|
|
@@ -154,7 +157,7 @@ function genFile(cfg) {
|
|
154
157
|
shelljs.cp(`-f`, `${pkgDir}/script/npm-pkg/shim/win/main.exe`, newCfg.input)
|
155
158
|
shelljs.cp(`-f`, `${pkgDir}/script/npm-pkg/shim/win/favicon.ico`, newCfg.input)
|
156
159
|
shelljs.cp(`-f`, cfg.icon, `${newCfg.input}/favicon.ico`)
|
157
|
-
fs.statSync(cfg.input).isDirectory() && shelljs.cp(`-fr`, `${cfg.input}/*`, newCfg.input)
|
160
|
+
determinePathType(cfg.input) !== `url` && fs.statSync(cfg.input).isDirectory() && shelljs.cp(`-fr`, `${cfg.input}/*`, newCfg.input)
|
158
161
|
if(fs.existsSync(`${cfg.input}/package.json`) === false) {
|
159
162
|
const newStr = simpleTemplate(fs.readFileSync(`${newCfg.input}/package.json`, `utf8`), {
|
160
163
|
page: getIndex(cfg),
|