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