@kvell007/embed-labs-cli 0.1.0-alpha.68 → 0.1.0-alpha.69
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 +51 -6
- package/dist/index.js.map +1 -1
- package/dist/local-toolchain.js +55 -3
- package/dist/local-toolchain.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -103,7 +103,7 @@ const LOCAL_TOOLCHAIN_INSTALLED_USAGE = "Usage: embed local toolchain installed
|
|
|
103
103
|
const LOCAL_TOOLCHAIN_LATEST_USAGE = "Usage: embed local toolchain latest [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--json]";
|
|
104
104
|
const LOCAL_TOOLCHAIN_CURRENT_USAGE = "Usage: embed local toolchain current [--install-root <path>] [--json]";
|
|
105
105
|
const LOCAL_TOOLCHAIN_INSTALL_USAGE = "Usage: embed local toolchain install [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--mode minimal|runtime|compile|qt|firmware|full|images] [--force] [--json]\nDefault source: the production download channel at download.embedboard.com.";
|
|
106
|
-
const LOCAL_TOOLCHAIN_UNINSTALL_USAGE = "Usage: embed local toolchain uninstall --board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor [--install-root <path>] [--json]";
|
|
106
|
+
const LOCAL_TOOLCHAIN_UNINSTALL_USAGE = "Usage: embed local toolchain uninstall --board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor [--install-root <path>] [--yes|--force] [--json]";
|
|
107
107
|
const LOCAL_TOOLCHAIN_VALIDATE_USAGE = "Usage: embed local toolchain validate [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--release-root <path>] [--mode minimal|runtime|compile|qt|firmware|full|images] [--json]";
|
|
108
108
|
const LOCAL_WSL_STATUS_USAGE = "Usage: embed local wsl status [--json]";
|
|
109
109
|
const LOCAL_WSL_INSTALL_USAGE = "Usage: embed local wsl install [--distribution Ubuntu] [--no-launch true|false] [--web-download true|false] [--timeout-ms 600000] [--json]";
|
|
@@ -2075,7 +2075,7 @@ async function installOpenCodePlugin(parsed, context) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
await mkdir(join(targetRoot, "plugins"), { recursive: true });
|
|
2077
2077
|
const packagePath = await prepareOpenCodePackageForInstall(targetRoot, source.data.packagePath);
|
|
2078
|
-
const npmResult = await runLocalProcess(
|
|
2078
|
+
const npmResult = await runLocalProcess(npmCommand(), [
|
|
2079
2079
|
"install",
|
|
2080
2080
|
"--prefix",
|
|
2081
2081
|
targetRoot,
|
|
@@ -2167,7 +2167,7 @@ async function resolveOpenCodePluginSource(context) {
|
|
|
2167
2167
|
remediation: "Run from the Embed-Labs-Cloud repo root or pass --release-dir pointing to a plugin release directory."
|
|
2168
2168
|
});
|
|
2169
2169
|
}
|
|
2170
|
-
const packed = await runLocalProcess(
|
|
2170
|
+
const packed = await runLocalProcess(npmCommand(), ["pack", packagePath, "--pack-destination", context.tempDir, "--json"]);
|
|
2171
2171
|
if (packed.code !== 0) {
|
|
2172
2172
|
return fail("opencode_plugin_pack_failed", "npm pack failed while preparing the OpenCode plugin source package.", {
|
|
2173
2173
|
details: {
|
|
@@ -3361,7 +3361,8 @@ async function pathExists(pathValue) {
|
|
|
3361
3361
|
}
|
|
3362
3362
|
async function runLocalProcess(command, args) {
|
|
3363
3363
|
return await new Promise((resolveProcess) => {
|
|
3364
|
-
const
|
|
3364
|
+
const launcher = localProcessLauncher(command, args);
|
|
3365
|
+
const child = spawn(launcher.command, launcher.args, {
|
|
3365
3366
|
cwd: process.cwd(),
|
|
3366
3367
|
env: process.env,
|
|
3367
3368
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -3384,6 +3385,50 @@ async function runLocalProcess(command, args) {
|
|
|
3384
3385
|
});
|
|
3385
3386
|
});
|
|
3386
3387
|
}
|
|
3388
|
+
function npmCommand() {
|
|
3389
|
+
return platform() === "win32" ? "npm.cmd" : "npm";
|
|
3390
|
+
}
|
|
3391
|
+
function localProcessLauncher(command, args) {
|
|
3392
|
+
if (platform() !== "win32" || !/\.(?:cmd|bat)$/i.test(command)) {
|
|
3393
|
+
return { command, args };
|
|
3394
|
+
}
|
|
3395
|
+
return {
|
|
3396
|
+
command: process.env.ComSpec || "cmd.exe",
|
|
3397
|
+
args: ["/d", "/s", "/c", windowsCommandLine([command, ...args])]
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3400
|
+
function windowsCommandLine(args) {
|
|
3401
|
+
return args.map(windowsQuoteArg).join(" ");
|
|
3402
|
+
}
|
|
3403
|
+
function windowsQuoteArg(arg) {
|
|
3404
|
+
if (arg.length > 0 && !/[\s"]/u.test(arg)) {
|
|
3405
|
+
return arg;
|
|
3406
|
+
}
|
|
3407
|
+
let quoted = "\"";
|
|
3408
|
+
let backslashes = 0;
|
|
3409
|
+
for (const char of arg) {
|
|
3410
|
+
if (char === "\\") {
|
|
3411
|
+
backslashes += 1;
|
|
3412
|
+
continue;
|
|
3413
|
+
}
|
|
3414
|
+
if (char === "\"") {
|
|
3415
|
+
quoted += "\\".repeat((backslashes * 2) + 1);
|
|
3416
|
+
quoted += "\"";
|
|
3417
|
+
backslashes = 0;
|
|
3418
|
+
continue;
|
|
3419
|
+
}
|
|
3420
|
+
if (backslashes > 0) {
|
|
3421
|
+
quoted += "\\".repeat(backslashes);
|
|
3422
|
+
backslashes = 0;
|
|
3423
|
+
}
|
|
3424
|
+
quoted += char;
|
|
3425
|
+
}
|
|
3426
|
+
if (backslashes > 0) {
|
|
3427
|
+
quoted += "\\".repeat(backslashes * 2);
|
|
3428
|
+
}
|
|
3429
|
+
quoted += "\"";
|
|
3430
|
+
return quoted;
|
|
3431
|
+
}
|
|
3387
3432
|
async function parseErrorResponse(response) {
|
|
3388
3433
|
const text = await response.text();
|
|
3389
3434
|
if (!text.trim()) {
|
|
@@ -5931,7 +5976,7 @@ function localToolchainInstallRequest(parsed) {
|
|
|
5931
5976
|
};
|
|
5932
5977
|
}
|
|
5933
5978
|
function localToolchainUninstallRequest(parsed) {
|
|
5934
|
-
const unknownFlag = firstUnknownFlag(parsed, ["json", "board", "board-id", "install-root"]);
|
|
5979
|
+
const unknownFlag = firstUnknownFlag(parsed, ["json", "board", "board-id", "install-root", "yes", "force"]);
|
|
5935
5980
|
if (unknownFlag) {
|
|
5936
5981
|
return `Unknown flag --${unknownFlag}. ${LOCAL_TOOLCHAIN_UNINSTALL_USAGE}`;
|
|
5937
5982
|
}
|
|
@@ -8542,7 +8587,7 @@ Usage:
|
|
|
8542
8587
|
embed local toolchain current [--install-root <path>] [--json]
|
|
8543
8588
|
embed local toolchain install [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--channel stable] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--mode minimal|runtime|compile|qt|firmware|full|images] [--force] [--json]
|
|
8544
8589
|
Defaults to the production download channel at download.embedboard.com.
|
|
8545
|
-
embed local toolchain uninstall --board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor [--install-root <path>] [--json]
|
|
8590
|
+
embed local toolchain uninstall --board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor [--install-root <path>] [--yes|--force] [--json]
|
|
8546
8591
|
embed local toolchain validate [--board taishanpi-1m-rk3566|pico2w-rp2350-monitor|coloreasypico2-rp2350-monitor] [--release-root <path>] [--mode minimal|runtime|compile|qt|firmware|full|images] [--json]
|
|
8547
8592
|
embed local compile taishanpi --source <main.c|main.cpp> --output <artifact> [--release-root <path>] [--account <account_id>] [--json]
|
|
8548
8593
|
embed local build qt-smoke --build-dir <dir> [--source <qt-cmake-dir>] [--target-name <executable>] [--release-root <path>] [--account <account_id>] [--json]
|