@kvell007/embed-labs-cli 0.1.0-alpha.78 → 0.1.0-alpha.79
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 +63 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
8
8
|
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { composeBootLogoPackage } from "./image-compose.js";
|
|
11
|
-
import { buildTaishanPiQtSmoke, compileTaishanPiSingleFile, currentLocalToolchain, installLocalToolchain, latestLocalToolchain, validateLocalToolchain } from "./local-toolchain.js";
|
|
11
|
+
import { buildTaishanPiQtSmoke, compileTaishanPiSingleFile, currentLocalToolchain, installLocalToolchain, latestLocalToolchain, uninstallLocalToolchain, validateLocalToolchain } from "./local-toolchain.js";
|
|
12
12
|
import { fail, ok } from "@embed-labs/protocol";
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
const CLI_MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -82,7 +82,8 @@ const BUILD_IMAGE_DTB_USAGE = "Usage: embed build image dtb --dtb <local.dtb|loc
|
|
|
82
82
|
const IMAGE_DTB_COMPOSE_USAGE = "Usage: embed image dtb compose --package <dtb-package.json> --base-image <boot.img|image.img> --output <image> [--manifest <manifest.json>] [--force] [--json]";
|
|
83
83
|
const LOCAL_TOOLCHAIN_LATEST_USAGE = "Usage: embed local toolchain latest [--board taishanpi-1m-rk3566] [--channel stable] [--metadata-root <path>] [--json]";
|
|
84
84
|
const LOCAL_TOOLCHAIN_CURRENT_USAGE = "Usage: embed local toolchain current [--install-root <path>] [--json]";
|
|
85
|
-
const LOCAL_TOOLCHAIN_INSTALL_USAGE = "Usage: embed local toolchain install [--board taishanpi-1m-rk3566] [--channel stable] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--force] [--json]\nDefault source: the production download channel at download.embedboard.com.";
|
|
85
|
+
const LOCAL_TOOLCHAIN_INSTALL_USAGE = "Usage: embed local toolchain install [--board taishanpi-1m-rk3566] [--channel stable] [--mode minimal|runtime|compile|qt|firmware|full|images] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--force] [--json]\nDefault source: the production download channel at download.embedboard.com.";
|
|
86
|
+
const LOCAL_TOOLCHAIN_UNINSTALL_USAGE = "Usage: embed local toolchain uninstall --board <board_id> [--install-root <path>] [--yes] [--json]";
|
|
86
87
|
const LOCAL_TOOLCHAIN_VALIDATE_USAGE = "Usage: embed local toolchain validate [--release-root <path>] [--json]";
|
|
87
88
|
const LOCAL_COMPILE_TAISHANPI_USAGE = "Usage: embed local compile taishanpi --source <main.c|main.cpp> --output <artifact> [--release-root <path>] [--account <account_id>] [--json]";
|
|
88
89
|
const LOCAL_BUILD_QT_SMOKE_USAGE = "Usage: embed local build qt-smoke --build-dir <dir> [--source <qt-smoke-dir>] [--release-root <path>] [--account <account_id>] [--json]";
|
|
@@ -535,6 +536,13 @@ async function main(argv) {
|
|
|
535
536
|
}
|
|
536
537
|
return output(parsed, ok(await installLocalToolchain(request)), renderLocalToolchainInstall);
|
|
537
538
|
}
|
|
539
|
+
if (action === "toolchain" && parsed.command[2] === "uninstall") {
|
|
540
|
+
const request = localToolchainUninstallRequest(parsed);
|
|
541
|
+
if (typeof request === "string") {
|
|
542
|
+
return output(parsed, fail("invalid_args", request), undefined, 2);
|
|
543
|
+
}
|
|
544
|
+
return output(parsed, ok(await uninstallLocalToolchain(request)), renderLocalToolchainUninstall);
|
|
545
|
+
}
|
|
538
546
|
if (action === "toolchain" && parsed.command[2] === "validate") {
|
|
539
547
|
const request = localToolchainValidateRequest(parsed);
|
|
540
548
|
if (typeof request === "string") {
|
|
@@ -560,6 +568,7 @@ async function main(argv) {
|
|
|
560
568
|
LOCAL_TOOLCHAIN_LATEST_USAGE,
|
|
561
569
|
LOCAL_TOOLCHAIN_CURRENT_USAGE,
|
|
562
570
|
LOCAL_TOOLCHAIN_INSTALL_USAGE,
|
|
571
|
+
LOCAL_TOOLCHAIN_UNINSTALL_USAGE,
|
|
563
572
|
LOCAL_TOOLCHAIN_VALIDATE_USAGE,
|
|
564
573
|
LOCAL_COMPILE_TAISHANPI_USAGE,
|
|
565
574
|
LOCAL_BUILD_QT_SMOKE_USAGE
|
|
@@ -4151,7 +4160,7 @@ function localToolchainCurrentRequest(parsed) {
|
|
|
4151
4160
|
return { installRoot: installRoot.value };
|
|
4152
4161
|
}
|
|
4153
4162
|
function localToolchainInstallRequest(parsed) {
|
|
4154
|
-
const unknownFlag = firstUnknownFlag(parsed, ["json", "board", "board-id", "channel", "metadata-root", "source-url", "source-release-root", "install-root", "force"]);
|
|
4163
|
+
const unknownFlag = firstUnknownFlag(parsed, ["json", "board", "board-id", "channel", "mode", "metadata-root", "source-url", "source-release-root", "install-root", "force"]);
|
|
4155
4164
|
if (unknownFlag) {
|
|
4156
4165
|
return `Unknown flag --${unknownFlag}. ${LOCAL_TOOLCHAIN_INSTALL_USAGE}`;
|
|
4157
4166
|
}
|
|
@@ -4165,6 +4174,9 @@ function localToolchainInstallRequest(parsed) {
|
|
|
4165
4174
|
const channel = optionalTrimmedStringFlag(parsed, "channel");
|
|
4166
4175
|
if (channel.error)
|
|
4167
4176
|
return channel.error;
|
|
4177
|
+
const mode = optionalTrimmedStringFlag(parsed, "mode");
|
|
4178
|
+
if (mode.error)
|
|
4179
|
+
return mode.error;
|
|
4168
4180
|
const metadataRoot = optionalTrimmedStringFlag(parsed, "metadata-root");
|
|
4169
4181
|
if (metadataRoot.error)
|
|
4170
4182
|
return metadataRoot.error;
|
|
@@ -4183,6 +4195,7 @@ function localToolchainInstallRequest(parsed) {
|
|
|
4183
4195
|
return {
|
|
4184
4196
|
boardId: board.value,
|
|
4185
4197
|
channel: channel.value,
|
|
4198
|
+
mode: mode.value,
|
|
4186
4199
|
metadataRoot: metadataRoot.value,
|
|
4187
4200
|
sourceUrl: sourceUrl.value,
|
|
4188
4201
|
sourceReleaseRoot: sourceReleaseRoot.value,
|
|
@@ -4190,6 +4203,26 @@ function localToolchainInstallRequest(parsed) {
|
|
|
4190
4203
|
force: booleanFlag(parsed, "force")
|
|
4191
4204
|
};
|
|
4192
4205
|
}
|
|
4206
|
+
function localToolchainUninstallRequest(parsed) {
|
|
4207
|
+
const unknownFlag = firstUnknownFlag(parsed, ["json", "board", "board-id", "install-root", "yes"]);
|
|
4208
|
+
if (unknownFlag) {
|
|
4209
|
+
return `Unknown flag --${unknownFlag}. ${LOCAL_TOOLCHAIN_UNINSTALL_USAGE}`;
|
|
4210
|
+
}
|
|
4211
|
+
const extra = parsed.command.slice(3);
|
|
4212
|
+
if (extra.length > 0) {
|
|
4213
|
+
return `Unexpected argument: ${extra[0]}. ${LOCAL_TOOLCHAIN_UNINSTALL_USAGE}`;
|
|
4214
|
+
}
|
|
4215
|
+
const board = optionalTrimmedStringAliasFlag(parsed, ["board", "board-id"], "board or board-id");
|
|
4216
|
+
if (board.error)
|
|
4217
|
+
return board.error;
|
|
4218
|
+
if (!board.value) {
|
|
4219
|
+
return `Missing --board. ${LOCAL_TOOLCHAIN_UNINSTALL_USAGE}`;
|
|
4220
|
+
}
|
|
4221
|
+
const installRoot = optionalTrimmedStringFlag(parsed, "install-root");
|
|
4222
|
+
if (installRoot.error)
|
|
4223
|
+
return installRoot.error;
|
|
4224
|
+
return { boardId: board.value, installRoot: installRoot.value };
|
|
4225
|
+
}
|
|
4193
4226
|
function localToolchainValidateRequest(parsed) {
|
|
4194
4227
|
const unknownFlag = firstUnknownFlag(parsed, ["json", "release-root"]);
|
|
4195
4228
|
if (unknownFlag) {
|
|
@@ -5392,6 +5425,29 @@ function renderLocalToolchainInstall(result) {
|
|
|
5392
5425
|
}
|
|
5393
5426
|
return lines.join("\n");
|
|
5394
5427
|
}
|
|
5428
|
+
function renderLocalToolchainUninstall(result) {
|
|
5429
|
+
const lines = [
|
|
5430
|
+
result.removed ? "Local toolchain uninstalled." : "Local toolchain was not installed.",
|
|
5431
|
+
`board=${result.board_id}`,
|
|
5432
|
+
`install_root=${result.install_root}`,
|
|
5433
|
+
`registry=${result.registry_path}`,
|
|
5434
|
+
`removed=${result.removed}`,
|
|
5435
|
+
`removed_registry_entry=${result.removed_registry_entry}`
|
|
5436
|
+
];
|
|
5437
|
+
if (result.removed_paths.length > 0) {
|
|
5438
|
+
lines.push("removed_paths:");
|
|
5439
|
+
for (const removedPath of result.removed_paths) {
|
|
5440
|
+
lines.push(` ${removedPath}`);
|
|
5441
|
+
}
|
|
5442
|
+
}
|
|
5443
|
+
if (result.remaining_installed_boards.length > 0) {
|
|
5444
|
+
lines.push("remaining_installed_boards:");
|
|
5445
|
+
for (const boardId of result.remaining_installed_boards) {
|
|
5446
|
+
lines.push(` ${boardId}`);
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5449
|
+
return lines.join("\n");
|
|
5450
|
+
}
|
|
5395
5451
|
function renderLocalToolchainValidation(result) {
|
|
5396
5452
|
const lines = [
|
|
5397
5453
|
result.ok ? "Local toolchain ready." : "Local toolchain not ready.",
|
|
@@ -6157,6 +6213,7 @@ Main workflow:
|
|
|
6157
6213
|
embed local toolchain latest
|
|
6158
6214
|
embed local toolchain install
|
|
6159
6215
|
embed local toolchain validate
|
|
6216
|
+
embed local toolchain uninstall --board <board_id>
|
|
6160
6217
|
embed local compile taishanpi --source ./main.c --output ./.embed-labs/build/main
|
|
6161
6218
|
embed local build qt-smoke --build-dir ./.embed-labs/build/qt-smoke
|
|
6162
6219
|
6. Pick a cloud build template:
|
|
@@ -6204,6 +6261,7 @@ Local hardware:
|
|
|
6204
6261
|
embed local toolchain latest
|
|
6205
6262
|
embed local toolchain current
|
|
6206
6263
|
embed local toolchain install
|
|
6264
|
+
embed local toolchain uninstall --board <board_id>
|
|
6207
6265
|
embed local toolchain validate
|
|
6208
6266
|
embed local compile taishanpi --source ./main.c --output ./.embed-labs/build/main
|
|
6209
6267
|
embed local build qt-smoke --build-dir ./.embed-labs/build/qt-smoke
|
|
@@ -6407,7 +6465,8 @@ Usage:
|
|
|
6407
6465
|
embed image boot-logo compose --package <boot-logo-package.json> --base-image <boot.img|image.img> --output <image> [--manifest <manifest.json>] [--force] [--json]
|
|
6408
6466
|
embed local toolchain latest [--board taishanpi-1m-rk3566] [--channel stable] [--metadata-root <path>] [--json]
|
|
6409
6467
|
embed local toolchain current [--install-root <path>] [--json]
|
|
6410
|
-
embed local toolchain install [--board taishanpi-1m-rk3566] [--channel stable] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--force] [--json]
|
|
6468
|
+
embed local toolchain install [--board taishanpi-1m-rk3566] [--channel stable] [--mode minimal|runtime|compile|qt|firmware|full|images] [--metadata-root <path>] [--source-url <tar.gz-url>|--source-release-root <path>] [--install-root <path>] [--force] [--json]
|
|
6469
|
+
embed local toolchain uninstall --board <board_id> [--install-root <path>] [--yes] [--json]
|
|
6411
6470
|
Defaults to the production download channel at download.embedboard.com.
|
|
6412
6471
|
embed local toolchain validate [--release-root <path>] [--json]
|
|
6413
6472
|
embed local compile taishanpi --source <main.c|main.cpp> --output <artifact> [--release-root <path>] [--account <account_id>] [--json]
|