ai-yuca 1.2.2 → 1.2.4
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/package.json +1 -1
- package/dist/src/deploy.js +4 -3
- package/dist/src/uploadWithConfig.js +0 -2
- package/package.json +1 -1
- package/src/deploy.ts +5 -6
- package/src/uploadWithConfig.ts +2 -2
package/dist/package.json
CHANGED
package/dist/src/deploy.js
CHANGED
|
@@ -272,6 +272,7 @@ async function deployFiles(options) {
|
|
|
272
272
|
const sourcePath = options.source || uploadConfig.sourcePath;
|
|
273
273
|
const htmlFiles = filterHtmlFiles(sourcePath);
|
|
274
274
|
const cdnFiles = htmlFiles.map(file => ({ key: path.relative(sourcePath, file) }));
|
|
275
|
+
const storageClient = (0, upload_1.createStorageClient)(options.keyFile ? { keyFilename: options.keyFile } : {});
|
|
275
276
|
console.log('📁 定义基础路径...');
|
|
276
277
|
const prefix = `${config.aws.prefix}/${config.upload.s3Static}`;
|
|
277
278
|
if (htmlFiles.length === 0) {
|
|
@@ -289,7 +290,7 @@ async function deployFiles(options) {
|
|
|
289
290
|
bucketName: uploadConfig.bucketName,
|
|
290
291
|
filePath: file,
|
|
291
292
|
destination,
|
|
292
|
-
storageClient
|
|
293
|
+
storageClient,
|
|
293
294
|
enableCompression: true
|
|
294
295
|
}).then(result => ({ result, relativePath, destination }));
|
|
295
296
|
});
|
|
@@ -326,7 +327,7 @@ async function deployFiles(options) {
|
|
|
326
327
|
bucketName: uploadConfig.bucketName,
|
|
327
328
|
filePath: tempVersionFile,
|
|
328
329
|
destination: versionConfigPath,
|
|
329
|
-
storageClient
|
|
330
|
+
storageClient,
|
|
330
331
|
enableCompression: false
|
|
331
332
|
});
|
|
332
333
|
}
|
|
@@ -358,7 +359,7 @@ async function deployFiles(options) {
|
|
|
358
359
|
bucketName: uploadConfig.bucketName,
|
|
359
360
|
filePath: tempVersionListFile,
|
|
360
361
|
destination: versionListPath,
|
|
361
|
-
storageClient
|
|
362
|
+
storageClient,
|
|
362
363
|
enableCompression: false
|
|
363
364
|
});
|
|
364
365
|
}
|
|
@@ -147,7 +147,6 @@ async function uploadFilesWithConfig(options = {}) {
|
|
|
147
147
|
if (enableCache && cacheManager) {
|
|
148
148
|
// 获取所有需要处理的文件
|
|
149
149
|
const allFiles = await getFilesToProcess(sourcePath, recursive);
|
|
150
|
-
console.log('allFiles', allFiles);
|
|
151
150
|
for (const filePath of allFiles) {
|
|
152
151
|
if (cacheManager.isFileUploaded(filePath)) {
|
|
153
152
|
const cachedUrl = cacheManager.getUploadedUrl(filePath);
|
|
@@ -191,7 +190,6 @@ async function uploadFilesWithConfig(options = {}) {
|
|
|
191
190
|
}
|
|
192
191
|
// 执行批量上传
|
|
193
192
|
const uploadSource = enableCache && filesToUpload.length > 0 ? filesToUpload : sourcePath;
|
|
194
|
-
console.log('uploadSource', uploadSource);
|
|
195
193
|
const result = await (0, upload_1.uploadFiles)({
|
|
196
194
|
bucketName,
|
|
197
195
|
sourcePath: uploadSource,
|
package/package.json
CHANGED
package/src/deploy.ts
CHANGED
|
@@ -256,7 +256,6 @@ export async function deployFiles(options: DeployCommandOptions): Promise<Deploy
|
|
|
256
256
|
// 1. 配置校验阶段
|
|
257
257
|
console.log('📋 验证配置文件...');
|
|
258
258
|
const config = validateConfig(options.config);
|
|
259
|
-
|
|
260
259
|
// 2. 执行upload-config阶段
|
|
261
260
|
console.log('📤 执行upload-config上传配置文件...');
|
|
262
261
|
let files: string[] = [];
|
|
@@ -289,7 +288,7 @@ export async function deployFiles(options: DeployCommandOptions): Promise<Deploy
|
|
|
289
288
|
const sourcePath = options.source || uploadConfig.sourcePath;
|
|
290
289
|
const htmlFiles = filterHtmlFiles(sourcePath);
|
|
291
290
|
const cdnFiles = htmlFiles.map(file => ({ key: path.relative(sourcePath, file) }));
|
|
292
|
-
|
|
291
|
+
const storageClient = createStorageClient(options.keyFile ? { keyFilename: options.keyFile } : {});
|
|
293
292
|
console.log('📁 定义基础路径...');
|
|
294
293
|
const prefix = `${config.aws.prefix}/${config.upload.s3Static}`;
|
|
295
294
|
|
|
@@ -311,7 +310,7 @@ export async function deployFiles(options: DeployCommandOptions): Promise<Deploy
|
|
|
311
310
|
bucketName: uploadConfig.bucketName,
|
|
312
311
|
filePath: file,
|
|
313
312
|
destination,
|
|
314
|
-
storageClient
|
|
313
|
+
storageClient,
|
|
315
314
|
enableCompression: true
|
|
316
315
|
}).then(result => ({ result, relativePath, destination }));
|
|
317
316
|
});
|
|
@@ -353,7 +352,7 @@ export async function deployFiles(options: DeployCommandOptions): Promise<Deploy
|
|
|
353
352
|
bucketName: uploadConfig.bucketName,
|
|
354
353
|
filePath: tempVersionFile,
|
|
355
354
|
destination: versionConfigPath,
|
|
356
|
-
storageClient
|
|
355
|
+
storageClient,
|
|
357
356
|
enableCompression: false
|
|
358
357
|
});
|
|
359
358
|
} finally {
|
|
@@ -381,13 +380,13 @@ export async function deployFiles(options: DeployCommandOptions): Promise<Deploy
|
|
|
381
380
|
|
|
382
381
|
const tempVersionListFile = path.join(process.cwd(), `.temp-version-list-${cdnKey}.json`);
|
|
383
382
|
fs.writeFileSync(tempVersionListFile, JSON.stringify(versionList, null, 2));
|
|
384
|
-
|
|
383
|
+
|
|
385
384
|
try {
|
|
386
385
|
await uploadFile({
|
|
387
386
|
bucketName: uploadConfig.bucketName,
|
|
388
387
|
filePath: tempVersionListFile,
|
|
389
388
|
destination: versionListPath,
|
|
390
|
-
storageClient
|
|
389
|
+
storageClient,
|
|
391
390
|
enableCompression: false
|
|
392
391
|
});
|
|
393
392
|
} finally {
|
package/src/uploadWithConfig.ts
CHANGED
|
@@ -155,7 +155,7 @@ export async function uploadFilesWithConfig(options: UploadWithConfigOptions = {
|
|
|
155
155
|
if (enableCache && cacheManager) {
|
|
156
156
|
// 获取所有需要处理的文件
|
|
157
157
|
const allFiles = await getFilesToProcess(sourcePath, recursive);
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
for (const filePath of allFiles) {
|
|
160
160
|
if (cacheManager.isFileUploaded(filePath)) {
|
|
161
161
|
const cachedUrl = cacheManager.getUploadedUrl(filePath);
|
|
@@ -202,7 +202,7 @@ export async function uploadFilesWithConfig(options: UploadWithConfigOptions = {
|
|
|
202
202
|
|
|
203
203
|
// 执行批量上传
|
|
204
204
|
const uploadSource = enableCache && filesToUpload.length > 0 ? filesToUpload : sourcePath;
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
const result = await uploadFiles({
|
|
207
207
|
bucketName,
|
|
208
208
|
sourcePath: uploadSource,
|