@widget-js/cli 1.0.14 → 1.0.15
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/lib/index.cjs +6 -1
- package/lib/index.js +6 -1
- package/package.json +1 -1
- package/release.json +2 -4
- package/src/release/ftp.ts +6 -1
package/lib/index.cjs
CHANGED
|
@@ -339,13 +339,18 @@ function ftpUpload() {
|
|
|
339
339
|
passphrase: answer.password,
|
|
340
340
|
privateKey: key
|
|
341
341
|
});
|
|
342
|
-
releaseConfig.fileMap.sort((it1, it2) => it1.order - it2.order);
|
|
342
|
+
releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
|
|
343
343
|
for (let item of releaseConfig.fileMap) {
|
|
344
344
|
if (typeof item.src == "string") {
|
|
345
345
|
if (item.remoteCopy) {
|
|
346
346
|
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
347
347
|
spinner.warn(`Create Dir: ${dir}`);
|
|
348
348
|
});
|
|
349
|
+
let destExists = await ftpClient.exists(item.dest);
|
|
350
|
+
if (destExists) {
|
|
351
|
+
spinner.warn(`Delete exists file:${item.dest}`);
|
|
352
|
+
await ftpClient.delete(item.dest);
|
|
353
|
+
}
|
|
349
354
|
spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
|
|
350
355
|
await ftpClient.rcopy(item.src, item.dest);
|
|
351
356
|
} else {
|
package/lib/index.js
CHANGED
|
@@ -318,13 +318,18 @@ function ftpUpload() {
|
|
|
318
318
|
passphrase: answer.password,
|
|
319
319
|
privateKey: key
|
|
320
320
|
});
|
|
321
|
-
releaseConfig.fileMap.sort((it1, it2) => it1.order - it2.order);
|
|
321
|
+
releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
|
|
322
322
|
for (let item of releaseConfig.fileMap) {
|
|
323
323
|
if (typeof item.src == "string") {
|
|
324
324
|
if (item.remoteCopy) {
|
|
325
325
|
await checkParentDir(ftpClient, item.dest, (dir) => {
|
|
326
326
|
spinner.warn(`Create Dir: ${dir}`);
|
|
327
327
|
});
|
|
328
|
+
let destExists = await ftpClient.exists(item.dest);
|
|
329
|
+
if (destExists) {
|
|
330
|
+
spinner.warn(`Delete exists file:${item.dest}`);
|
|
331
|
+
await ftpClient.delete(item.dest);
|
|
332
|
+
}
|
|
328
333
|
spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
|
|
329
334
|
await ftpClient.rcopy(item.src, item.dest);
|
|
330
335
|
} else {
|
package/package.json
CHANGED
package/release.json
CHANGED
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
"fileMap": [
|
|
3
3
|
{
|
|
4
4
|
"src": ".gitignore",
|
|
5
|
-
"dest": "/www/wwwroot/template/aa/.gitignore"
|
|
6
|
-
"order": 0
|
|
5
|
+
"dest": "/www/wwwroot/template/aa/.gitignore"
|
|
7
6
|
},
|
|
8
7
|
{
|
|
9
8
|
"src": "/www/wwwroot/template/aa/.gitignore",
|
|
10
9
|
"dest": "/www/wwwroot/template/bbb/.gitignorexxx",
|
|
11
|
-
"remoteCopy": true
|
|
12
|
-
"order": 1
|
|
10
|
+
"remoteCopy": true
|
|
13
11
|
}
|
|
14
12
|
],
|
|
15
13
|
"ftpConfig": {
|
package/src/release/ftp.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function ftpUpload() {
|
|
|
51
51
|
passphrase: answer.password,
|
|
52
52
|
privateKey: key,
|
|
53
53
|
})
|
|
54
|
-
releaseConfig.fileMap.sort((it1, it2) => it1.order - it2.order)
|
|
54
|
+
releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0))
|
|
55
55
|
// upload files
|
|
56
56
|
for (let item of releaseConfig.fileMap) {
|
|
57
57
|
if (typeof item.src == 'string') {
|
|
@@ -59,6 +59,11 @@ export function ftpUpload() {
|
|
|
59
59
|
await checkParentDir(ftpClient, item.dest, dir => {
|
|
60
60
|
spinner.warn(`Create Dir: ${dir}`)
|
|
61
61
|
})
|
|
62
|
+
let destExists = await ftpClient.exists(item.dest)
|
|
63
|
+
if (destExists) {
|
|
64
|
+
spinner.warn(`Delete exists file:${item.dest}`)
|
|
65
|
+
await ftpClient.delete(item.dest)
|
|
66
|
+
}
|
|
62
67
|
spinner.info(`Copying File: ${item.src} -> ${item.dest}`)
|
|
63
68
|
await ftpClient.rcopy(item.src, item.dest)
|
|
64
69
|
} else {
|