@widget-js/cli 24.1.1-beta.62 → 24.1.1-beta.63
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/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ program.command("publish").description("Publish widget package with developer ke
|
|
|
35
35
|
var typeOption = new Option("-t, --type <type>").choices(["ftp", "oss"]);
|
|
36
36
|
var fileOption = new Option("-f, --file <file>");
|
|
37
37
|
program.command("release").description("\u901A\u8FC7FTP/OSS\u53D1\u5E03\u6587\u4EF6\uFF0C\u4EC5\u5185\u90E8\u4F7F\u7528").addOption(typeOption).addOption(fileOption).action(async (options) => {
|
|
38
|
-
const release = await import("./release-
|
|
38
|
+
const release = await import("./release-3DQATEM5.js");
|
|
39
39
|
await release.default(options);
|
|
40
40
|
});
|
|
41
41
|
program.parse(process.argv);
|
|
@@ -88,6 +88,8 @@ import consola2 from "consola";
|
|
|
88
88
|
import inquirer from "inquirer";
|
|
89
89
|
import ora from "ora";
|
|
90
90
|
import { minimatch } from "minimatch";
|
|
91
|
+
import fg from "fast-glob";
|
|
92
|
+
var { globSync } = fg;
|
|
91
93
|
async function checkParentDir(ftpClient, file, onMkdir) {
|
|
92
94
|
const dir = path.dirname(file);
|
|
93
95
|
const dirExists = await ftpClient.exists(dir);
|
|
@@ -116,49 +118,64 @@ async function runSSH(sshConfig, releaseConfig) {
|
|
|
116
118
|
});
|
|
117
119
|
releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
|
|
118
120
|
for (const item of releaseConfig.fileMap) {
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (!item.remoteCopy && !fs3.existsSync(localFile)) {
|
|
134
|
-
spinner.warn(`Skip not exists file:${localFile}`);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (fs3.lstatSync(localFile).isDirectory()) {
|
|
138
|
-
spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
|
|
139
|
-
await ftpClient.uploadDir(localFile, item.dest, {
|
|
140
|
-
filter: (filePath, isDirectory) => {
|
|
141
|
-
if (item.ignorePattern && !isDirectory) {
|
|
142
|
-
const fileName = path.basename(filePath);
|
|
143
|
-
if (minimatch(fileName, item.ignorePattern)) {
|
|
144
|
-
spinner.warn(`Skip file:${filePath}`);
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
} else {
|
|
121
|
+
if (item.pattern) {
|
|
122
|
+
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
123
|
+
spinner.succeed(`Create Dir: ${dir}`);
|
|
124
|
+
});
|
|
125
|
+
const files = globSync(item.pattern, { absolute: true, ignore: item.ignore, cwd: process.cwd() });
|
|
126
|
+
for (const file of files) {
|
|
127
|
+
spinner.info(`Uploading File: ${file} -> ${item.dest}`);
|
|
128
|
+
await ftpClient.put(file, item.dest);
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (item.src) {
|
|
133
|
+
if (typeof item.src == "string") {
|
|
134
|
+
if (item.remoteCopy) {
|
|
152
135
|
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
153
|
-
spinner.
|
|
136
|
+
spinner.warn(`Create Dir: ${dir}`);
|
|
154
137
|
});
|
|
155
|
-
|
|
156
|
-
|
|
138
|
+
const destExists = await ftpClient.exists(item.dest);
|
|
139
|
+
if (destExists) {
|
|
140
|
+
spinner.warn(`Delete exists file:${item.dest}`);
|
|
141
|
+
await ftpClient.delete(item.dest);
|
|
142
|
+
}
|
|
143
|
+
spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
|
|
144
|
+
await ftpClient.rcopy(item.src, item.dest);
|
|
145
|
+
} else {
|
|
146
|
+
const localFile = path.resolve(process.cwd(), item.src);
|
|
147
|
+
if (!item.remoteCopy && !fs3.existsSync(localFile)) {
|
|
148
|
+
spinner.warn(`Skip not exists file:${localFile}`);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (fs3.lstatSync(localFile).isDirectory()) {
|
|
152
|
+
spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
|
|
153
|
+
await ftpClient.uploadDir(localFile, item.dest, {
|
|
154
|
+
filter: (filePath, isDirectory) => {
|
|
155
|
+
if (item.ignore && !isDirectory) {
|
|
156
|
+
const fileName = path.basename(filePath);
|
|
157
|
+
if (item.ignore.some((ignorePattern) => minimatch(fileName, ignorePattern))) {
|
|
158
|
+
spinner.warn(`Skip file:${filePath}`);
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
167
|
+
spinner.succeed(`Create Dir: ${dir}`);
|
|
168
|
+
});
|
|
169
|
+
spinner.info(`Uploading File: ${localFile} -> ${item.dest}`);
|
|
170
|
+
await ftpClient.put(localFile, item.dest);
|
|
171
|
+
}
|
|
157
172
|
}
|
|
173
|
+
} else {
|
|
174
|
+
await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
|
|
158
175
|
}
|
|
159
|
-
|
|
160
|
-
await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
|
|
176
|
+
continue;
|
|
161
177
|
}
|
|
178
|
+
throw new Error("pattern or src is required in fileMap item");
|
|
162
179
|
}
|
|
163
180
|
spinner.succeed("Files uploaded!");
|
|
164
181
|
await ftpClient.end();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widget-js/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "24.1.1-beta.
|
|
4
|
+
"version": "24.1.1-beta.63",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Neo Fu",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"shelljs": "^0.8.5",
|
|
45
45
|
"ssh2-sftp-client": "^9.1.0",
|
|
46
46
|
"ws": "^8.11.0",
|
|
47
|
-
"@widget-js/core": "24.1.1-beta.62",
|
|
48
47
|
"@widget-js/utils": "24.1.1-beta.62",
|
|
49
|
-
"@widget-js/vue3": "24.1.1-beta.
|
|
48
|
+
"@widget-js/vue3": "24.1.1-beta.65",
|
|
49
|
+
"@widget-js/core": "24.1.1-beta.63"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@antfu/eslint-config": "^2.21.1",
|
|
@@ -55,26 +55,23 @@
|
|
|
55
55
|
"@types/figlet": "^1.5.5",
|
|
56
56
|
"@types/gradient-string": "^1.1.2",
|
|
57
57
|
"@types/inquirer": "latest",
|
|
58
|
-
"@types/jest": "^29.2.3",
|
|
59
58
|
"@types/minimist": "^1.2.5",
|
|
60
59
|
"@types/node": "^18.11.13",
|
|
61
60
|
"@types/semver": "^7.5.0",
|
|
62
61
|
"@types/shelljs": "latest",
|
|
63
62
|
"@types/ssh2-sftp-client": "^9.0.1",
|
|
64
63
|
"eslint": "8.48.0",
|
|
65
|
-
"jest": "^29.5.0",
|
|
66
|
-
"pinst": "^3.0.0",
|
|
67
64
|
"rimraf": "^4.4.1",
|
|
68
|
-
"ts-jest": "^29.0.3",
|
|
69
65
|
"ts-loader": "^9.4.1",
|
|
70
66
|
"ts-node": "^10.9.1",
|
|
71
67
|
"tsup": "^6.5.0",
|
|
72
68
|
"typescript": "^5.2.2",
|
|
73
|
-
"
|
|
69
|
+
"vite": "^5.0.5",
|
|
70
|
+
"vitest": "^3.2.4",
|
|
74
71
|
"vue-router": "^4.2.5",
|
|
75
|
-
"@widget-js/vite-plugin-widget": "24.1.1-beta.
|
|
76
|
-
"@widget-js/core": "24.1.1-beta.
|
|
77
|
-
"@widget-js/vue3": "24.1.1-beta.
|
|
72
|
+
"@widget-js/vite-plugin-widget": "24.1.1-beta.63",
|
|
73
|
+
"@widget-js/core": "24.1.1-beta.63",
|
|
74
|
+
"@widget-js/vue3": "24.1.1-beta.65"
|
|
78
75
|
},
|
|
79
76
|
"scripts": {
|
|
80
77
|
"build": "tsup-node src/index.ts",
|