vite-plugin-deploy-oss 1.0.3 → 1.1.0
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 +23 -14
- package/dist/index.mjs +23 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,8 +118,6 @@ function vitePluginDeployOss(option) {
|
|
|
118
118
|
const results = [];
|
|
119
119
|
const totalFiles = files.length;
|
|
120
120
|
let completed = 0;
|
|
121
|
-
process.stdout.write("\x1B[2J\x1B[0f");
|
|
122
|
-
console.log("\n");
|
|
123
121
|
const spinner = (0, import_ora.default)("\u51C6\u5907\u4E0A\u4F20...").start();
|
|
124
122
|
const updateSpinner = (currentFile) => {
|
|
125
123
|
const percentage = Math.round(completed / totalFiles * 100);
|
|
@@ -159,6 +157,7 @@ ${bar} 100% (${totalFiles}/${totalFiles})`);
|
|
|
159
157
|
},
|
|
160
158
|
config(config) {
|
|
161
159
|
if (!open || buildFailed) return;
|
|
160
|
+
process.stdout.write("\x1B[2J\x1B[0f");
|
|
162
161
|
const validationErrors = validateOptions();
|
|
163
162
|
if (validationErrors.length > 0) {
|
|
164
163
|
console.log(`${import_chalk.default.red("\u2717 \u914D\u7F6E\u9519\u8BEF:")}
|
|
@@ -185,30 +184,40 @@ ${validationErrors.map((err) => ` - ${err}`).join("\n")}`);
|
|
|
185
184
|
console.log(`${import_chalk.default.yellow("\u26A0 \u6CA1\u6709\u627E\u5230\u9700\u8981\u4E0A\u4F20\u7684\u6587\u4EF6")}`);
|
|
186
185
|
return;
|
|
187
186
|
}
|
|
187
|
+
process.stdout.write("\x1B[2J\x1B[0f");
|
|
188
|
+
console.log(import_chalk.default.cyan(`
|
|
189
|
+
\u{1F680} OSS \u90E8\u7F72\u5F00\u59CB
|
|
190
|
+
`));
|
|
191
|
+
console.log(`${import_chalk.default.gray("Bucket:")} ${import_chalk.default.green(bucket)}`);
|
|
192
|
+
console.log(`${import_chalk.default.gray("Region:")} ${import_chalk.default.green(region)}`);
|
|
193
|
+
console.log(`${import_chalk.default.gray("Source:")} ${import_chalk.default.yellow(outDir)}`);
|
|
194
|
+
console.log(`${import_chalk.default.gray("Target:")} ${import_chalk.default.yellow(uploadDir)}`);
|
|
195
|
+
console.log(`${import_chalk.default.gray("Files:")} ${import_chalk.default.blue(files.length)}
|
|
196
|
+
`);
|
|
188
197
|
try {
|
|
189
198
|
const results = await uploadFilesInBatches(client, files, concurrency);
|
|
190
199
|
const successCount = results.filter((r) => r.success).length;
|
|
191
200
|
const failedCount = results.length - successCount;
|
|
192
201
|
const duration = ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
193
|
-
|
|
202
|
+
console.log("\n" + import_chalk.default.gray("\u2500".repeat(40)) + "\n");
|
|
203
|
+
if (failedCount === 0) {
|
|
204
|
+
console.log(`${import_chalk.default.green("\u{1F389} \u90E8\u7F72\u6210\u529F!")}`);
|
|
205
|
+
} else {
|
|
206
|
+
console.log(`${import_chalk.default.yellow("\u26A0 \u90E8\u7F72\u5B8C\u6210\u4F46\u5B58\u5728\u9519\u8BEF")}`);
|
|
207
|
+
}
|
|
208
|
+
console.log(`
|
|
209
|
+
${import_chalk.default.gray("\u7EDF\u8BA1:")}`);
|
|
210
|
+
console.log(` ${import_chalk.default.green("\u2714")} \u6210\u529F: ${import_chalk.default.bold(successCount)}`);
|
|
194
211
|
if (failedCount > 0) {
|
|
195
|
-
|
|
212
|
+
console.log(` ${import_chalk.default.red("\u2717")} \u5931\u8D25: ${import_chalk.default.bold(failedCount)}`);
|
|
196
213
|
}
|
|
197
|
-
console.log(
|
|
214
|
+
console.log(` ${import_chalk.default.blue("\u23F1")} \u8017\u65F6: ${import_chalk.default.bold(duration)}s`);
|
|
215
|
+
console.log("");
|
|
198
216
|
try {
|
|
199
217
|
(0, import_delete_empty.default)((0, import_node_path.resolve)(outDir));
|
|
200
218
|
} catch (error) {
|
|
201
219
|
console.warn(`${import_chalk.default.yellow("\u26A0 \u6E05\u7406\u7A7A\u76EE\u5F55\u5931\u8D25:")} ${error}`);
|
|
202
220
|
}
|
|
203
|
-
if (failedCount === 0) {
|
|
204
|
-
console.log(`
|
|
205
|
-
${import_chalk.default.green("\u{1F389} \u6240\u6709\u6587\u4EF6\u4E0A\u4F20\u5B8C\u6210!")}
|
|
206
|
-
`);
|
|
207
|
-
} else {
|
|
208
|
-
console.log(`
|
|
209
|
-
${import_chalk.default.yellow("\u26A0 \u90E8\u5206\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7")}
|
|
210
|
-
`);
|
|
211
|
-
}
|
|
212
221
|
} catch (error) {
|
|
213
222
|
console.log(`
|
|
214
223
|
${import_chalk.default.red("\u274C \u4E0A\u4F20\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF:")} ${error}
|
package/dist/index.mjs
CHANGED
|
@@ -84,8 +84,6 @@ function vitePluginDeployOss(option) {
|
|
|
84
84
|
const results = [];
|
|
85
85
|
const totalFiles = files.length;
|
|
86
86
|
let completed = 0;
|
|
87
|
-
process.stdout.write("\x1B[2J\x1B[0f");
|
|
88
|
-
console.log("\n");
|
|
89
87
|
const spinner = ora("\u51C6\u5907\u4E0A\u4F20...").start();
|
|
90
88
|
const updateSpinner = (currentFile) => {
|
|
91
89
|
const percentage = Math.round(completed / totalFiles * 100);
|
|
@@ -125,6 +123,7 @@ ${bar} 100% (${totalFiles}/${totalFiles})`);
|
|
|
125
123
|
},
|
|
126
124
|
config(config) {
|
|
127
125
|
if (!open || buildFailed) return;
|
|
126
|
+
process.stdout.write("\x1B[2J\x1B[0f");
|
|
128
127
|
const validationErrors = validateOptions();
|
|
129
128
|
if (validationErrors.length > 0) {
|
|
130
129
|
console.log(`${chalk.red("\u2717 \u914D\u7F6E\u9519\u8BEF:")}
|
|
@@ -151,30 +150,40 @@ ${validationErrors.map((err) => ` - ${err}`).join("\n")}`);
|
|
|
151
150
|
console.log(`${chalk.yellow("\u26A0 \u6CA1\u6709\u627E\u5230\u9700\u8981\u4E0A\u4F20\u7684\u6587\u4EF6")}`);
|
|
152
151
|
return;
|
|
153
152
|
}
|
|
153
|
+
process.stdout.write("\x1B[2J\x1B[0f");
|
|
154
|
+
console.log(chalk.cyan(`
|
|
155
|
+
\u{1F680} OSS \u90E8\u7F72\u5F00\u59CB
|
|
156
|
+
`));
|
|
157
|
+
console.log(`${chalk.gray("Bucket:")} ${chalk.green(bucket)}`);
|
|
158
|
+
console.log(`${chalk.gray("Region:")} ${chalk.green(region)}`);
|
|
159
|
+
console.log(`${chalk.gray("Source:")} ${chalk.yellow(outDir)}`);
|
|
160
|
+
console.log(`${chalk.gray("Target:")} ${chalk.yellow(uploadDir)}`);
|
|
161
|
+
console.log(`${chalk.gray("Files:")} ${chalk.blue(files.length)}
|
|
162
|
+
`);
|
|
154
163
|
try {
|
|
155
164
|
const results = await uploadFilesInBatches(client, files, concurrency);
|
|
156
165
|
const successCount = results.filter((r) => r.success).length;
|
|
157
166
|
const failedCount = results.length - successCount;
|
|
158
167
|
const duration = ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
159
|
-
|
|
168
|
+
console.log("\n" + chalk.gray("\u2500".repeat(40)) + "\n");
|
|
169
|
+
if (failedCount === 0) {
|
|
170
|
+
console.log(`${chalk.green("\u{1F389} \u90E8\u7F72\u6210\u529F!")}`);
|
|
171
|
+
} else {
|
|
172
|
+
console.log(`${chalk.yellow("\u26A0 \u90E8\u7F72\u5B8C\u6210\u4F46\u5B58\u5728\u9519\u8BEF")}`);
|
|
173
|
+
}
|
|
174
|
+
console.log(`
|
|
175
|
+
${chalk.gray("\u7EDF\u8BA1:")}`);
|
|
176
|
+
console.log(` ${chalk.green("\u2714")} \u6210\u529F: ${chalk.bold(successCount)}`);
|
|
160
177
|
if (failedCount > 0) {
|
|
161
|
-
|
|
178
|
+
console.log(` ${chalk.red("\u2717")} \u5931\u8D25: ${chalk.bold(failedCount)}`);
|
|
162
179
|
}
|
|
163
|
-
console.log(
|
|
180
|
+
console.log(` ${chalk.blue("\u23F1")} \u8017\u65F6: ${chalk.bold(duration)}s`);
|
|
181
|
+
console.log("");
|
|
164
182
|
try {
|
|
165
183
|
deleteEmpty(resolve(outDir));
|
|
166
184
|
} catch (error) {
|
|
167
185
|
console.warn(`${chalk.yellow("\u26A0 \u6E05\u7406\u7A7A\u76EE\u5F55\u5931\u8D25:")} ${error}`);
|
|
168
186
|
}
|
|
169
|
-
if (failedCount === 0) {
|
|
170
|
-
console.log(`
|
|
171
|
-
${chalk.green("\u{1F389} \u6240\u6709\u6587\u4EF6\u4E0A\u4F20\u5B8C\u6210!")}
|
|
172
|
-
`);
|
|
173
|
-
} else {
|
|
174
|
-
console.log(`
|
|
175
|
-
${chalk.yellow("\u26A0 \u90E8\u5206\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7")}
|
|
176
|
-
`);
|
|
177
|
-
}
|
|
178
187
|
} catch (error) {
|
|
179
188
|
console.log(`
|
|
180
189
|
${chalk.red("\u274C \u4E0A\u4F20\u8FC7\u7A0B\u4E2D\u53D1\u751F\u9519\u8BEF:")} ${error}
|