@lark-apaas/fullstack-cli 1.1.28-alpha.18 → 1.1.28-alpha.19

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7364,7 +7364,7 @@ async function uploadStatic(options) {
7364
7364
  const {
7365
7365
  appId,
7366
7366
  staticDir = "shared/static",
7367
- tosutilPath = "/workspace/tosutil",
7367
+ tosutilPath = "tosutil",
7368
7368
  endpoint = "tos-cn-beijing.volces.com",
7369
7369
  region = "cn-beijing"
7370
7370
  } = options;
@@ -7377,9 +7377,10 @@ async function uploadStatic(options) {
7377
7377
  console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E3A\u7A7A: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
7378
7378
  return;
7379
7379
  }
7380
- if (!fs25.existsSync(tosutilPath)) {
7380
+ const resolvedTosutil = resolveTosutilPath(tosutilPath);
7381
+ if (!resolvedTosutil) {
7381
7382
  throw new Error(
7382
- `tosutil \u4E0D\u5B58\u5728: ${tosutilPath}\u3002\u8BF7\u786E\u4FDD\u6D41\u6C34\u7EBF\u5DF2\u5728"\u4EA7\u7269\u6253\u5305\u4E0A\u4F20"\u6B65\u9AA4\u4E2D\u4E0B\u8F7D tosutil\u3002`
7383
+ `tosutil \u4E0D\u5B58\u5728: ${tosutilPath}\u3002\u8BF7\u786E\u4FDD tosutil \u5DF2\u5B89\u88C5\u5728\u7CFB\u7EDF PATH \u4E2D\u6216\u901A\u8FC7 --tosutil-path \u6307\u5B9A\u8DEF\u5F84\u3002`
7383
7384
  );
7384
7385
  }
7385
7386
  let uploadPrefix;
@@ -7402,7 +7403,7 @@ async function uploadStatic(options) {
7402
7403
  }
7403
7404
  console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
7404
7405
  console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
7405
- configureTosutil(tosutilPath, {
7406
+ configureTosutil(resolvedTosutil, {
7406
7407
  endpoint,
7407
7408
  region,
7408
7409
  accessKeyID,
@@ -7410,7 +7411,7 @@ async function uploadStatic(options) {
7410
7411
  sessionToken
7411
7412
  });
7412
7413
  console.error(`${LOG_PREFIX} \u4E0A\u4F20 ${resolvedStaticDir} -> ${uploadPrefix}`);
7413
- uploadToTos(tosutilPath, resolvedStaticDir, uploadPrefix);
7414
+ uploadToTos(resolvedTosutil, resolvedStaticDir, uploadPrefix);
7414
7415
  console.error(`${LOG_PREFIX} tosutil \u4E0A\u4F20\u5B8C\u6210`);
7415
7416
  console.error(`${LOG_PREFIX} \u8C03\u7528 callbackStatic (uploadID: ${uploadID})...`);
7416
7417
  const callbackResp = await uploadStaticAttachmentCallback(appId, bucketId, { uploadID });
@@ -7426,6 +7427,17 @@ async function uploadStatic(options) {
7426
7427
  process.exit(1);
7427
7428
  }
7428
7429
  }
7430
+ function resolveTosutilPath(tosutilPath) {
7431
+ if (path21.isAbsolute(tosutilPath)) {
7432
+ return fs25.existsSync(tosutilPath) ? tosutilPath : null;
7433
+ }
7434
+ try {
7435
+ const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
7436
+ return resolved || null;
7437
+ } catch {
7438
+ return null;
7439
+ }
7440
+ }
7429
7441
  async function fetchPreUpload(appId, bucketId) {
7430
7442
  const response = await preUploadStaticAttachment(appId, bucketId);
7431
7443
  if (response.status_code !== "0") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.28-alpha.18",
3
+ "version": "1.1.28-alpha.19",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",