@lark-apaas/openclaw-dev-cli 0.1.7 → 0.1.9
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 +55 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4074,8 +4074,7 @@ var import_node_child_process2 = require("child_process");
|
|
|
4074
4074
|
// src/constants.ts
|
|
4075
4075
|
var TEMPLATE_MAP = {
|
|
4076
4076
|
html: "template-html",
|
|
4077
|
-
"
|
|
4078
|
-
nextjs: "template-nextjs-fullstack"
|
|
4077
|
+
"vite-react": "template-vite-react"
|
|
4079
4078
|
};
|
|
4080
4079
|
var TEMPLATE_TYPES = Object.keys(TEMPLATE_MAP);
|
|
4081
4080
|
var RENAME_FILES = {
|
|
@@ -4185,7 +4184,14 @@ async function genArtifactUploadCredential(appId, commitID = "latest") {
|
|
|
4185
4184
|
if (!body.data?.accessKeyID || !body.data?.secretAccessKey || !body.data?.sessionToken) {
|
|
4186
4185
|
throw new Error("genArtifactUploadCredential returned incomplete credentials");
|
|
4187
4186
|
}
|
|
4188
|
-
|
|
4187
|
+
if (!body.data.buckets?.deploy || !body.data.buckets?.resource) {
|
|
4188
|
+
throw new Error("genArtifactUploadCredential returned incomplete bucket info");
|
|
4189
|
+
}
|
|
4190
|
+
logResponse("genArtifactUploadCredential", {
|
|
4191
|
+
accessKeyID: body.data.accessKeyID,
|
|
4192
|
+
expiredTime: body.data.expiredTime,
|
|
4193
|
+
buckets: body.data.buckets
|
|
4194
|
+
});
|
|
4189
4195
|
return body.data;
|
|
4190
4196
|
}
|
|
4191
4197
|
async function getDefaultBucketId(appId) {
|
|
@@ -7205,6 +7211,10 @@ async function pullTemplate(options) {
|
|
|
7205
7211
|
}
|
|
7206
7212
|
}
|
|
7207
7213
|
replaceInFile(import_node_path11.default.join(targetDir, "package.json"), "{{projectName}}", projectName);
|
|
7214
|
+
const indexHtml = import_node_path11.default.join(targetDir, "client", "index.html");
|
|
7215
|
+
if (import_node_fs8.default.existsSync(indexHtml)) {
|
|
7216
|
+
replaceInFile(indexHtml, "{{projectName}}", projectName);
|
|
7217
|
+
}
|
|
7208
7218
|
return { version };
|
|
7209
7219
|
}
|
|
7210
7220
|
function pullFromLocal(localPath, templateDir, targetDir) {
|
|
@@ -7353,9 +7363,35 @@ Available: ${TEMPLATE_TYPES.join(", ")}`
|
|
|
7353
7363
|
console.log(` Directory: ${projectDir}`);
|
|
7354
7364
|
console.log(` App ID: ${appId}`);
|
|
7355
7365
|
console.log(` Template: ${template}`);
|
|
7366
|
+
printDirectoryTree(projectDir);
|
|
7356
7367
|
});
|
|
7357
7368
|
}
|
|
7358
7369
|
};
|
|
7370
|
+
var TREE_IGNORE = /* @__PURE__ */ new Set(["node_modules", ".git", ".turbo", ".next"]);
|
|
7371
|
+
var TREE_MAX_DEPTH = 2;
|
|
7372
|
+
function printDirectoryTree(projectDir) {
|
|
7373
|
+
console.log("\nProject structure:");
|
|
7374
|
+
console.log(import_node_path12.default.basename(projectDir) || projectDir);
|
|
7375
|
+
walk(projectDir, "", 0);
|
|
7376
|
+
}
|
|
7377
|
+
function walk(current, prefix, depth) {
|
|
7378
|
+
if (depth >= TREE_MAX_DEPTH) return;
|
|
7379
|
+
const entries = import_node_fs9.default.readdirSync(current, { withFileTypes: true }).filter((entry) => !TREE_IGNORE.has(entry.name)).sort((a, b2) => {
|
|
7380
|
+
if (a.isDirectory() !== b2.isDirectory()) {
|
|
7381
|
+
return a.isDirectory() ? -1 : 1;
|
|
7382
|
+
}
|
|
7383
|
+
return a.name.localeCompare(b2.name);
|
|
7384
|
+
});
|
|
7385
|
+
entries.forEach((entry, index) => {
|
|
7386
|
+
const isLast = index === entries.length - 1;
|
|
7387
|
+
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7388
|
+
const nextPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
7389
|
+
console.log(`${prefix}${connector}${entry.name}${entry.isDirectory() ? "/" : ""}`);
|
|
7390
|
+
if (entry.isDirectory()) {
|
|
7391
|
+
walk(import_node_path12.default.join(current, entry.name), nextPrefix, depth + 1);
|
|
7392
|
+
}
|
|
7393
|
+
});
|
|
7394
|
+
}
|
|
7359
7395
|
|
|
7360
7396
|
// src/commands/link/index.ts
|
|
7361
7397
|
var import_node_path13 = __toESM(require("path"));
|
|
@@ -7451,6 +7487,15 @@ var import_node_os2 = __toESM(require("os"));
|
|
|
7451
7487
|
var import_node_path15 = __toESM(require("path"));
|
|
7452
7488
|
var import_node_child_process3 = require("child_process");
|
|
7453
7489
|
var LOG_PREFIX = "[upload]";
|
|
7490
|
+
function normalizeBucket(bucket) {
|
|
7491
|
+
const withScheme = bucket.startsWith("tos://") ? bucket : `tos://${bucket}`;
|
|
7492
|
+
return withScheme.replace(/\/+$/, "");
|
|
7493
|
+
}
|
|
7494
|
+
function buildDestUrl(bucket, suffix) {
|
|
7495
|
+
const base = normalizeBucket(bucket);
|
|
7496
|
+
const normalizedSuffix = suffix.replace(/^\/+/, "");
|
|
7497
|
+
return `${base}/${normalizedSuffix}`;
|
|
7498
|
+
}
|
|
7454
7499
|
var TOSUTIL_DEFAULTS = {
|
|
7455
7500
|
endpoint: "tos-cn-beijing.volces.com",
|
|
7456
7501
|
region: "cn-beijing"
|
|
@@ -7536,15 +7581,20 @@ function uploadOutput(options) {
|
|
|
7536
7581
|
const { projectDir, appId, version, validated, artifactCredential, preUploadResult } = options;
|
|
7537
7582
|
const distDir = import_node_path15.default.join(projectDir, DIST_DIR);
|
|
7538
7583
|
const tosutilPath = resolveTosutilPath();
|
|
7584
|
+
const deployBucket = artifactCredential.buckets?.deploy;
|
|
7585
|
+
const resourceBucket = artifactCredential.buckets?.resource;
|
|
7586
|
+
if (!deployBucket || !resourceBucket) {
|
|
7587
|
+
throw new Error("Artifact credential missing bucket info");
|
|
7588
|
+
}
|
|
7539
7589
|
if (validated.hasOutput) {
|
|
7540
7590
|
const localPath = import_node_path15.default.join(distDir, OUTPUT_DIR);
|
|
7541
|
-
const destUrl =
|
|
7591
|
+
const destUrl = buildDestUrl(deployBucket, `${appId}/${version}/`);
|
|
7542
7592
|
console.error(`${LOG_PREFIX} Uploading output (artifact credential)...`);
|
|
7543
7593
|
uploadWithCredential(tosutilPath, localPath, destUrl, artifactCredential, "output");
|
|
7544
7594
|
}
|
|
7545
7595
|
if (validated.hasOutputResource) {
|
|
7546
7596
|
const localPath = import_node_path15.default.join(distDir, OUTPUT_RESOURCE_DIR);
|
|
7547
|
-
const destUrl =
|
|
7597
|
+
const destUrl = buildDestUrl(resourceBucket, `${appId}/${version}/client/`);
|
|
7548
7598
|
console.error(`${LOG_PREFIX} Uploading output_resource (artifact credential)...`);
|
|
7549
7599
|
uploadWithCredential(tosutilPath, localPath, destUrl, artifactCredential, "resource");
|
|
7550
7600
|
}
|