@dbx-tools/cli 0.3.39 → 0.3.41

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/index.ts CHANGED
@@ -6,3 +6,7 @@ export * as bootstrap from "./src/bootstrap";
6
6
  export * as cli from "./src/cli";
7
7
  export * as pnpm from "./src/pnpm";
8
8
  export * as root from "./src/root";
9
+ export { bootstrapWorkspace, seedToolchain, runInitialSynth } from "./src/bootstrap";
10
+ export { runCli } from "./src/cli";
11
+ export { resolvePnpmArgv, runPnpm, ensureWorkspaceReady, runProjen } from "./src/pnpm";
12
+ export { findWorkspaceRoot, needsBootstrap, needsInstall, needsToolchain, workspaceRoot, rootLabel } from "./src/root";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/reggie-db/dbx-tools.git",
6
- "directory": "workspaces/cli/dbx-tools"
6
+ "directory": "packages/cli/dbx-tools"
7
7
  },
8
8
  "bin": {
9
9
  "dbx-tools": "./bin/dbx-tools.mjs",
@@ -18,15 +18,15 @@
18
18
  "commander": "^15.0.0",
19
19
  "pnpm": "^11.0.6",
20
20
  "tsx": "^4.23.0",
21
- "@dbx-tools/core": "0.3.39",
22
- "@dbx-tools/shared-core": "0.3.39"
21
+ "@dbx-tools/core": "0.3.41",
22
+ "@dbx-tools/shared-core": "0.3.41"
23
23
  },
24
24
  "main": "index.ts",
25
25
  "license": "UNLICENSED",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "version": "0.3.39",
29
+ "version": "0.3.41",
30
30
  "types": "index.ts",
31
31
  "type": "module",
32
32
  "exports": {
package/src/bootstrap.ts CHANGED
@@ -16,9 +16,13 @@ import { rootLabel } from "./root";
16
16
  // workspace on a stale engine. `@latest` always takes the newest published.
17
17
  const DEFAULT_PROJEN_SPECIFIER = "@dbx-tools/projen@latest";
18
18
 
19
- const PROJENRC_TEMPLATE = `import { DBXToolsNodeProject } from "@dbx-tools/projen";
19
+ // Reach the class through its module NAMESPACE. Current engines also hoist it
20
+ // flat, but every engine ever published exports the namespace, and this template
21
+ // is resolved against `@latest` - a flat import dies on an older one with
22
+ // "does not provide an export named 'DBXToolsNodeProject'".
23
+ const PROJENRC_TEMPLATE = `import { project as projectApi } from "@dbx-tools/projen";
20
24
 
21
- const project = new DBXToolsNodeProject();
25
+ const project = new projectApi.DBXToolsNodeProject();
22
26
  project.synth();
23
27
  `;
24
28
 
@@ -59,7 +63,7 @@ export function bootstrapWorkspace(
59
63
  runInitialSynth(root);
60
64
 
61
65
  runPnpm(["install", "--no-frozen-lockfile", "--force"], root);
62
- outro("Workspace ready - re-run dbx-tools or add packages under workspaces/");
66
+ outro("Workspace ready - re-run dbx-tools or add packages under packages/");
63
67
  }
64
68
 
65
69
  /**
@@ -76,12 +80,7 @@ export function seedToolchain(
76
80
  const manifestPath = join(root, "package.json");
77
81
  if (!existsSync(manifestPath)) {
78
82
  runPnpm(["init"], root);
79
- // pnpm 11 `init` writes `devEngines.packageManager: { name: "pnpm",
80
- // onFail: "download" }`. Any npm-based tool later in the chain (an
81
- // `npx`/dlx fallback) then refuses with EBADDEVENGINES because its own
82
- // runner is npm, not pnpm. projen regenerates the whole manifest at synth
83
- // anyway, so drop the block from this throwaway seed.
84
- stripDevEngines(manifestPath);
83
+ normalizeSeedManifest(manifestPath);
85
84
  }
86
85
 
87
86
  const workspaceFile = join(root, "pnpm-workspace.yaml");
@@ -92,12 +91,27 @@ export function seedToolchain(
92
91
  runPnpm(["add", "-D", "projen", "typescript@^5.9.3", "tsx@^4.23.0", projenSpecifier], root);
93
92
  }
94
93
 
95
- /** Remove the `devEngines` block pnpm `init` seeds, so npm-based tooling doesn't reject the manifest. */
96
- function stripDevEngines(manifestPath: string): void {
94
+ /**
95
+ * Make what `pnpm init` produced safe to synth against. Two corrections, both
96
+ * because that output varies by pnpm version:
97
+ *
98
+ * - drop `devEngines`, which pnpm 11 seeds as `packageManager: { name: "pnpm",
99
+ * onFail: "download" }`. Any npm-based tool later in the chain (an
100
+ * `npx`/dlx fallback) then refuses with EBADDEVENGINES, its runner being npm;
101
+ * - force `type: "module"`, which pnpm 11 writes and pnpm 10 does not. tsx
102
+ * picks the entry's format from the nearest manifest, so without it
103
+ * `.projenrc.ts` loads as CJS and the first dependency using top-level await
104
+ * dies on "not supported with the cjs output format".
105
+ *
106
+ * projen regenerates the whole manifest at synth, so this only has to hold the
107
+ * seed together long enough to get there.
108
+ */
109
+ function normalizeSeedManifest(manifestPath: string): void {
97
110
  try {
98
111
  const manifest = json.parseRecord(readFileSync(manifestPath, "utf8"));
99
- if (manifest?.devEngines === undefined) return;
112
+ if (!manifest) return;
100
113
  delete manifest.devEngines;
114
+ manifest.type = "module";
101
115
  writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
102
116
  } catch {
103
117
  // A malformed/absent manifest here just means the later `pnpm add` recreates it.