@lark-apaas/fullstack-cli 1.1.16-beta.10 → 1.1.16-beta.11
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 +24 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7351,6 +7351,7 @@ function camelToKebab(str) {
|
|
|
7351
7351
|
|
|
7352
7352
|
// src/commands/build/upload-static.handler.ts
|
|
7353
7353
|
import * as fs25 from "fs";
|
|
7354
|
+
import * as os2 from "os";
|
|
7354
7355
|
import * as path21 from "path";
|
|
7355
7356
|
import { execFileSync } from "child_process";
|
|
7356
7357
|
function readCredentialsFromEnv() {
|
|
@@ -7409,16 +7410,25 @@ async function uploadStatic(options) {
|
|
|
7409
7410
|
({ AccessKeyID: accessKeyID, SecretAccessKey: secretAccessKey, SessionToken: sessionToken } = uploadCredential);
|
|
7410
7411
|
}
|
|
7411
7412
|
console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7413
|
+
const confPath = path21.join(os2.tmpdir(), `.tosutilconfig-static-${process.pid}`);
|
|
7414
|
+
fs25.writeFileSync(confPath, "");
|
|
7415
|
+
try {
|
|
7416
|
+
console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
|
|
7417
|
+
configureTosutil(resolvedTosutil, confPath, {
|
|
7418
|
+
endpoint,
|
|
7419
|
+
region,
|
|
7420
|
+
accessKeyID,
|
|
7421
|
+
secretAccessKey,
|
|
7422
|
+
sessionToken
|
|
7423
|
+
});
|
|
7424
|
+
console.error(`${LOG_PREFIX} \u4E0A\u4F20 ${resolvedStaticDir} -> ${uploadPrefix}`);
|
|
7425
|
+
uploadToTos(resolvedTosutil, confPath, resolvedStaticDir, uploadPrefix);
|
|
7426
|
+
} finally {
|
|
7427
|
+
try {
|
|
7428
|
+
fs25.unlinkSync(confPath);
|
|
7429
|
+
} catch {
|
|
7430
|
+
}
|
|
7431
|
+
}
|
|
7422
7432
|
console.error(`${LOG_PREFIX} tosutil \u4E0A\u4F20\u5B8C\u6210`);
|
|
7423
7433
|
console.error(`${LOG_PREFIX} \u8C03\u7528 callbackStatic (uploadID: ${uploadID})...`);
|
|
7424
7434
|
const callbackResp = await uploadStaticAttachmentCallback(appId, bucketId, { uploadID });
|
|
@@ -7459,18 +7469,18 @@ async function fetchPreUpload(appId, bucketId) {
|
|
|
7459
7469
|
}
|
|
7460
7470
|
return response;
|
|
7461
7471
|
}
|
|
7462
|
-
function configureTosutil(tosutilPath, config) {
|
|
7472
|
+
function configureTosutil(tosutilPath, confPath, config) {
|
|
7463
7473
|
const { endpoint, region, accessKeyID, secretAccessKey, sessionToken } = config;
|
|
7464
7474
|
execFileSync(
|
|
7465
7475
|
tosutilPath,
|
|
7466
|
-
["config", "-e", endpoint, "-i", accessKeyID, "-k", secretAccessKey, "-t", sessionToken, "-re", region],
|
|
7476
|
+
["config", "-conf", confPath, "-e", endpoint, "-i", accessKeyID, "-k", secretAccessKey, "-t", sessionToken, "-re", region],
|
|
7467
7477
|
{ stdio: "pipe" }
|
|
7468
7478
|
);
|
|
7469
7479
|
}
|
|
7470
|
-
function uploadToTos(tosutilPath, sourceDir, destUrl) {
|
|
7480
|
+
function uploadToTos(tosutilPath, confPath, sourceDir, destUrl) {
|
|
7471
7481
|
execFileSync(
|
|
7472
7482
|
tosutilPath,
|
|
7473
|
-
["cp", sourceDir, destUrl, "-r", "-flat", "-j", "5", "-p", "3", "-ps", "10485760", "-f"],
|
|
7483
|
+
["cp", "-conf", confPath, sourceDir, destUrl, "-r", "-flat", "-j", "5", "-p", "3", "-ps", "10485760", "-f"],
|
|
7474
7484
|
{ stdio: "inherit" }
|
|
7475
7485
|
);
|
|
7476
7486
|
}
|