@telorun/cli 0.77.0 → 0.79.0
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/bundle/module-payload.d.ts +28 -8
- package/dist/bundle/module-payload.d.ts.map +1 -1
- package/dist/bundle/module-payload.js +62 -27
- package/dist/bundle/module-payload.js.map +1 -1
- package/dist/bundle/warm-layers.d.ts +10 -1
- package/dist/bundle/warm-layers.d.ts.map +1 -1
- package/dist/bundle/warm-layers.js +15 -4
- package/dist/bundle/warm-layers.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +6 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +53 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +7 -0
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +17 -21
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +5 -23
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/controller-progress.d.ts +14 -14
- package/dist/controller-progress.d.ts.map +1 -1
- package/dist/controller-progress.js +0 -0
- package/dist/controller-progress.js.map +1 -1
- package/dist/env-files.d.ts +46 -0
- package/dist/env-files.d.ts.map +1 -0
- package/dist/env-files.js +92 -0
- package/dist/env-files.js.map +1 -0
- package/dist/release/apply-plan.d.ts.map +1 -1
- package/dist/release/apply-plan.js +38 -1
- package/dist/release/apply-plan.js.map +1 -1
- package/dist/release/check-requires.d.ts +10 -1
- package/dist/release/check-requires.d.ts.map +1 -1
- package/dist/release/check-requires.js +23 -0
- package/dist/release/check-requires.js.map +1 -1
- package/dist/release/npm-controller-package.d.ts +50 -0
- package/dist/release/npm-controller-package.d.ts.map +1 -0
- package/dist/release/npm-controller-package.js +136 -0
- package/dist/release/npm-controller-package.js.map +1 -0
- package/dist/release/verify-requires.d.ts +50 -0
- package/dist/release/verify-requires.d.ts.map +1 -1
- package/dist/release/verify-requires.js +58 -1
- package/dist/release/verify-requires.js.map +1 -1
- package/dist/release/workspace.d.ts +5 -7
- package/dist/release/workspace.d.ts.map +1 -1
- package/dist/release/workspace.js +6 -17
- package/dist/release/workspace.js.map +1 -1
- package/dist/workspace-marker.d.ts +30 -0
- package/dist/workspace-marker.d.ts.map +1 -0
- package/dist/workspace-marker.js +49 -0
- package/dist/workspace-marker.js.map +1 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller-progress.js","sourceRoot":"","sources":["../src/controller-progress.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAc,EACd,GAAW,EACX,UAA+B,EAAE;IAEjC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,0EAA0E;IAC1E,2EAA2E;IAC3E,2EAA2E;IAC3E,yEAAyE;IACzE,0BAA0B;IAC1B,IAAI,GAAG,CAAC,MAAM;QAAE,OAAO;IACvB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK;QAAE,OAAO;IAGrC,gEAAgE;IAChE,uEAAuE;IACvE,mEAAmE;IACnE,uEAAuE;IACvE,qEAAqE;IACrE,
|
|
1
|
+
{"version":3,"file":"controller-progress.js","sourceRoot":"","sources":["../src/controller-progress.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC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;IAC1B,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,EAAE,IAAI,CAAC;IAChC,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `.env` / `.env.local` collection for `telo run`.
|
|
3
|
+
*
|
|
4
|
+
* **The workspace marker is the bound, and its absence is the old behaviour.**
|
|
5
|
+
* A walk-up needs a stop: walking to `/` would read a user's home `.env.local`
|
|
6
|
+
* into an app run, and stopping at `.git` would tie env resolution to a VCS a
|
|
7
|
+
* deployed checkout may not have. `telo-workspace.yaml` is already the anchor
|
|
8
|
+
* every workspace-relative path is measured from, so it is the honest boundary
|
|
9
|
+
* for "this repo". Only its LOCATION is read — never its `modules:` list, which
|
|
10
|
+
* is release scope and says nothing about env, which is why a manifest under
|
|
11
|
+
* `examples/` (in no release subtree) still gets the full walk.
|
|
12
|
+
*
|
|
13
|
+
* With no marker anywhere above the manifest the walk collapses to the
|
|
14
|
+
* manifest's own directory, which is what this did before the bound existed, so
|
|
15
|
+
* the file stays harmless by its absence: it enables the parent lookup rather
|
|
16
|
+
* than gating one, and deleting it cannot silently drop a variable an app had.
|
|
17
|
+
*
|
|
18
|
+
* Precedence (highest first): the real environment > nearest `.env.local` >
|
|
19
|
+
* nearest `.env` > the same pair one directory up, and so on. A repo-root file
|
|
20
|
+
* reaches every manifest beneath it, so a nearer declaration has to win.
|
|
21
|
+
*
|
|
22
|
+
* **Resolving is separate from applying**, so the walk is answerable without
|
|
23
|
+
* touching `process.env` or writing a line of output — the caller owns both.
|
|
24
|
+
*/
|
|
25
|
+
/** One file the walk could not read for a reason other than its absence. */
|
|
26
|
+
export interface UnreadableEnvFile {
|
|
27
|
+
readonly path: string;
|
|
28
|
+
/** The errno code (`EACCES`, `EISDIR`, …), or the message when there is none. */
|
|
29
|
+
readonly reason: string;
|
|
30
|
+
}
|
|
31
|
+
export interface EnvFileResolution {
|
|
32
|
+
/** The merged values, precedence already applied. Never written anywhere by
|
|
33
|
+
* this module. */
|
|
34
|
+
readonly values: Readonly<Record<string, string>>;
|
|
35
|
+
/** The files that contributed, in the order they were merged (farthest
|
|
36
|
+
* ancestor first, so the last entry is the one that won a conflict). */
|
|
37
|
+
readonly loaded: readonly string[];
|
|
38
|
+
/** Files that exist but could not be read. Reporting these is the caller's,
|
|
39
|
+
* and it is not optional: an unreadable `.env` is indistinguishable from an
|
|
40
|
+
* absent one to everything downstream. */
|
|
41
|
+
readonly unreadable: readonly UnreadableEnvFile[];
|
|
42
|
+
}
|
|
43
|
+
/** Collect the env files visible to a manifest. Pure: reads the filesystem and
|
|
44
|
+
* returns what it found. */
|
|
45
|
+
export declare function resolveEnvFiles(manifestPath: string): EnvFileResolution;
|
|
46
|
+
//# sourceMappingURL=env-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-files.d.ts","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC;uBACmB;IACnB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD;6EACyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;+CAE2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACnD;AAID;6BAC6B;AAC7B,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CAgBvE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `.env` / `.env.local` collection for `telo run`.
|
|
3
|
+
*
|
|
4
|
+
* **The workspace marker is the bound, and its absence is the old behaviour.**
|
|
5
|
+
* A walk-up needs a stop: walking to `/` would read a user's home `.env.local`
|
|
6
|
+
* into an app run, and stopping at `.git` would tie env resolution to a VCS a
|
|
7
|
+
* deployed checkout may not have. `telo-workspace.yaml` is already the anchor
|
|
8
|
+
* every workspace-relative path is measured from, so it is the honest boundary
|
|
9
|
+
* for "this repo". Only its LOCATION is read — never its `modules:` list, which
|
|
10
|
+
* is release scope and says nothing about env, which is why a manifest under
|
|
11
|
+
* `examples/` (in no release subtree) still gets the full walk.
|
|
12
|
+
*
|
|
13
|
+
* With no marker anywhere above the manifest the walk collapses to the
|
|
14
|
+
* manifest's own directory, which is what this did before the bound existed, so
|
|
15
|
+
* the file stays harmless by its absence: it enables the parent lookup rather
|
|
16
|
+
* than gating one, and deleting it cannot silently drop a variable an app had.
|
|
17
|
+
*
|
|
18
|
+
* Precedence (highest first): the real environment > nearest `.env.local` >
|
|
19
|
+
* nearest `.env` > the same pair one directory up, and so on. A repo-root file
|
|
20
|
+
* reaches every manifest beneath it, so a nearer declaration has to win.
|
|
21
|
+
*
|
|
22
|
+
* **Resolving is separate from applying**, so the walk is answerable without
|
|
23
|
+
* touching `process.env` or writing a line of output — the caller owns both.
|
|
24
|
+
*/
|
|
25
|
+
import * as dotenv from "dotenv";
|
|
26
|
+
import * as fs from "node:fs";
|
|
27
|
+
import * as path from "node:path";
|
|
28
|
+
import { findWorkspaceRoot, realPath } from "./workspace-marker.js";
|
|
29
|
+
const FILENAMES = [".env", ".env.local"];
|
|
30
|
+
/** Collect the env files visible to a manifest. Pure: reads the filesystem and
|
|
31
|
+
* returns what it found. */
|
|
32
|
+
export function resolveEnvFiles(manifestPath) {
|
|
33
|
+
const loaded = [];
|
|
34
|
+
const unreadable = [];
|
|
35
|
+
const values = {};
|
|
36
|
+
// Farthest-first, so each nearer directory overwrites what the one above set.
|
|
37
|
+
for (const directory of envDirectories(manifestDirectory(manifestPath)).reverse()) {
|
|
38
|
+
for (const name of FILENAMES) {
|
|
39
|
+
const file = path.join(directory, name);
|
|
40
|
+
const text = readEnvFile(file, unreadable);
|
|
41
|
+
if (text === undefined)
|
|
42
|
+
continue;
|
|
43
|
+
loaded.push(file);
|
|
44
|
+
Object.assign(values, dotenv.parse(text));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { values, loaded, unreadable };
|
|
48
|
+
}
|
|
49
|
+
/** The directory holding the manifest — or the path itself when it names a
|
|
50
|
+
* directory. Resolved through symlinks, so the walk climbs the real tree. */
|
|
51
|
+
function manifestDirectory(manifestPath) {
|
|
52
|
+
const resolved = realPath(path.resolve(manifestPath));
|
|
53
|
+
return fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()
|
|
54
|
+
? resolved
|
|
55
|
+
: path.dirname(resolved);
|
|
56
|
+
}
|
|
57
|
+
/** The manifest's directory, then each ancestor up to and including the
|
|
58
|
+
* workspace root. Nearest first; just the one directory when no marker sits
|
|
59
|
+
* above it. */
|
|
60
|
+
function envDirectories(from) {
|
|
61
|
+
const root = findWorkspaceRoot(from);
|
|
62
|
+
if (root === undefined)
|
|
63
|
+
return [from];
|
|
64
|
+
const dirs = [];
|
|
65
|
+
for (let dir = from;; dir = path.dirname(dir)) {
|
|
66
|
+
dirs.push(dir);
|
|
67
|
+
if (dir === root || path.dirname(dir) === dir)
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return dirs;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* `undefined` when the file is genuinely not there, its text when it is.
|
|
74
|
+
*
|
|
75
|
+
* Only absence is silent. Anything else — a root-owned `.env.local` in a shared
|
|
76
|
+
* checkout, a directory where a file is expected — is recorded, because the
|
|
77
|
+
* alternative is an app booting without a variable the developer can see in the
|
|
78
|
+
* file and a later `ERR_MANIFEST_VALIDATION_FAILED` naming it.
|
|
79
|
+
*/
|
|
80
|
+
function readEnvFile(file, unreadable) {
|
|
81
|
+
try {
|
|
82
|
+
return fs.readFileSync(file, "utf8");
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
const code = err.code;
|
|
86
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
87
|
+
return undefined;
|
|
88
|
+
unreadable.push({ path: file, reason: code ?? String(err) });
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=env-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-files.js","sourceRoot":"","sources":["../src/env-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAsBpE,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,YAAY,CAAU,CAAC;AAElD;6BAC6B;AAC7B,MAAM,UAAU,eAAe,CAAC,YAAoB;IAClD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,8EAA8E;IAC9E,KAAK,MAAM,SAAS,IAAI,cAAc,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAClF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACxC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAC3C,I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EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC9D,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,MAAM,EAEX,KAAK,SAAS,EAEd,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9E,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,MAAM,GACX,aAAa,EAAE,CAQjB;AA0FD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,MAAM,CAAC,CAuBjB"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* a changelog or the ledger is here. The seam is the plan itself, which is
|
|
8
8
|
* already a complete description of what to write.
|
|
9
9
|
*/
|
|
10
|
-
import { prependChangelogRelease, renderChangelogRelease, stampCrateVersion, stampManifestVersion, stampPackageVersion, } from "@telorun/analyzer";
|
|
10
|
+
import { prependChangelogRelease, renderChangelogRelease, stampCrateVersion, stampManifestVersion, stampPackageVersion, stampSelfNpmPins, VersionStampError, } from "@telorun/analyzer";
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
import { ModulePayloadBuilder } from "../bundle/module-payload.js";
|
|
@@ -38,6 +38,28 @@ export function writePlannedVersions(workspace, plan, date) {
|
|
|
38
38
|
* shape that cannot be rewritten in place throws instead, because leaving a
|
|
39
39
|
* module's manifests disagreeing about its own version is worse than stopping.
|
|
40
40
|
*/
|
|
41
|
+
/**
|
|
42
|
+
* The package a module ships itself, when it has one that is published.
|
|
43
|
+
*
|
|
44
|
+
* A missing file means the module ships no package — the ordinary answer for the
|
|
45
|
+
* bundled majority. A MALFORMED one is a different fact and must not read as the
|
|
46
|
+
* same: this is what decides whether the manifest's self-pin gets stamped, so
|
|
47
|
+
* swallowing a parse error silently skips exactly the stamping this exists to
|
|
48
|
+
* guarantee, and the module ships naming a version of itself that never moved.
|
|
49
|
+
*/
|
|
50
|
+
function readPackageName(file) {
|
|
51
|
+
if (!fs.existsSync(file))
|
|
52
|
+
return undefined;
|
|
53
|
+
let pkg;
|
|
54
|
+
try {
|
|
55
|
+
pkg = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
throw new VersionStampError(`${file} is not valid JSON: ${err.message}. It decides whether this ` +
|
|
59
|
+
`module's manifest pins its own package, so it cannot be skipped.`);
|
|
60
|
+
}
|
|
61
|
+
return pkg.private ? undefined : pkg.name;
|
|
62
|
+
}
|
|
41
63
|
function stampVersion(dir, version) {
|
|
42
64
|
const targets = [
|
|
43
65
|
["telo.yaml", stampManifestVersion],
|
|
@@ -56,6 +78,21 @@ function stampVersion(dir, version) {
|
|
|
56
78
|
fs.writeFileSync(file, after, "utf8");
|
|
57
79
|
written.push(relative);
|
|
58
80
|
}
|
|
81
|
+
// A module delivering its controller from npm pins its OWN package in the
|
|
82
|
+
// manifest, and that pin is part of its version too. Left behind it would name
|
|
83
|
+
// a tarball older than the module describing it — which is how one came to
|
|
84
|
+
// point at a years-old version of itself.
|
|
85
|
+
const ownPackage = readPackageName(path.join(dir, "nodejs", "package.json"));
|
|
86
|
+
const manifest = path.join(dir, "telo.yaml");
|
|
87
|
+
if (ownPackage && fs.existsSync(manifest)) {
|
|
88
|
+
const before = fs.readFileSync(manifest, "utf8");
|
|
89
|
+
const after = stampSelfNpmPins(before, ownPackage, version);
|
|
90
|
+
if (after !== before) {
|
|
91
|
+
fs.writeFileSync(manifest, after, "utf8");
|
|
92
|
+
if (!written.includes("telo.yaml"))
|
|
93
|
+
written.push("telo.yaml");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
59
96
|
return written;
|
|
60
97
|
}
|
|
61
98
|
/** Prepend this release's block, or nothing when no fragment named the module —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/release/apply-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EA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,YAAY,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAC7E;SACR,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
* dependency. When a sibling adopts new syntax, every dependent fails its own
|
|
18
18
|
* edge check until its range moves. Nothing walks a graph — the check is the
|
|
19
19
|
* walk.
|
|
20
|
+
*
|
|
21
|
+
* **A forward-declared edge is not a failure here.** A module adopting new syntax
|
|
22
|
+
* declares the release that will carry it, and on the commit that does so that
|
|
23
|
+
* release does not exist yet — which is the point of declaring the bound before
|
|
24
|
+
* it. Such an edge is reported `pending` and never runs; `publish` is where it
|
|
25
|
+
* becomes fatal, by which time npm has published and the version exists.
|
|
20
26
|
*/
|
|
21
27
|
import type { Workspace } from "./workspace.js";
|
|
22
28
|
export interface EdgeCheck {
|
|
@@ -24,7 +30,10 @@ export interface EdgeCheck {
|
|
|
24
30
|
edge: string;
|
|
25
31
|
/** Module keys checked at this edge. */
|
|
26
32
|
modules: string[];
|
|
27
|
-
|
|
33
|
+
/** `pending` means the edge names a version newer than anything published, so
|
|
34
|
+
* there was nothing to install — see `unreleasedEdge`. It is informational
|
|
35
|
+
* here and fatal at publish. */
|
|
36
|
+
status: "passed" | "failed" | "pending" | "unavailable";
|
|
28
37
|
detail?: string;
|
|
29
38
|
}
|
|
30
39
|
export interface CheckRequiresResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-requires.d.ts","sourceRoot":"","sources":["../../src/release/check-requires.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"check-requires.d.ts","sourceRoot":"","sources":["../../src/release/check-requires.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAUH,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQlE,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;qCAEiC;IACjC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB;oFACgF;IAChF,OAAO,EAAE,OAAO,CAAC;CAClB;AAsCD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAgC9B"}
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
* dependency. When a sibling adopts new syntax, every dependent fails its own
|
|
18
18
|
* edge check until its range moves. Nothing walks a graph — the check is the
|
|
19
19
|
* walk.
|
|
20
|
+
*
|
|
21
|
+
* **A forward-declared edge is not a failure here.** A module adopting new syntax
|
|
22
|
+
* declares the release that will carry it, and on the commit that does so that
|
|
23
|
+
* release does not exist yet — which is the point of declaring the bound before
|
|
24
|
+
* it. Such an edge is reported `pending` and never runs; `publish` is where it
|
|
25
|
+
* becomes fatal, by which time npm has published and the version exists.
|
|
20
26
|
*/
|
|
21
27
|
import { lowerBound, readRequires, upperBound } from "@telorun/analyzer";
|
|
22
28
|
import { execFile } from "node:child_process";
|
|
@@ -24,6 +30,7 @@ import * as fs from "node:fs";
|
|
|
24
30
|
import { promisify } from "node:util";
|
|
25
31
|
import { parseAllDocuments } from "yaml";
|
|
26
32
|
import { defaultCustomTags } from "@telorun/templating";
|
|
33
|
+
import { publishedTeloVersions, unreleasedEdge } from "./verify-requires.js";
|
|
27
34
|
const run = promisify(execFile);
|
|
28
35
|
/** Generous by design: an edge CLI is fetched on first use. Bounds a hang, does
|
|
29
36
|
* not pace the work. */
|
|
@@ -84,8 +91,24 @@ export async function checkWorkspaceRequires(workspace, currentVersion) {
|
|
|
84
91
|
byEdge.set(edge, [module]);
|
|
85
92
|
}
|
|
86
93
|
}
|
|
94
|
+
// Asked ONCE for the whole workspace, before any edge runs: the normal way new
|
|
95
|
+
// syntax lands is a module declaring the range of the release that will carry
|
|
96
|
+
// it, and until that release ships there is nothing to install. Spawning `npx`
|
|
97
|
+
// at such an edge has one possible outcome, and npm's ETARGET arrives wrapped
|
|
98
|
+
// in install noise indistinguishable from being offline.
|
|
99
|
+
const published = byEdge.size > 0 ? await publishedTeloVersions() : null;
|
|
87
100
|
const checks = [];
|
|
88
101
|
for (const [edge, modules] of [...byEdge].sort(([a], [b]) => (a < b ? -1 : 1))) {
|
|
102
|
+
const latestPublished = unreleasedEdge(edge, published);
|
|
103
|
+
if (latestPublished !== undefined) {
|
|
104
|
+
checks.push({
|
|
105
|
+
edge,
|
|
106
|
+
modules: modules.map((m) => m.key),
|
|
107
|
+
status: "pending",
|
|
108
|
+
detail: latestPublished,
|
|
109
|
+
});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
89
112
|
checks.push(...(await checkEdge(edge, modules)));
|
|
90
113
|
}
|
|
91
114
|
return { checks, refuted: checks.some((c) => c.status === "failed") };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-requires.js","sourceRoot":"","sources":["../../src/release/check-requires.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"check-requires.js","sourceRoot":"","sources":["../../src/release/check-requires.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAA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Q,CAAC,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** One `controllers:` candidate, already parsed by the caller's PURL parser.
|
|
2
|
+
* Taking parsed candidates rather than manifest text is deliberate: a second
|
|
3
|
+
* PURL grammar here would drift from the one the loader and `publish` use the
|
|
4
|
+
* moment a qualifier moves, and this decides what gets pushed to a registry. */
|
|
5
|
+
export interface ControllerCandidate {
|
|
6
|
+
readonly packageName: string;
|
|
7
|
+
readonly versionSpec: string;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
/** The candidate's `local_path` qualifier, already resolved to an absolute
|
|
10
|
+
* path by the caller's parser — the package directory as the PURL states it,
|
|
11
|
+
* rather than as a directory-name convention guesses it. */
|
|
12
|
+
readonly localPath?: string;
|
|
13
|
+
}
|
|
14
|
+
/** A `pkg:npm/<name>@<version>` controller candidate this module owns. */
|
|
15
|
+
export interface OwnedNpmPackage {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/** The version the manifest pins, which must be the module's own. */
|
|
18
|
+
readonly pinnedVersion: string;
|
|
19
|
+
readonly directory: string;
|
|
20
|
+
readonly packageVersion: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The npm packages this module's manifest names and this module's own directory
|
|
24
|
+
* provides. A PURL naming someone else's package resolves from npm as usual and
|
|
25
|
+
* is not returned.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ownedNpmPackages(controllers: readonly ControllerCandidate[], moduleDir: string): OwnedNpmPackage[];
|
|
28
|
+
/**
|
|
29
|
+
* Why this package cannot be published as it stands, or undefined.
|
|
30
|
+
*
|
|
31
|
+
* A module has ONE version, and a manifest that pins a different one is how the
|
|
32
|
+
* old arrangement failed silently: the package kept moving with its module while
|
|
33
|
+
* the PURL stayed behind, so consumers loaded a tarball years older than the
|
|
34
|
+
* manifest describing it. Stated here rather than repaired, because which of the
|
|
35
|
+
* three is wrong is the author's to say.
|
|
36
|
+
*/
|
|
37
|
+
export declare function describeVersionSkew(owned: OwnedNpmPackage, moduleVersion: string | undefined): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Whether npm already has this exact version.
|
|
40
|
+
*
|
|
41
|
+
* An UNREACHABLE registry classifies nothing — the rule `publishedTeloVersions`
|
|
42
|
+
* already follows. `npm view` exits non-zero both for a version that does not
|
|
43
|
+
* exist and for a network or auth failure, and reading the second as the first
|
|
44
|
+
* sends the command on to `npm publish`, where the real cause surfaces as npm's
|
|
45
|
+
* message instead of this one. So only the E404 signal answers "not published";
|
|
46
|
+
* anything else is rethrown with what was actually being asked.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isPublished(name: string, version: string): Promise<boolean>;
|
|
49
|
+
export declare function publishPackage(owned: OwnedNpmPackage): Promise<void>;
|
|
50
|
+
//# sourceMappingURL=npm-controller-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-controller-package.d.ts","sourceRoot":"","sources":["../../src/release/npm-controller-package.ts"],"names":[],"mappings":"AA4BA;;;iFAGiF;AACjF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;iEAE6D;IAC7D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,SAAS,mBAAmB,EAAE,EAC3C,SAAS,EAAE,MAAM,GAChB,eAAe,EAAE,CAuBnB;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CAcpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBjF;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1E"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishing a module's OWN npm package, for a module whose controller is
|
|
3
|
+
* delivered that way.
|
|
4
|
+
*
|
|
5
|
+
* Most modules bundle their controller into the module artifact, so nothing is
|
|
6
|
+
* fetched at load and there is no package to push. A module that cannot be
|
|
7
|
+
* bundled — one whose driver resolves a native binary relative to its own
|
|
8
|
+
* package directory — names `pkg:npm/<name>@<version>` instead, and that tarball
|
|
9
|
+
* has to exist for any consumer outside this checkout.
|
|
10
|
+
*
|
|
11
|
+
* Nothing was pushing it. Those packages moved from changesets to the module
|
|
12
|
+
* ledger (their version is their module's, so they are listed in
|
|
13
|
+
* `.changeset/config.json`'s `ignore`), and no publisher took over — which is
|
|
14
|
+
* why a module could ship a manifest naming a version of itself that npm had
|
|
15
|
+
* never seen. `telo publish` is where it belongs: it is what ships the module,
|
|
16
|
+
* and the two must go out together or the manifest names a tarball nobody has.
|
|
17
|
+
*
|
|
18
|
+
* Only a package the module OWNS is ever published: same directory, and the name
|
|
19
|
+
* the module's own PURL asks for. A dependency's package is not this module's to
|
|
20
|
+
* release.
|
|
21
|
+
*/
|
|
22
|
+
import { execFile } from "node:child_process";
|
|
23
|
+
import fs from "node:fs";
|
|
24
|
+
import path from "node:path";
|
|
25
|
+
import { promisify } from "node:util";
|
|
26
|
+
const run = promisify(execFile);
|
|
27
|
+
/**
|
|
28
|
+
* The npm packages this module's manifest names and this module's own directory
|
|
29
|
+
* provides. A PURL naming someone else's package resolves from npm as usual and
|
|
30
|
+
* is not returned.
|
|
31
|
+
*/
|
|
32
|
+
export function ownedNpmPackages(controllers, moduleDir) {
|
|
33
|
+
const owned = [];
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
for (const candidate of controllers) {
|
|
36
|
+
if (candidate.type !== "npm")
|
|
37
|
+
continue;
|
|
38
|
+
// The package directory comes from the candidate's own `local_path`, which
|
|
39
|
+
// is what the PURL already says it is. Assuming `<moduleDir>/nodejs` was a
|
|
40
|
+
// layout heuristic in the generic publish path — true of this repo and of
|
|
41
|
+
// nothing that guarantees it.
|
|
42
|
+
const directory = candidate.localPath ?? path.join(moduleDir, "nodejs");
|
|
43
|
+
const pkg = readPackageJson(path.join(directory, "package.json"));
|
|
44
|
+
if (!pkg?.name || !pkg.version || pkg.private)
|
|
45
|
+
continue;
|
|
46
|
+
if (candidate.packageName !== pkg.name)
|
|
47
|
+
continue;
|
|
48
|
+
if (!candidate.versionSpec || seen.has(candidate.versionSpec))
|
|
49
|
+
continue;
|
|
50
|
+
seen.add(candidate.versionSpec);
|
|
51
|
+
owned.push({
|
|
52
|
+
name: candidate.packageName,
|
|
53
|
+
pinnedVersion: candidate.versionSpec,
|
|
54
|
+
directory,
|
|
55
|
+
packageVersion: pkg.version,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return owned;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A package manifest, or undefined when there is none.
|
|
62
|
+
*
|
|
63
|
+
* A missing file is the ordinary answer for a module that ships no package.
|
|
64
|
+
* A MALFORMED one is not: it is the file this step reads to decide what gets
|
|
65
|
+
* pushed, so reading it as absent would silently skip the publish the caller
|
|
66
|
+
* asked for.
|
|
67
|
+
*/
|
|
68
|
+
function readPackageJson(file) {
|
|
69
|
+
let text;
|
|
70
|
+
try {
|
|
71
|
+
text = fs.readFileSync(file, "utf8");
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(text);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
throw new Error(`${file} is not valid JSON: ${err.message}. ` +
|
|
81
|
+
`It decides which package this module publishes, so it cannot be skipped.`, { cause: err });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Why this package cannot be published as it stands, or undefined.
|
|
86
|
+
*
|
|
87
|
+
* A module has ONE version, and a manifest that pins a different one is how the
|
|
88
|
+
* old arrangement failed silently: the package kept moving with its module while
|
|
89
|
+
* the PURL stayed behind, so consumers loaded a tarball years older than the
|
|
90
|
+
* manifest describing it. Stated here rather than repaired, because which of the
|
|
91
|
+
* three is wrong is the author's to say.
|
|
92
|
+
*/
|
|
93
|
+
export function describeVersionSkew(owned, moduleVersion) {
|
|
94
|
+
if (owned.packageVersion !== owned.pinnedVersion) {
|
|
95
|
+
return (`${owned.name}: the manifest pins ${owned.pinnedVersion} but the package is ` +
|
|
96
|
+
`${owned.packageVersion}. A module has one version across its manifest and its package.`);
|
|
97
|
+
}
|
|
98
|
+
if (moduleVersion && moduleVersion !== owned.packageVersion) {
|
|
99
|
+
return (`${owned.name}: the package is ${owned.packageVersion} but the module is ${moduleVersion}. ` +
|
|
100
|
+
`A module has one version across its manifest and its package.`);
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether npm already has this exact version.
|
|
106
|
+
*
|
|
107
|
+
* An UNREACHABLE registry classifies nothing — the rule `publishedTeloVersions`
|
|
108
|
+
* already follows. `npm view` exits non-zero both for a version that does not
|
|
109
|
+
* exist and for a network or auth failure, and reading the second as the first
|
|
110
|
+
* sends the command on to `npm publish`, where the real cause surfaces as npm's
|
|
111
|
+
* message instead of this one. So only the E404 signal answers "not published";
|
|
112
|
+
* anything else is rethrown with what was actually being asked.
|
|
113
|
+
*/
|
|
114
|
+
export async function isPublished(name, version) {
|
|
115
|
+
try {
|
|
116
|
+
const { stdout } = await run("npm", ["view", `${name}@${version}`, "version"], {
|
|
117
|
+
encoding: "utf8",
|
|
118
|
+
});
|
|
119
|
+
return stdout.trim() === version;
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
const output = `${err?.stderr ?? ""}${err?.stdout ?? ""}`;
|
|
123
|
+
if (/E404|code E404|is not in this registry|No match found/i.test(output))
|
|
124
|
+
return false;
|
|
125
|
+
throw new Error(`could not ask npm whether ${name}@${version} is published: ` +
|
|
126
|
+
`${err?.message ?? String(err)}. ` +
|
|
127
|
+
`Publishing was not attempted — an unreachable registry is not an answer.`, { cause: err });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export async function publishPackage(owned) {
|
|
131
|
+
await run("npm", ["publish", "--access", "public"], {
|
|
132
|
+
cwd: owned.directory,
|
|
133
|
+
encoding: "utf8",
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=npm-controller-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-controller-package.js","sourceRoot":"","sources":["../../src/release/npm-controller-package.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAyBhC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAA2C,EAC3C,SAAiB;IAEjB,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MA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