vite-plugin-deploy-ftp 0.0.5 → 0.0.7
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 +10 -5
- package/dist/index.mjs +10 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -88,7 +88,14 @@ function vitePluginDeployFtp(option) {
|
|
|
88
88
|
`\u5DF2\u8FDE\u63A5 ${import_chalk.default.green(`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + uploadPath)}`)}`
|
|
89
89
|
);
|
|
90
90
|
if (fileList.length) {
|
|
91
|
-
await
|
|
91
|
+
const isBackFiles = await (0, import_prompts.select)({
|
|
92
|
+
message: "\u662F\u5426\u5907\u4EFD\u8FDC\u7A0B\u6587\u4EF6",
|
|
93
|
+
choices: ["\u5426", "\u662F"],
|
|
94
|
+
default: "\u5426"
|
|
95
|
+
});
|
|
96
|
+
if (isBackFiles === "\u662F") {
|
|
97
|
+
await createBackupFile(client, uploadPath, protocol, other);
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
const uploadFileSpinner = (0, import_ora.default)("\u4E0A\u4F20\u4E2D...").start();
|
|
94
101
|
await client.uploadFromDir(outDir, uploadPath);
|
|
@@ -133,13 +140,11 @@ async function createBackupFile(client, dir, protocol, other) {
|
|
|
133
140
|
archive.directory(localDir, false);
|
|
134
141
|
await archive.finalize();
|
|
135
142
|
backupSpinner.text = `\u538B\u7F29\u5B8C\u6210, \u51C6\u5907\u4E0A\u4F20 ${import_chalk.default.yellow(
|
|
136
|
-
`\u76EE\u5F55: ==> ${
|
|
143
|
+
`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + dir + "/" + fileName)}`
|
|
137
144
|
)}`;
|
|
138
145
|
await client.uploadFrom(zipFilePath, (0, import_vite.normalizePath)(`${dir}/${fileName}`));
|
|
139
146
|
backupSpinner.succeed(
|
|
140
|
-
`\u5907\u4EFD\u6210\u529F ${import_chalk.default.green(
|
|
141
|
-
`\u76EE\u5F55: ==> ${(0, import_vite.normalizePath)(`${protocol + (0, import_vite.normalizePath)(other + dir + "/" + fileName)}`)}`
|
|
142
|
-
)}`
|
|
147
|
+
`\u5907\u4EFD\u6210\u529F ${import_chalk.default.green(`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + dir + "/" + fileName)}`)}`
|
|
143
148
|
);
|
|
144
149
|
import_node_fs.default.rmSync(`./__temp`, { recursive: true });
|
|
145
150
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -54,7 +54,14 @@ function vitePluginDeployFtp(option) {
|
|
|
54
54
|
`\u5DF2\u8FDE\u63A5 ${chalk.green(`\u76EE\u5F55: ==> ${protocol + normalizePath(other + uploadPath)}`)}`
|
|
55
55
|
);
|
|
56
56
|
if (fileList.length) {
|
|
57
|
-
|
|
57
|
+
const isBackFiles = await select({
|
|
58
|
+
message: "\u662F\u5426\u5907\u4EFD\u8FDC\u7A0B\u6587\u4EF6",
|
|
59
|
+
choices: ["\u5426", "\u662F"],
|
|
60
|
+
default: "\u5426"
|
|
61
|
+
});
|
|
62
|
+
if (isBackFiles === "\u662F") {
|
|
63
|
+
await createBackupFile(client, uploadPath, protocol, other);
|
|
64
|
+
}
|
|
58
65
|
}
|
|
59
66
|
const uploadFileSpinner = ora("\u4E0A\u4F20\u4E2D...").start();
|
|
60
67
|
await client.uploadFromDir(outDir, uploadPath);
|
|
@@ -99,13 +106,11 @@ async function createBackupFile(client, dir, protocol, other) {
|
|
|
99
106
|
archive.directory(localDir, false);
|
|
100
107
|
await archive.finalize();
|
|
101
108
|
backupSpinner.text = `\u538B\u7F29\u5B8C\u6210, \u51C6\u5907\u4E0A\u4F20 ${chalk.yellow(
|
|
102
|
-
`\u76EE\u5F55: ==> ${
|
|
109
|
+
`\u76EE\u5F55: ==> ${protocol + normalizePath(other + dir + "/" + fileName)}`
|
|
103
110
|
)}`;
|
|
104
111
|
await client.uploadFrom(zipFilePath, normalizePath(`${dir}/${fileName}`));
|
|
105
112
|
backupSpinner.succeed(
|
|
106
|
-
`\u5907\u4EFD\u6210\u529F ${chalk.green(
|
|
107
|
-
`\u76EE\u5F55: ==> ${normalizePath(`${protocol + normalizePath(other + dir + "/" + fileName)}`)}`
|
|
108
|
-
)}`
|
|
113
|
+
`\u5907\u4EFD\u6210\u529F ${chalk.green(`\u76EE\u5F55: ==> ${protocol + normalizePath(other + dir + "/" + fileName)}`)}`
|
|
109
114
|
);
|
|
110
115
|
fs.rmSync(`./__temp`, { recursive: true });
|
|
111
116
|
}
|