@dbx-tools/cli 0.3.20 → 0.3.22
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/.projen/deps.json +5 -5
- package/.projen/files.json +2 -0
- package/README.md +30 -35
- package/bin/dbx-tools.mjs +11 -0
- package/bin/{dbxtools.ts → dbx-tools.ts} +1 -1
- package/package.json +9 -5
- package/src/bootstrap.ts +2 -2
- package/src/cli.ts +3 -3
- package/src/pnpm.ts +1 -1
- package/src/root.ts +2 -5
package/.projen/deps.json
CHANGED
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
"version": "catalog:",
|
|
6
6
|
"type": "build"
|
|
7
7
|
},
|
|
8
|
-
{
|
|
9
|
-
"name": "tsx",
|
|
10
|
-
"version": "^4.23.0",
|
|
11
|
-
"type": "build"
|
|
12
|
-
},
|
|
13
8
|
{
|
|
14
9
|
"name": "typescript",
|
|
15
10
|
"type": "build"
|
|
@@ -37,6 +32,11 @@
|
|
|
37
32
|
{
|
|
38
33
|
"name": "pnpm",
|
|
39
34
|
"type": "runtime"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "tsx",
|
|
38
|
+
"version": "catalog:",
|
|
39
|
+
"type": "runtime"
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
42
|
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"pnpm exec projen\"."
|
package/.projen/files.json
CHANGED
package/README.md
CHANGED
|
@@ -1,59 +1,54 @@
|
|
|
1
|
-
# dbx-tools
|
|
1
|
+
# @dbx-tools/cli
|
|
2
2
|
|
|
3
|
-
CLI
|
|
3
|
+
Bootstrap CLI for the dbx-tools projen workspace engine.
|
|
4
4
|
|
|
5
|
-
Run the `
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Run the `dbx-tools` command (aliased `dbxt`) to turn a folder that has no
|
|
6
|
+
`.projenrc.ts` or toolchain yet into a working dbx-tools workspace. Once that
|
|
7
|
+
workspace exists, everything else is a projen task you run with
|
|
8
|
+
`pnpm run <task>` - the CLI only forwards to projen from that point on. Import
|
|
9
|
+
the package modules when custom tooling needs the same root detection, pnpm
|
|
8
10
|
delegation, or CLI program behavior.
|
|
9
11
|
|
|
10
12
|
Key features:
|
|
11
13
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
- Generated-file cleanup with an interactive or non-interactive mode.
|
|
14
|
+
- Bootstrap path that scaffolds pnpm/projen into an empty or partially-set-up
|
|
15
|
+
folder, including the initial install and synth.
|
|
16
|
+
- Toolchain repair for a cloned repo whose generated files and `node_modules`
|
|
17
|
+
are gitignored.
|
|
18
|
+
- Transparent forwarding to projen for any task once the workspace is ready.
|
|
18
19
|
- Importable CLI/root/pnpm helpers for tests and thin wrapper commands.
|
|
19
20
|
|
|
20
|
-
## Bootstrap
|
|
21
|
+
## Bootstrap A Workspace
|
|
21
22
|
|
|
22
23
|
```sh
|
|
23
|
-
|
|
24
|
-
dbxtools sync --watch
|
|
24
|
+
dbx-tools sync
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
In an empty folder
|
|
28
|
-
`@dbx-tools/projen
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
In an empty folder this creates the minimum pnpm/projen structure needed for
|
|
28
|
+
`@dbx-tools/projen`, installs the toolchain, and runs the first synth. In a
|
|
29
|
+
freshly cloned repo it seeds the missing toolchain and synthesizes. This is the
|
|
30
|
+
case projen cannot handle on its own, because there are no tasks to run yet.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## After Bootstrap, Use The Projen Tasks
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
dbxtools openapi
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
`barrels` rebuilds package-root `index.ts` files from exported modules under
|
|
40
|
-
`src/`. `openapi` scans tsoa controllers and writes generated OpenAPI packages.
|
|
41
|
-
|
|
42
|
-
## Clean Generated Output
|
|
34
|
+
The engine registers its commands as projen tasks on the workspace root, so run
|
|
35
|
+
them directly instead of going through this CLI:
|
|
43
36
|
|
|
44
37
|
```sh
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
pnpm run sync # one-shot full synth
|
|
39
|
+
pnpm run sync --watch # projenrc + barrels + openapi watchers
|
|
40
|
+
pnpm run barrels # rebuild every package-root index.ts barrel
|
|
41
|
+
pnpm run openapi # generate the openapi packages from tsoa controllers
|
|
42
|
+
pnpm run clean # remove generated (read-only) files; -y to skip the picker
|
|
47
43
|
```
|
|
48
44
|
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
from source.
|
|
45
|
+
`dbx-tools <task>` still works and forwards to the same projen task, but the
|
|
46
|
+
`pnpm run` form is the documented one for an established workspace.
|
|
52
47
|
|
|
53
48
|
## Use The CLI Internals
|
|
54
49
|
|
|
55
50
|
```ts
|
|
56
|
-
import { cli, root, pnpm } from "dbx-tools";
|
|
51
|
+
import { cli, root, pnpm } from "@dbx-tools/cli";
|
|
57
52
|
|
|
58
53
|
await cli.runCli(["sync"]);
|
|
59
54
|
const workspaceRoot = await root.findWorkspaceRoot();
|
|
@@ -61,7 +56,7 @@ pnpm.runProjen(["barrels"], workspaceRoot);
|
|
|
61
56
|
```
|
|
62
57
|
|
|
63
58
|
Importing internals is mainly useful for tests or wrapper scripts; most users
|
|
64
|
-
should run the `
|
|
59
|
+
should run the `dbx-tools` bin.
|
|
65
60
|
|
|
66
61
|
## Modules
|
|
67
62
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GENERATED by projen synth (cli tag) - DO NOT EDIT.
|
|
3
|
+
// Regenerated from ./dbx-tools.ts.
|
|
4
|
+
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
5
|
+
|
|
6
|
+
// Resolved as a bare specifier so Node looks in THIS file's package rather than the
|
|
7
|
+
// caller's cwd - the only way a globally installed CLI finds its own tsx.
|
|
8
|
+
import { register } from "tsx/esm/api";
|
|
9
|
+
|
|
10
|
+
register();
|
|
11
|
+
await import(new URL("./dbx-tools.ts", import.meta.url).href);
|
package/package.json
CHANGED
|
@@ -6,31 +6,35 @@
|
|
|
6
6
|
"directory": "workspaces/cli/dbx-tools"
|
|
7
7
|
},
|
|
8
8
|
"bin": {
|
|
9
|
-
"
|
|
9
|
+
"dbx-tools": "./bin/dbx-tools.mjs",
|
|
10
|
+
"dbxt": "./bin/dbx-tools.mjs"
|
|
10
11
|
},
|
|
11
12
|
"devDependencies": {
|
|
12
13
|
"@types/node": "^24.6.0",
|
|
13
|
-
"tsx": "^4.23.0",
|
|
14
14
|
"typescript": "^5.9.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@clack/prompts": "^1.7.0",
|
|
18
18
|
"commander": "^15.0.0",
|
|
19
19
|
"pnpm": "^11.0.6",
|
|
20
|
-
"
|
|
21
|
-
"@dbx-tools/
|
|
20
|
+
"tsx": "^4.23.0",
|
|
21
|
+
"@dbx-tools/core": "0.3.22",
|
|
22
|
+
"@dbx-tools/shared-core": "0.3.22"
|
|
22
23
|
},
|
|
23
24
|
"main": "index.ts",
|
|
24
25
|
"license": "UNLICENSED",
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|
|
27
28
|
},
|
|
28
|
-
"version": "0.3.
|
|
29
|
+
"version": "0.3.22",
|
|
29
30
|
"types": "index.ts",
|
|
30
31
|
"type": "module",
|
|
31
32
|
"exports": {
|
|
32
33
|
".": "./index.ts",
|
|
34
|
+
"./bootstrap": "./src/bootstrap.ts",
|
|
35
|
+
"./cli": "./src/cli.ts",
|
|
33
36
|
"./pnpm": "./src/pnpm.ts",
|
|
37
|
+
"./root": "./src/root.ts",
|
|
34
38
|
"./package.json": "./package.json"
|
|
35
39
|
},
|
|
36
40
|
"dbxToolsConfig": {
|
package/src/bootstrap.ts
CHANGED
|
@@ -31,7 +31,7 @@ allowBuilds:
|
|
|
31
31
|
* Turn a folder into a functioning dbx-tools workspace: `pnpm init`, seed
|
|
32
32
|
* `pnpm-workspace.yaml`, add `projen`/`typescript`/`tsx` + the engine package,
|
|
33
33
|
* write a minimal `.projenrc.ts`, synth once (with `PROJEN_DISABLE_POST`), then
|
|
34
|
-
* install. Does not run barrels - run `
|
|
34
|
+
* install. Does not run barrels - run `pnpm run barrels` or a full projen synth
|
|
35
35
|
* post-install to generate package barrels.
|
|
36
36
|
*
|
|
37
37
|
* Every step is idempotent and self-guarded, so this is safe to run against a
|
|
@@ -58,7 +58,7 @@ export function bootstrapWorkspace(
|
|
|
58
58
|
runInitialSynth(root);
|
|
59
59
|
|
|
60
60
|
runPnpm(["install", "--no-frozen-lockfile", "--force"], root);
|
|
61
|
-
outro("Workspace ready - re-run
|
|
61
|
+
outro("Workspace ready - re-run dbx-tools or add packages under workspaces/");
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
package/src/cli.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
2
|
+
* `dbx-tools` commander entry: detect root, bootstrap or install, forward to projen.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
@@ -40,12 +40,12 @@ async function prepareAndRunProjen(projenArgs: string[], startDir?: string): Pro
|
|
|
40
40
|
/** Parse `argv` with commander and forward remaining args to projen. */
|
|
41
41
|
export async function runCli(argv: string[]): Promise<void> {
|
|
42
42
|
const program = new Command()
|
|
43
|
-
.name("
|
|
43
|
+
.name("dbx-tools")
|
|
44
44
|
.description("Bootstrap dbx-tools workspaces and forward to projen")
|
|
45
45
|
.allowUnknownOption()
|
|
46
46
|
.allowExcessArguments()
|
|
47
47
|
.showHelpAfterError()
|
|
48
|
-
.helpOption("-h, --help", "Show
|
|
48
|
+
.helpOption("-h, --help", "Show dbx-tools help");
|
|
49
49
|
|
|
50
50
|
program.parse(argv);
|
|
51
51
|
await prepareAndRunProjen(program.args);
|
package/src/pnpm.ts
CHANGED
package/src/root.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workspace root detection for the `
|
|
2
|
+
* Workspace root detection for the `dbx-tools` CLI.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
@@ -67,10 +67,7 @@ export function needsInstall(root: string): boolean {
|
|
|
67
67
|
export function needsToolchain(root: string): boolean {
|
|
68
68
|
const modules = join(root, "node_modules");
|
|
69
69
|
if (!existsSync(modules)) return true;
|
|
70
|
-
return (
|
|
71
|
-
!existsSync(join(modules, "projen")) ||
|
|
72
|
-
!existsSync(join(modules, "@dbx-tools", "projen"))
|
|
73
|
-
);
|
|
70
|
+
return !existsSync(join(modules, "projen")) || !existsSync(join(modules, "@dbx-tools", "projen"));
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
/** Async, memoized root lookup from the process cwd at first use. */
|