@dbx-tools/cli 0.3.42 → 0.3.43
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/package.json +3 -3
- package/src/bootstrap.ts +32 -6
package/package.json
CHANGED
|
@@ -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/shared-core": "0.3.
|
|
22
|
-
"@dbx-tools/core": "0.3.
|
|
21
|
+
"@dbx-tools/shared-core": "0.3.43",
|
|
22
|
+
"@dbx-tools/core": "0.3.43"
|
|
23
23
|
},
|
|
24
24
|
"main": "index.ts",
|
|
25
25
|
"license": "UNLICENSED",
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"version": "0.3.
|
|
29
|
+
"version": "0.3.43",
|
|
30
30
|
"types": "index.ts",
|
|
31
31
|
"type": "module",
|
|
32
32
|
"exports": {
|
package/src/bootstrap.ts
CHANGED
|
@@ -5,16 +5,42 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
8
9
|
import { intro, outro } from "@clack/prompts";
|
|
9
10
|
import { exec } from "@dbx-tools/core";
|
|
10
11
|
import { json } from "@dbx-tools/shared-core";
|
|
11
12
|
import { resolvePnpmArgv, runPnpm } from "./pnpm";
|
|
12
13
|
import { rootLabel } from "./root";
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/** Fallback when this CLI's own version isn't a real release (an in-repo `0.0.0`). */
|
|
16
|
+
const FALLBACK_PROJEN_SPECIFIER = "@dbx-tools/projen@latest";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Install the engine at THIS CLI's own version. The two are released together by
|
|
20
|
+
* the root `bump`, so the matching engine always exists on the registry.
|
|
21
|
+
*
|
|
22
|
+
* Not `@latest`, and not a bare `@dbx-tools/projen`. A bare specifier can land on
|
|
23
|
+
* a stray `0.0.0`, whose `^0.0.0` caret then reaches no real release. `@latest`
|
|
24
|
+
* has a subtler failure: pnpm 11 applies a `minimumReleaseAge` delay, so for the
|
|
25
|
+
* first day after a release it deliberately resolves a dist-tag to the newest
|
|
26
|
+
* version OLDER than the threshold and merely notes the newer one
|
|
27
|
+
* (`+ @dbx-tools/projen 0.1.24 (0.3.42 is available)`). A bootstrap run right
|
|
28
|
+
* after a release therefore installed a months-old engine against a current CLI,
|
|
29
|
+
* which is how `sync --watch` died on an engine predating its `concurrently`
|
|
30
|
+
* dependency. An explicit range admits only the version we want, so the age
|
|
31
|
+
* heuristic has nothing older to fall back to.
|
|
32
|
+
*/
|
|
33
|
+
function defaultProjenSpecifier(): string {
|
|
34
|
+
try {
|
|
35
|
+
const manifestPath = fileURLToPath(new URL("../package.json", import.meta.url));
|
|
36
|
+
const version = json.parseRecord(readFileSync(manifestPath, "utf8"))?.version;
|
|
37
|
+
return typeof version === "string" && version !== "0.0.0"
|
|
38
|
+
? `@dbx-tools/projen@^${version}`
|
|
39
|
+
: FALLBACK_PROJEN_SPECIFIER;
|
|
40
|
+
} catch {
|
|
41
|
+
return FALLBACK_PROJEN_SPECIFIER;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
18
44
|
|
|
19
45
|
// Reach the class through its module NAMESPACE. Current engines also hoist it
|
|
20
46
|
// flat, but every engine ever published exports the namespace, and this template
|
|
@@ -49,7 +75,7 @@ allowBuilds:
|
|
|
49
75
|
*/
|
|
50
76
|
export function bootstrapWorkspace(
|
|
51
77
|
root: string,
|
|
52
|
-
projenSpecifier: string =
|
|
78
|
+
projenSpecifier: string = defaultProjenSpecifier(),
|
|
53
79
|
): void {
|
|
54
80
|
intro(`Bootstrapping dbx-tools workspace in ${rootLabel(root)}`);
|
|
55
81
|
|
|
@@ -75,7 +101,7 @@ export function bootstrapWorkspace(
|
|
|
75
101
|
*/
|
|
76
102
|
export function seedToolchain(
|
|
77
103
|
root: string,
|
|
78
|
-
projenSpecifier: string =
|
|
104
|
+
projenSpecifier: string = defaultProjenSpecifier(),
|
|
79
105
|
): void {
|
|
80
106
|
const manifestPath = join(root, "package.json");
|
|
81
107
|
if (!existsSync(manifestPath)) {
|