@lark-apaas/openclaw-scripts-diagnose-cli 0.1.1-alpha.19 → 0.1.1-alpha.20
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.cjs +12 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1403,48 +1403,38 @@ function copyStartupScripts(srcDir, configDir, log) {
|
|
|
1403
1403
|
function installExtensions(configDir, log) {
|
|
1404
1404
|
const ossUrl = EXTENSIONS_OSS_URL;
|
|
1405
1405
|
const targetExtDir = node_path.default.join(configDir, "extensions");
|
|
1406
|
-
const
|
|
1407
|
-
const
|
|
1408
|
-
|
|
1409
|
-
const tarPath = node_path.default.join(tmpBase, "extensions.tar.gz");
|
|
1410
|
-
node_fs.default.mkdirSync(stagingDir, { recursive: true });
|
|
1411
|
-
node_fs.default.mkdirSync(backupDir, { recursive: true });
|
|
1406
|
+
const tmpDir = node_path.default.join(configDir, `.ext-reset-tmp-${Date.now()}`);
|
|
1407
|
+
const tarPath = node_path.default.join(tmpDir, "extensions.tar.gz");
|
|
1408
|
+
node_fs.default.mkdirSync(tmpDir, { recursive: true });
|
|
1412
1409
|
try {
|
|
1413
1410
|
log(`downloading extensions from ${ossUrl}`);
|
|
1414
1411
|
const dlStart = Date.now();
|
|
1415
1412
|
shell(`curl -fsSL '${ossUrl}' -o '${tarPath}'`, 5 * 6e4);
|
|
1416
1413
|
const size = node_fs.default.statSync(tarPath).size;
|
|
1417
1414
|
log(`download done in ${Date.now() - dlStart}ms (${(size / 1024 / 1024).toFixed(1)}MB)`);
|
|
1418
|
-
shell(`tar -xzf '${tarPath}' -C '${
|
|
1419
|
-
const stagedExtDir = node_path.default.join(
|
|
1415
|
+
shell(`tar -xzf '${tarPath}' -C '${tmpDir}'`, 6e4);
|
|
1416
|
+
const stagedExtDir = node_path.default.join(tmpDir, "extensions");
|
|
1420
1417
|
if (!node_fs.default.existsSync(stagedExtDir)) throw new Error("tar.gz does not contain an extensions/ directory");
|
|
1421
1418
|
const extNames = node_fs.default.readdirSync(stagedExtDir).filter((name) => node_fs.default.statSync(node_path.default.join(stagedExtDir, name)).isDirectory());
|
|
1422
1419
|
log(`archive contains ${extNames.length} extension(s): ${extNames.join(", ")}`);
|
|
1423
|
-
if (!node_fs.default.existsSync(targetExtDir)) node_fs.default.mkdirSync(targetExtDir, { recursive: true });
|
|
1424
1420
|
for (const name of extNames) {
|
|
1425
1421
|
const target = node_path.default.join(targetExtDir, name);
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
}
|
|
1432
|
-
node_fs.default.renameSync(staged, target);
|
|
1422
|
+
if (node_fs.default.existsSync(target)) node_fs.default.rmSync(target, {
|
|
1423
|
+
recursive: true,
|
|
1424
|
+
force: true
|
|
1425
|
+
});
|
|
1426
|
+
node_fs.default.renameSync(node_path.default.join(stagedExtDir, name), target);
|
|
1433
1427
|
log(` ${name}: installed`);
|
|
1434
1428
|
}
|
|
1435
1429
|
const packinfo = node_path.default.join(stagedExtDir, ".packinfo.json");
|
|
1436
1430
|
if (node_fs.default.existsSync(packinfo)) {
|
|
1437
|
-
const info = node_fs.default.readFileSync(packinfo, "utf-8");
|
|
1438
1431
|
node_fs.default.copyFileSync(packinfo, node_path.default.join(targetExtDir, ".packinfo.json"));
|
|
1439
|
-
log(`packinfo: ${
|
|
1432
|
+
log(`packinfo: ${node_fs.default.readFileSync(packinfo, "utf-8").trim()}`);
|
|
1440
1433
|
}
|
|
1441
1434
|
log("extensions installed from OSS successfully");
|
|
1442
1435
|
} finally {
|
|
1443
1436
|
try {
|
|
1444
|
-
node_fs.default.
|
|
1445
|
-
} catch {}
|
|
1446
|
-
try {
|
|
1447
|
-
node_fs.default.rmSync(stagingDir, {
|
|
1437
|
+
node_fs.default.rmSync(tmpDir, {
|
|
1448
1438
|
recursive: true,
|
|
1449
1439
|
force: true
|
|
1450
1440
|
});
|
package/package.json
CHANGED