@widget-js/cli 1.2.10 → 24.1.1-beta.1
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/jest.config.js +3 -3
- package/lib/{chunk-RAXJBANW.js → chunk-I4ZBPB2S.js} +45 -45
- package/lib/{chunk-IJH6LXRT.js → chunk-RDJH7Z4C.js} +74 -74
- package/lib/{chunk-3GPAHQ6O.js → chunk-XPJ33Y5L.js} +18 -18
- package/lib/{createWidget-UFW26NP6.js → createWidget-4LQ6PVEM.js} +200 -200
- package/lib/{dependencies-MRJDJJ6Q.js → dependencies-AVNHKRF3.js} +81 -81
- package/lib/index.js +35 -32
- package/lib/{init-MQONV3N3.js → init-HCEGKTNF.js} +117 -117
- package/lib/{release-XUYU5WNC.js → release-AQDFL5H3.js} +223 -226
- package/package.json +17 -15
- package/src/build/build.ts +8 -8
- package/src/createWidget.ts +46 -40
- package/src/dependencies/index.ts +6 -5
- package/src/dependencies/localDependencies.ts +17 -18
- package/src/dependencies/remoteDependencies.ts +22 -25
- package/src/index.ts +36 -36
- package/src/init/init.ts +23 -21
- package/src/promts/promptChecker.ts +10 -8
- package/src/release/ftp.ts +31 -27
- package/src/release/oss.ts +40 -38
- package/src/release/release.ts +17 -24
- package/src/release/update-zip.ts +14 -14
- package/src/utils/EJSUtils.ts +10 -9
- package/src/utils/PrettierUtils.ts +3 -2
- package/src/utils/WidgetPackageUtils.ts +5 -5
- package/src/utils.ts +31 -27
- package/template/WidgetConfig.ejs +7 -6
- package/template/WidgetDefine.ejs +1 -1
- package/template/WidgetRoutes.ejs +4 -4
- package/template/widget-router.ts +5 -4
- package/test/index.test.ts +7 -7
- package/tsconfig.json +25 -25
- package/tsup.config.ts +4 -4
- package/vite.config.ts +5 -5
- package/release-xyy.json +0 -7
|
@@ -1,226 +1,223 @@
|
|
|
1
|
-
import {
|
|
2
|
-
promptChecker_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
Utils
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// src/release/release.ts
|
|
9
|
-
import fs4 from "fs";
|
|
10
|
-
import path2 from "path";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import fs2 from "fs";
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"x-oss-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
import
|
|
71
|
-
import
|
|
72
|
-
import SSHConfig from "@widget-js/ssh-config";
|
|
73
|
-
import
|
|
74
|
-
import
|
|
75
|
-
import
|
|
76
|
-
import
|
|
77
|
-
import
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
console.log(chalk2.blue("\
|
|
210
|
-
await
|
|
211
|
-
console.log(chalk2.blue("\u4E0A\
|
|
212
|
-
await put("version/
|
|
213
|
-
console.log(chalk2.blue("\
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
export {
|
|
225
|
-
release_default as default
|
|
226
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
promptChecker_default
|
|
3
|
+
} from "./chunk-XPJ33Y5L.js";
|
|
4
|
+
import {
|
|
5
|
+
Utils
|
|
6
|
+
} from "./chunk-RDJH7Z4C.js";
|
|
7
|
+
|
|
8
|
+
// src/release/release.ts
|
|
9
|
+
import fs4 from "node:fs";
|
|
10
|
+
import path2 from "node:path";
|
|
11
|
+
import chalk2 from "chalk";
|
|
12
|
+
|
|
13
|
+
// src/release/update-zip.ts
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
import archiver from "archiver";
|
|
16
|
+
function zipDirectory(sourceDir, outPath, ignoreDir) {
|
|
17
|
+
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
18
|
+
const stream = fs.createWriteStream(outPath);
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
archive.glob("**/*", { cwd: sourceDir, ignore: ["node_modules/**"] }).on("error", (err) => reject(err)).pipe(stream);
|
|
21
|
+
stream.on("close", () => resolve());
|
|
22
|
+
archive.finalize();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var update_zip_default = zipDirectory;
|
|
26
|
+
|
|
27
|
+
// src/release/oss.ts
|
|
28
|
+
import fs2 from "node:fs";
|
|
29
|
+
import OSS from "ali-oss";
|
|
30
|
+
import chalk from "chalk";
|
|
31
|
+
var packageData = JSON.parse(fs2.readFileSync("./package.json").toString());
|
|
32
|
+
var AccessKeyID = packageData.oss?.id ?? "default";
|
|
33
|
+
var AccessKeySecret = packageData.oss?.secret ?? "default";
|
|
34
|
+
var headers = {
|
|
35
|
+
// 指定Object的存储类型。
|
|
36
|
+
"x-oss-storage-class": "Standard",
|
|
37
|
+
// 指定Object的访问权限。
|
|
38
|
+
"x-oss-object-acl": "public-read",
|
|
39
|
+
"x-oss-forbid-overwrite": "false",
|
|
40
|
+
"Cache-Control": "no-cache"
|
|
41
|
+
};
|
|
42
|
+
var clinet = new OSS({
|
|
43
|
+
// yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
|
|
44
|
+
region: "oss-cn-hangzhou",
|
|
45
|
+
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
|
|
46
|
+
accessKeyId: AccessKeyID,
|
|
47
|
+
accessKeySecret: AccessKeySecret,
|
|
48
|
+
bucket: "widget-fun"
|
|
49
|
+
});
|
|
50
|
+
async function put(ossPath, file) {
|
|
51
|
+
try {
|
|
52
|
+
const result = await clinet.put(ossPath, file, { headers });
|
|
53
|
+
console.log(chalk.green(`\u4E0A\u4F20\u6210\u529F\uFF1A${file}->${ossPath}`));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.log(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function copy(dist, src) {
|
|
59
|
+
try {
|
|
60
|
+
const result = await clinet.copy(dist, src, { headers });
|
|
61
|
+
console.log(chalk.green(`\u590D\u5236\u6210\u529F\uFF1A${src}->${dist}`));
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.error(e);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/release/ftp.ts
|
|
68
|
+
import path from "node:path";
|
|
69
|
+
import fs3 from "node:fs";
|
|
70
|
+
import os from "node:os";
|
|
71
|
+
import * as process from "node:process";
|
|
72
|
+
import SSHConfig from "@widget-js/ssh-config";
|
|
73
|
+
import Client from "ssh2-sftp-client";
|
|
74
|
+
import consola from "consola";
|
|
75
|
+
import inquirer from "inquirer";
|
|
76
|
+
import ora from "ora";
|
|
77
|
+
import { minimatch } from "minimatch";
|
|
78
|
+
async function checkParentDir(ftpClient, file, onMkdir) {
|
|
79
|
+
const dir = path.dirname(file);
|
|
80
|
+
const dirExists = await ftpClient.exists(dir);
|
|
81
|
+
if (!dirExists) {
|
|
82
|
+
onMkdir(dir);
|
|
83
|
+
await ftpClient.mkdir(dir, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function runSSH(sshConfig, releaseConfig) {
|
|
87
|
+
consola.info("run ssh:", sshConfig);
|
|
88
|
+
const answer = await inquirer.prompt([
|
|
89
|
+
{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }
|
|
90
|
+
]);
|
|
91
|
+
const ftpClient = new Client();
|
|
92
|
+
const port = sshConfig.Port;
|
|
93
|
+
const key = fs3.readFileSync(path.resolve(os.homedir(), ".ssh/id_rsa"));
|
|
94
|
+
const spinner = ora("Connecting");
|
|
95
|
+
try {
|
|
96
|
+
spinner.start();
|
|
97
|
+
await ftpClient.connect({
|
|
98
|
+
host: sshConfig.HostName,
|
|
99
|
+
port: port ? Number.parseInt(port) : 22,
|
|
100
|
+
username: sshConfig.User,
|
|
101
|
+
passphrase: answer.password,
|
|
102
|
+
privateKey: key
|
|
103
|
+
});
|
|
104
|
+
releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
|
|
105
|
+
for (const item of releaseConfig.fileMap) {
|
|
106
|
+
if (typeof item.src == "string") {
|
|
107
|
+
if (item.remoteCopy) {
|
|
108
|
+
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
109
|
+
spinner.warn(`Create Dir: ${dir}`);
|
|
110
|
+
});
|
|
111
|
+
const destExists = await ftpClient.exists(item.dest);
|
|
112
|
+
if (destExists) {
|
|
113
|
+
spinner.warn(`Delete exists file:${item.dest}`);
|
|
114
|
+
await ftpClient.delete(item.dest);
|
|
115
|
+
}
|
|
116
|
+
spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
|
|
117
|
+
await ftpClient.rcopy(item.src, item.dest);
|
|
118
|
+
} else {
|
|
119
|
+
const localFile = path.resolve(process.cwd(), item.src);
|
|
120
|
+
if (!item.remoteCopy && !fs3.existsSync(localFile)) {
|
|
121
|
+
spinner.warn(`Skip not exists file:${localFile}`);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (fs3.lstatSync(localFile).isDirectory()) {
|
|
125
|
+
spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
|
|
126
|
+
await ftpClient.uploadDir(localFile, item.dest, {
|
|
127
|
+
filter: (filePath, isDirectory) => {
|
|
128
|
+
if (item.ignorePattern && !isDirectory) {
|
|
129
|
+
const fileName = path.basename(filePath);
|
|
130
|
+
if (minimatch(fileName, item.ignorePattern)) {
|
|
131
|
+
spinner.warn(`Skip file:${filePath}`);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
140
|
+
spinner.succeed(`Create Dir: ${dir}`);
|
|
141
|
+
});
|
|
142
|
+
spinner.info(`Uploading File: ${localFile} -> ${item.dest}`);
|
|
143
|
+
await ftpClient.put(localFile, item.dest);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
spinner.succeed("Files uploaded!");
|
|
151
|
+
await ftpClient.end();
|
|
152
|
+
} catch (e) {
|
|
153
|
+
spinner.fail(`Connection error:${e}`);
|
|
154
|
+
await ftpClient.end();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function ftpUpload(releaseFile = "release.json") {
|
|
158
|
+
const releaseJsonFilePath = path.join(process.cwd(), releaseFile);
|
|
159
|
+
const packageVersion = Utils.getPackageVersion();
|
|
160
|
+
consola.info("Package Version:", packageVersion);
|
|
161
|
+
const releaseJson = fs3.readFileSync(releaseJsonFilePath).toString().replaceAll("${version}", packageVersion);
|
|
162
|
+
const releaseConfig = JSON.parse(releaseJson);
|
|
163
|
+
const sshConfigFile = path.resolve(os.homedir(), ".ssh/config");
|
|
164
|
+
consola.info("SSH Config File Path:", sshConfigFile);
|
|
165
|
+
const sshConfigs = SSHConfig.parse(fs3.readFileSync(sshConfigFile).toString());
|
|
166
|
+
for (const host of releaseConfig.ftpConfig.host) {
|
|
167
|
+
const sshConfig = sshConfigs.compute(host);
|
|
168
|
+
if (!sshConfig) {
|
|
169
|
+
consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
await runSSH(sshConfig, releaseConfig);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/release/release.ts
|
|
177
|
+
async function release(options) {
|
|
178
|
+
if (options.type == "ftp") {
|
|
179
|
+
await ftpUpload(options.file);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const packageJSON = JSON.parse(fs4.readFileSync("package.json", "utf-8"));
|
|
183
|
+
const changelogJSON = JSON.parse(fs4.readFileSync("changelog.json", "utf-8"));
|
|
184
|
+
const version = packageJSON.version;
|
|
185
|
+
const changelog = changelogJSON[version];
|
|
186
|
+
const needUpdateElectron = await promptChecker_default({
|
|
187
|
+
type: "confirm",
|
|
188
|
+
name: "electron",
|
|
189
|
+
message: chalk2.blue("\u7528\u6237\u662F\u5426\u9700\u8981\u66F4\u65B0Electron?")
|
|
190
|
+
});
|
|
191
|
+
const versionInfo = {
|
|
192
|
+
version,
|
|
193
|
+
releaseNote: changelog,
|
|
194
|
+
updateElectron: needUpdateElectron,
|
|
195
|
+
updateNodeModule: false,
|
|
196
|
+
updateWindowsApi: false,
|
|
197
|
+
downloadLink: ""
|
|
198
|
+
};
|
|
199
|
+
let installerPath = path2.join(`./dist/widgets-${version}-setup-win-x64.exe`);
|
|
200
|
+
if (!fs4.existsSync(installerPath)) {
|
|
201
|
+
installerPath = path2.join(`./dist/electron-${version}-setup-win-x64.exe`);
|
|
202
|
+
}
|
|
203
|
+
if (!fs4.existsSync(installerPath)) {
|
|
204
|
+
installerPath = path2.join(`./dist/app-${version}-setup-win-x64.exe`);
|
|
205
|
+
}
|
|
206
|
+
const updateZipPath = path2.join(`./dist/update.zip`);
|
|
207
|
+
console.log(chalk2.blue("\u538B\u7F29\u66F4\u65B0\u6587\u4EF6\u4E2D"));
|
|
208
|
+
await update_zip_default("./release", updateZipPath);
|
|
209
|
+
console.log(chalk2.blue("\u4E0A\u4F20installer.exe\u5230OSS"));
|
|
210
|
+
await put("version/installer.exe", installerPath);
|
|
211
|
+
console.log(chalk2.blue("\u4E0A\u4F20update.zip\u5230OSS"));
|
|
212
|
+
await put("version/update.zip", updateZipPath);
|
|
213
|
+
console.log(chalk2.blue("\u66F4\u65B0\u7248\u672C\u4FE1\u606F"));
|
|
214
|
+
versionInfo.downloadLink = "https://widget-fun.oss-cn-hangzhou.aliyuncs.com/version/update.zip";
|
|
215
|
+
const versionJSON = JSON.stringify(versionInfo, null, 2);
|
|
216
|
+
await put("version/version.json", Buffer.from(versionJSON));
|
|
217
|
+
await Promise.all([copy(`version/history/${version}.exe`, "version/installer.exe"), copy(`version/history/update-${version}.zip`, "version/update.zip")]);
|
|
218
|
+
console.log(chalk2.yellow(versionJSON));
|
|
219
|
+
}
|
|
220
|
+
var release_default = release;
|
|
221
|
+
export {
|
|
222
|
+
release_default as default
|
|
223
|
+
};
|
package/package.json
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widget-js/cli",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "24.1.1-beta.1",
|
|
5
|
+
"private": false,
|
|
5
6
|
"author": "Neo Fu",
|
|
6
7
|
"license": "MIT",
|
|
7
|
-
"
|
|
8
|
+
"main": "lib/index.js",
|
|
8
9
|
"bin": {
|
|
9
10
|
"widget": "lib/index.js"
|
|
10
11
|
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
14
|
-
},
|
|
15
12
|
"engines": {
|
|
16
13
|
"node": "^12.0.0 || >= 14.0.0"
|
|
17
14
|
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@types/archiver": "^5.3.1",
|
|
20
20
|
"@types/gradient-string": "^1.1.2",
|
|
21
21
|
"@vue/cli-shared-utils": "^5.0.8",
|
|
22
|
+
"@widget-js/core": "^0.11.20",
|
|
22
23
|
"@widget-js/ssh-config": "^4.2.1",
|
|
24
|
+
"@widget-js/vue3": "^0.11.20",
|
|
23
25
|
"ali-oss": "^6.17.1",
|
|
24
26
|
"archiver": "^5.3.1",
|
|
25
27
|
"chalk": "^4.1.2",
|
|
@@ -29,19 +31,16 @@
|
|
|
29
31
|
"dirname-filename-esm": "^1.1.1",
|
|
30
32
|
"ejs": "^3.1.8",
|
|
31
33
|
"figlet": "^1.5.2",
|
|
32
|
-
"gradient-string": "^2.0.2",
|
|
33
34
|
"inquirer": "^8.0.0",
|
|
34
35
|
"minimatch": "^9.0.3",
|
|
35
36
|
"ora": "^6.2.0",
|
|
36
37
|
"package-json": "^8.1.0",
|
|
37
38
|
"prettier": "^3.1.1",
|
|
38
|
-
"semver": "^7.
|
|
39
|
+
"semver": "^7.5.2",
|
|
39
40
|
"shelljs": "^0.8.5",
|
|
40
41
|
"ssh2-sftp-client": "^9.1.0",
|
|
41
42
|
"ws": "^8.11.0",
|
|
42
|
-
"@widget-js/
|
|
43
|
-
"@widget-js/vue3": "^0.11.20",
|
|
44
|
-
"@widget-js/utils": "0.10.21"
|
|
43
|
+
"@widget-js/utils": "24.1.1-beta.1"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@types/ali-oss": "^6.16.7",
|
|
@@ -49,10 +48,13 @@
|
|
|
49
48
|
"@types/figlet": "^1.5.5",
|
|
50
49
|
"@types/inquirer": "latest",
|
|
51
50
|
"@types/jest": "^29.2.3",
|
|
51
|
+
"@types/minimist": "^1.2.5",
|
|
52
52
|
"@types/node": "^18.11.13",
|
|
53
53
|
"@types/semver": "^7.5.0",
|
|
54
54
|
"@types/shelljs": "latest",
|
|
55
55
|
"@types/ssh2-sftp-client": "^9.0.1",
|
|
56
|
+
"@widget-js/vite-plugin-widget": "^1.2.8",
|
|
57
|
+
"gradient-string": "^2.0.2",
|
|
56
58
|
"jest": "^29.5.0",
|
|
57
59
|
"pinst": "^3.0.0",
|
|
58
60
|
"rimraf": "^4.4.1",
|
|
@@ -65,8 +67,7 @@
|
|
|
65
67
|
"vue-router": "^4.2.5",
|
|
66
68
|
"webpack": "^5.75.0",
|
|
67
69
|
"webpack-cli": "^5.0.0",
|
|
68
|
-
"@widget-js/
|
|
69
|
-
"@widget-js/core": "0.11.21",
|
|
70
|
+
"@widget-js/core": "0.11.20",
|
|
70
71
|
"@widget-js/vue3": "^0.11.20"
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"widget:init": "node ./lib/index.js init",
|
|
79
80
|
"widget:create": "npm run build && node ./lib/index.js create",
|
|
80
81
|
"widget:local": "npm run build && node ./lib/index.js dependencies -t local",
|
|
81
|
-
"
|
|
82
|
+
"build:publish": "npm run build && npm run pnpm:publish",
|
|
83
|
+
"pnpm:publish": "pnpm publish --no-git-checks"
|
|
82
84
|
}
|
|
83
85
|
}
|
package/src/build/build.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
+
import { exec } from 'node:child_process'
|
|
1
2
|
import ora from 'ora'
|
|
2
|
-
import {exec} from 'child_process'
|
|
3
3
|
import consola from 'consola'
|
|
4
4
|
|
|
5
5
|
export function build() {
|
|
6
6
|
const preloadSpinner = ora('Preload').start()
|
|
7
7
|
const mainSpinner = ora('Main').start()
|
|
8
|
-
|
|
8
|
+
// @ts-expect-error
|
|
9
9
|
const build = exec('npm run build:preload').on('close', () => {
|
|
10
10
|
consola.success('done')
|
|
11
11
|
})
|
|
12
|
-
|
|
13
|
-
build.stdout.on('data', data => {
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
build.stdout.on('data', (data) => {
|
|
14
14
|
consola.log('data', data)
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// @ts-expect-error
|
|
18
18
|
exec('npm run build:main', (error, stdout, stderr) => {
|
|
19
19
|
if (error) {
|
|
20
|
-
consola.error(
|
|
20
|
+
consola.error(`error: ${error}`)
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
|
-
consola.log(
|
|
24
|
-
consola.log(
|
|
23
|
+
consola.log(`stdout: ${stdout}`)
|
|
24
|
+
consola.log(`stderr: ${typeof stderr}`)
|
|
25
25
|
})
|
|
26
26
|
.on('message', () => {
|
|
27
27
|
consola.log('on-message')
|