@tdk-landscape/tdk-cli-core 1.3.102 → 1.3.103
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/README.md +11 -9
- package/cli/dist/cli.js +2 -0
- package/cli/dist/commands/import.js +39 -0
- package/cli/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# TDK CLI — start services on your laptop
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@tdk-landscape/tdk-cli-core)
|
|
4
|
+
[](https://packagephobia.com/result?p=@tdk-landscape/tdk-cli-core)
|
|
5
|
+
[](https://packagephobia.com/result?p=@tdk-landscape/tdk-cli-core@1.3.81)
|
|
6
|
+
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml)
|
|
7
|
+
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml)
|
|
8
|
+
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml)
|
|
9
|
+
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml)
|
|
10
|
+
[](https://snyk.io/test/github/tdk-landscape/tdk-cli-core)
|
|
11
|
+
[](https://socket.dev/npm/package/@tdk-landscape/tdk-cli-core/overview)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
|
|
3
14
|
English | [简体中文](README-zh_cn.md) | [繁體中文](README-zh_tw.md) | [日本語](README-ja.md) | [한국어](README-ko.md)
|
|
4
15
|
|
|
5
16
|
TDK CLI starts your services on your laptop. It is not a deploy and not a Compose file: define each service in `service.json`, then run `tdk up`. No Kubernetes is needed on the machine.
|
|
@@ -34,15 +45,6 @@ If Helm, Compose, or your existing Tilt setup already gives you a working local
|
|
|
34
45
|
|
|
35
46
|
See [how TDK CLI works alongside Helm](https://tdk-landscape.github.io/tdk-website/docs/with-helm/), the [service schema](engine/schemas/service-schema.json), and the [project configuration schema](engine/schemas/project-schema.json).
|
|
36
47
|
|
|
37
|
-
[](https://www.npmjs.com/package/@tdk-landscape/tdk-cli-core)
|
|
38
|
-
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/ci.yml)
|
|
39
|
-
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/quickstart-e2e.yml)
|
|
40
|
-
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/erp-scale-e2e.yml)
|
|
41
|
-
[](https://github.com/tdk-landscape/tdk-cli-core/actions/workflows/examples-e2e.yml)
|
|
42
|
-
[](https://snyk.io/test/github/tdk-landscape/tdk-cli-core)
|
|
43
|
-
[](https://socket.dev/npm/package/@tdk-landscape/tdk-cli-core/overview)
|
|
44
|
-
[](LICENSE)
|
|
45
|
-
|
|
46
48
|
## Installation
|
|
47
49
|
|
|
48
50
|
Install the CLI from npm (requires Node.js 22.12+) or use the prebuilt binary (no Node.js or Bun required):
|
package/cli/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import { doctorCommand } from "./commands/doctor.js";
|
|
|
8
8
|
import { downCommand } from "./commands/down.js";
|
|
9
9
|
import { ejectCommand } from "./commands/eject.js";
|
|
10
10
|
import { showHelp } from "./commands/help.js";
|
|
11
|
+
import { importCommand } from "./commands/import.js";
|
|
11
12
|
import { maintainersCommand } from "./commands/maintainers.js";
|
|
12
13
|
import { networksCommand } from "./commands/networks.js";
|
|
13
14
|
import { projectCommand } from "./commands/project.js";
|
|
@@ -46,6 +47,7 @@ program.addCommand(projectsCommand);
|
|
|
46
47
|
program.addCommand(upCommand);
|
|
47
48
|
program.addCommand(downCommand);
|
|
48
49
|
program.addCommand(ejectCommand);
|
|
50
|
+
program.addCommand(importCommand);
|
|
49
51
|
program.addCommand(statusCommand);
|
|
50
52
|
program.addCommand(stackCommand);
|
|
51
53
|
program.addCommand(resourceCommand);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
/**
|
|
4
|
+
* The importer lives in its own repo so detectors can ship without a CLI release. Until it is
|
|
5
|
+
* published to npm it is run from git; `TDK_IMPORT_PACKAGE` overrides the package spec.
|
|
6
|
+
*/
|
|
7
|
+
export const IMPORT_PACKAGE = "github:tdk-landscape/tdk-import";
|
|
8
|
+
export function importInvocation(args, env = process.env, platform = process.platform) {
|
|
9
|
+
const pkg = env.TDK_IMPORT_PACKAGE || IMPORT_PACKAGE;
|
|
10
|
+
return {
|
|
11
|
+
command: platform === "win32" ? "npx.cmd" : "npx",
|
|
12
|
+
args: ["--yes", pkg, ...args],
|
|
13
|
+
shell: platform === "win32",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** Runs tdk-import with the caller's terminal and resolves to its exit code. */
|
|
17
|
+
export function runImport(args, spawnFn = spawn) {
|
|
18
|
+
const invocation = importInvocation(args);
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const child = spawnFn(invocation.command, invocation.args, {
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
shell: invocation.shell,
|
|
23
|
+
});
|
|
24
|
+
child.on("error", (err) => {
|
|
25
|
+
console.error(`tdk import: could not run npx (${err.message}). Install Node.js/npm and retry.`);
|
|
26
|
+
resolve(127);
|
|
27
|
+
});
|
|
28
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export const importCommand = new Command("import")
|
|
32
|
+
.description("Import the services a directory describes (runs tdk-import)")
|
|
33
|
+
.argument("[args...]", "Passed to tdk-import: [dir] --dry-run --yes --force --only <ids>")
|
|
34
|
+
.allowUnknownOption()
|
|
35
|
+
.helpOption(false)
|
|
36
|
+
.action(async (args) => {
|
|
37
|
+
process.exitCode = await runImport(args);
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=import.js.map
|
package/cli/package.json
CHANGED