@plexus-ms/lib 0.118.0 → 0.120.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/bookkeeping.d.ts +6 -43
- package/dist/bookkeeping.d.ts.map +1 -1
- package/dist/bookkeeping.js +10 -65
- package/dist/bookkeeping.js.map +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +2 -11
- package/dist/changeset.js.map +1 -1
- package/dist/consumers.d.ts +15 -14
- package/dist/consumers.d.ts.map +1 -1
- package/dist/consumers.js +29 -25
- package/dist/consumers.js.map +1 -1
- package/dist/copier.d.ts +1 -1
- package/dist/copier.d.ts.map +1 -1
- package/dist/copier.js +1 -1
- package/dist/copier.js.map +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +5 -10
- package/dist/deploy.js.map +1 -1
- package/dist/deployTargets.js +1 -1
- package/dist/deployTargets.js.map +1 -1
- package/dist/doctor.d.ts +2 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +4 -4
- package/dist/doctor.js.map +1 -1
- package/dist/index.d.ts +8 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +9 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +18 -0
- package/dist/io.js.map +1 -1
- package/dist/manifest.d.ts +9 -9
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +15 -15
- package/dist/manifest.js.map +1 -1
- package/dist/need.d.ts +9 -9
- package/dist/need.d.ts.map +1 -1
- package/dist/need.js +17 -17
- package/dist/need.js.map +1 -1
- package/dist/propagate.d.ts +3 -3
- package/dist/propagate.d.ts.map +1 -1
- package/dist/propagate.js +14 -14
- package/dist/propagate.js.map +1 -1
- package/dist/requirements.d.ts +1 -1
- package/dist/requirements.d.ts.map +1 -1
- package/dist/requirements.js +2 -2
- package/dist/requirements.js.map +1 -1
- package/dist/summary.d.ts +10 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +51 -0
- package/dist/summary.js.map +1 -0
- package/dist/take.d.ts +14 -14
- package/dist/take.d.ts.map +1 -1
- package/dist/take.js +46 -40
- package/dist/take.js.map +1 -1
- package/dist/update.d.ts +4 -4
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +58 -56
- package/dist/update.js.map +1 -1
- package/dist/version.d.ts +20 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +32 -0
- package/dist/version.js.map +1 -0
- package/package.json +2 -2
- package/dist/preview.d.ts +0 -4
- package/dist/preview.d.ts.map +0 -1
- package/dist/preview.js +0 -60
- package/dist/preview.js.map +0 -1
- package/dist/self.d.ts +0 -5
- package/dist/self.d.ts.map +0 -1
- package/dist/self.js +0 -13
- package/dist/self.js.map +0 -1
- package/dist/ship.d.ts +0 -27
- package/dist/ship.d.ts.map +0 -1
- package/dist/ship.js +0 -296
- package/dist/ship.js.map +0 -1
- package/dist/train.d.ts +0 -82
- package/dist/train.d.ts.map +0 -1
- package/dist/train.js +0 -138
- package/dist/train.js.map +0 -1
package/dist/ship.js
DELETED
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
// ship: the release train (§ 1.5 PLX). Every train repo ships under ONE
|
|
2
|
-
// version, tagged identically whether or not it changed, in two phases:
|
|
3
|
-
//
|
|
4
|
-
// preflight (plx itself not behind its newest release, self.ts; every train
|
|
5
|
-
// repo on main, clean, not behind origin, the latest tags in agreement; gh
|
|
6
|
-
// logged in; no mutable release on any train repo)
|
|
7
|
-
// → phase one: primitives' bookkeeping (galaxy versions, the train-versioned
|
|
8
|
-
// packages' manifests, its own workflow refs), commit, tag, push, GitHub
|
|
9
|
-
// release — which locks the tag and runs primitives' release workflow
|
|
10
|
-
// → wait until the three packages are on npm at the train number
|
|
11
|
-
// → phase two: the presets' and the compendium's bookkeeping (collection
|
|
12
|
-
// pin, workflow refs, plx pins, the config pin and catalog entry, the map's version and
|
|
13
|
-
// timestamp, `changed` on every standard module whose requirements moved),
|
|
14
|
-
// commit, tag, push, release, repo by repo; the compendium last, its
|
|
15
|
-
// release created as a draft, given the train manifest (manifest.ts) and
|
|
16
|
-
// only then published, because an immutable release locks its assets
|
|
17
|
-
//
|
|
18
|
-
// and there it ends. Cutting a train and a repo taking it are separate events
|
|
19
|
-
// (§ 3 PLX-Updates): ship looks for no consumer and opens no pull request; a
|
|
20
|
-
// repo takes the train itself, when it needs it (update.ts). The dry run is
|
|
21
|
-
// the one place consumers still appear: it previews the unreleased presets
|
|
22
|
-
// against the workspace's consumers (preview.ts), a maintainer's test.
|
|
23
|
-
//
|
|
24
|
-
// The wait is what lets phase two pin the train number: the compendium's
|
|
25
|
-
// commit hook installs plx at that pin, and the presets hand it to every
|
|
26
|
-
// consumer. Substance commits stay human; ship writes only the mechanical
|
|
27
|
-
// bookkeeping. A failure between the first tag and the last release leaves a
|
|
28
|
-
// half-tagged train; the recovery is a re-run naming the same version, which
|
|
29
|
-
// skips the repos already tagged and the releases that exist. A release is
|
|
30
|
-
// never deleted: a deleted immutable release burns its number for good.
|
|
31
|
-
//
|
|
32
|
-
// plx ship ~/dev # next train = minor+1 over the latest
|
|
33
|
-
// plx ship ~/dev --train 1.0.0 # explicit train version
|
|
34
|
-
// plx -n ship ~/dev # preview: list the bookkeeping and tags, and
|
|
35
|
-
// # try the presets on the consumers in scratch clones
|
|
36
|
-
// plx -y ship ~/dev # unattended: no prompt
|
|
37
|
-
import { join } from 'node:path';
|
|
38
|
-
import { bumpCatalogPin, bumpCollectionPin, bumpConfigPin, bumpGalaxyVersion, bumpManifestVersion, bumpPlxPin, bumpRunnerImagePin, bumpWorkflowRefs, COLLECTIONS, CONFIG_PIN, galaxyFile, PLX_PIN, RUNNER_IMAGE_PIN_FILE, stampChanged, stampStandard, today as todayOf, WORKFLOW_REF, } from "./bookkeeping.js";
|
|
39
|
-
import { readCatalog } from "./catalog.js";
|
|
40
|
-
import { run, write } from "./effects.js";
|
|
41
|
-
import { frontmatterField } from "./frontmatter.js";
|
|
42
|
-
import { buildManifest, MANIFEST_FILE, renderManifest } from "./manifest.js";
|
|
43
|
-
import { previewConsumers } from "./preview.js";
|
|
44
|
-
import { extractRequirements, MAP_PAGE, modulePages } from "./requirements.js";
|
|
45
|
-
import { preflightSelf } from "./self.js";
|
|
46
|
-
import { emptySummary } from "./take.js";
|
|
47
|
-
import { COMPENDIUM, PRIMITIVES, phasesOf, preflightForge, preflightRelease, readTrain, resolveVersion, TRAIN_PACKAGES, UPSTREAM, } from "./train.js";
|
|
48
|
-
const DEFAULT_WAIT = { interval: 15_000, timeout: 20 * 60_000 };
|
|
49
|
-
export async function ship(ctx, options) {
|
|
50
|
-
const upstream = join(options.workspace, UPSTREAM);
|
|
51
|
-
if (options.plx)
|
|
52
|
-
await preflightSelf(ctx, options.plx);
|
|
53
|
-
const train = await readTrain(ctx, upstream);
|
|
54
|
-
await preflightForge(ctx);
|
|
55
|
-
await preflightRelease(ctx, train);
|
|
56
|
-
await preflightImmutable(ctx, train);
|
|
57
|
-
const next = resolveVersion(train, options.train, false);
|
|
58
|
-
await release(ctx, train, next, options.today ?? todayOf(), { ...DEFAULT_WAIT, ...options.wait });
|
|
59
|
-
if (ctx.dryRun)
|
|
60
|
-
return { ...(await previewConsumers(ctx, options.workspace, next)), released: true };
|
|
61
|
-
ctx.say(`• train ${next} is cut; every repo takes it itself, when it needs it (plx update)`);
|
|
62
|
-
return { ...emptySummary(next, false), released: true };
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* The immutable-releases setting is not readable through the API, but every
|
|
66
|
-
* release says whether it is immutable: a train repo whose newest release is
|
|
67
|
-
* mutable had the setting off when it was cut, and the train stops before
|
|
68
|
-
* another number is spent. A repo with no release yet is checked on its first
|
|
69
|
-
* one, right after creation (tagAndRelease).
|
|
70
|
-
*/
|
|
71
|
-
async function preflightImmutable(ctx, train) {
|
|
72
|
-
for (const repo of train.repos) {
|
|
73
|
-
const newest = (await ctx
|
|
74
|
-
.read('gh', ['api', 'repos/{owner}/{repo}/releases?per_page=1', '--jq', '.[0].immutable'], { cwd: repo.path })
|
|
75
|
-
.catch(() => '')).trim();
|
|
76
|
-
if (newest === 'false')
|
|
77
|
-
throw new Error(mutableRelease(`${repo.name}: its newest GitHub release is not immutable`));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const mutableRelease = (what) => `${what} — enable immutable releases on the plexus-ms organisation (Settings → General → Releases); existing releases stay as they are (never delete one: a deleted immutable release burns its number)`;
|
|
81
|
-
async function release(ctx, train, next, today, wait) {
|
|
82
|
-
ctx.say(`→ train ${train.last ?? 'none'} → ${next}`);
|
|
83
|
-
for (const repo of train.repos) {
|
|
84
|
-
if (repo.pending.length === 0)
|
|
85
|
-
ctx.say(` ${repo.name}: no changes since ${repo.latest} — tag only`);
|
|
86
|
-
else {
|
|
87
|
-
ctx.say(` ${repo.name} (since ${repo.latest ?? 'the beginning'}):`);
|
|
88
|
-
for (const line of repo.pending.slice(0, PENDING_SHOWN))
|
|
89
|
-
ctx.say(` ${line}`);
|
|
90
|
-
if (repo.pending.length > PENDING_SHOWN)
|
|
91
|
-
ctx.say(` … and ${repo.pending.length - PENDING_SHOWN} more`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (!(await ctx.confirm(`tag all ${train.repos.length} repos as ${next}, release them and push?`)))
|
|
95
|
-
throw new Error('aborted');
|
|
96
|
-
const [one = [], two = []] = phasesOf(train);
|
|
97
|
-
try {
|
|
98
|
-
await releasePhase(ctx, train, one, next, today);
|
|
99
|
-
await awaitPublished(ctx, next, wait);
|
|
100
|
-
await releasePhase(ctx, train, two, next, today);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
104
|
-
throw new Error(`${message}\n✗ ship stopped during the release; re-run with --train ${next} to finish it (tagged repos and existing releases are skipped; if the registry already has ${next}, update plx first: it is the same code, built from the commit phase one tagged)`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/** A repo never tagged lists its whole history as pending; this many lines of it are shown. */
|
|
108
|
-
const PENDING_SHOWN = 20;
|
|
109
|
-
/** One phase: the bookkeeping of its repos, then each tagged, pushed and released. */
|
|
110
|
-
async function releasePhase(ctx, train, repos, next, today) {
|
|
111
|
-
ctx.say(`→ phase: ${repos.map((r) => r.name).join(', ')}`);
|
|
112
|
-
await ctx.apply(await planBookkeeping(ctx, train, repos, next, today));
|
|
113
|
-
for (const repo of repos)
|
|
114
|
-
await tagAndRelease(ctx, repo, next, today);
|
|
115
|
-
}
|
|
116
|
-
async function tagAndRelease(ctx, repo, next, today) {
|
|
117
|
-
const tagged = await ctx
|
|
118
|
-
.read('git', ['rev-parse', '-q', '--verify', `refs/tags/${next}`], { cwd: repo.path })
|
|
119
|
-
.then(() => true)
|
|
120
|
-
.catch(() => false);
|
|
121
|
-
if (tagged)
|
|
122
|
-
ctx.say(`• ${repo.name}: already tagged ${next}`);
|
|
123
|
-
else
|
|
124
|
-
await ctx.apply([run('git', ['tag', '-a', next, '-m', `train ${next}`], { cwd: repo.path })]);
|
|
125
|
-
await ctx.apply([run('git', ['push', 'origin', 'main', next], { cwd: repo.path })]);
|
|
126
|
-
// The GitHub release is what makes the tag immutable, and on primitives it
|
|
127
|
-
// is what triggers the publish: nothing is ever published from a tag that
|
|
128
|
-
// can still move. --verify-tag refuses to create a tag of its own.
|
|
129
|
-
const create = ['release', 'create', next, '--verify-tag', '--generate-notes', '--title', next];
|
|
130
|
-
if (repo.name === COMPENDIUM) {
|
|
131
|
-
if (!(await releaseWithManifest(ctx, repo, next, today, create)))
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
const released = await ctx
|
|
136
|
-
.read('gh', ['release', 'view', next], { cwd: repo.path })
|
|
137
|
-
.then(() => true)
|
|
138
|
-
.catch(() => false);
|
|
139
|
-
if (released) {
|
|
140
|
-
ctx.say(`• ${repo.name}: release ${next} exists`);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
await ctx.apply([run('gh', create, { cwd: repo.path })]);
|
|
144
|
-
}
|
|
145
|
-
if (ctx.dryRun)
|
|
146
|
-
return;
|
|
147
|
-
const immutable = (await ctx.read('gh', ['api', `repos/{owner}/{repo}/releases/tags/${next}`, '--jq', '.immutable'], {
|
|
148
|
-
cwd: repo.path,
|
|
149
|
-
})).trim();
|
|
150
|
-
if (immutable !== 'true')
|
|
151
|
-
throw new Error(mutableRelease(`${repo.name}: release ${next} was created mutable, and its tag can still move`));
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* The compendium's release carries the train manifest, and an immutable
|
|
155
|
-
* release locks its assets: so the release is created as a draft, the manifest
|
|
156
|
-
* uploaded to it, and only then published. Until then the train does not show
|
|
157
|
-
* to a repo asking for the trains (update.ts). A draft left by a run that
|
|
158
|
-
* stopped is taken up where it stands: the manifest uploaded again, then
|
|
159
|
-
* published. Resolves false when the release was published already.
|
|
160
|
-
*/
|
|
161
|
-
async function releaseWithManifest(ctx, repo, next, today, create) {
|
|
162
|
-
const state = (await ctx
|
|
163
|
-
.read('gh', ['release', 'view', next, '--json', 'isDraft', '--jq', '.isDraft'], { cwd: repo.path })
|
|
164
|
-
.catch(() => '')).trim();
|
|
165
|
-
if (state === 'false') {
|
|
166
|
-
ctx.say(`• ${repo.name}: release ${next} exists`);
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
if (state === 'true')
|
|
170
|
-
ctx.say(`• ${repo.name}: release ${next} is still a draft — finishing it`);
|
|
171
|
-
else
|
|
172
|
-
await ctx.apply([run('gh', [...create, '--draft'], { cwd: repo.path })]);
|
|
173
|
-
// Written from the checkout the tag was cut from, stamps included; under a
|
|
174
|
-
// dry run the stamps are only announced, so the upload is too.
|
|
175
|
-
const scratch = (await ctx.stage(run('mktemp', ['-d'])))?.trim() ?? '';
|
|
176
|
-
const file = join(scratch, MANIFEST_FILE);
|
|
177
|
-
try {
|
|
178
|
-
const manifest = buildManifest(await readCatalog(ctx, repo.path), next, today);
|
|
179
|
-
ctx.say(` ${repo.name}: ${MANIFEST_FILE}: train ${next}, ${manifest.modules.length} modules`);
|
|
180
|
-
await ctx.stage(write(file, renderManifest(manifest)));
|
|
181
|
-
await ctx.apply([
|
|
182
|
-
run('gh', ['release', 'upload', next, file, '--clobber'], { cwd: repo.path }),
|
|
183
|
-
run('gh', ['release', 'edit', next, '--draft=false'], { cwd: repo.path }),
|
|
184
|
-
]);
|
|
185
|
-
}
|
|
186
|
-
finally {
|
|
187
|
-
if (scratch)
|
|
188
|
-
await ctx.stage(run('rm', ['-rf', scratch]));
|
|
189
|
-
}
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Between the phases: primitives' release workflow publishes the three
|
|
194
|
-
* train-versioned packages, and phase two pins them. Polled with the same
|
|
195
|
-
* question an operator would ask (`npm view <name>@<train> version`); the dry
|
|
196
|
-
* run names the wait and moves on.
|
|
197
|
-
*/
|
|
198
|
-
async function awaitPublished(ctx, next, wait) {
|
|
199
|
-
const names = TRAIN_PACKAGES.map((p) => p.name);
|
|
200
|
-
const list = names.map((n) => `${n}@${next}`).join(', ');
|
|
201
|
-
if (ctx.dryRun) {
|
|
202
|
-
ctx.say(`⏳ [dry-run] would wait for ${list} on npm (${PRIMITIVES}' release workflow publishes them)`);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
ctx.say(`⏳ waiting for ${list} on npm (${PRIMITIVES}' release workflow publishes them)`);
|
|
206
|
-
const started = Date.now();
|
|
207
|
-
let missing = [...names];
|
|
208
|
-
for (;;) {
|
|
209
|
-
const still = [];
|
|
210
|
-
for (const name of missing) {
|
|
211
|
-
// --prefer-online: npm otherwise answers from a packument it cached up to five minutes ago.
|
|
212
|
-
const seen = (await ctx.read('npm', ['view', `${name}@${next}`, 'version', '--prefer-online']).catch(() => '')).trim();
|
|
213
|
-
if (seen !== next)
|
|
214
|
-
still.push(name);
|
|
215
|
-
}
|
|
216
|
-
missing = still;
|
|
217
|
-
if (missing.length === 0)
|
|
218
|
-
break;
|
|
219
|
-
if (Date.now() - started >= wait.timeout)
|
|
220
|
-
throw new Error(`${missing.join(', ')} not on npm at ${next} after ${Math.round(wait.timeout / 60_000)} min — check the release workflow (gh run list -R plexus-ms/${PRIMITIVES})`);
|
|
221
|
-
await new Promise((resolve) => setTimeout(resolve, wait.interval));
|
|
222
|
-
}
|
|
223
|
-
ctx.say(` ✓ ${list} on npm`);
|
|
224
|
-
}
|
|
225
|
-
/** The bookkeeping writes of the given repos, then one commit per repo that has any. */
|
|
226
|
-
async function planBookkeeping(ctx, train, repos, next, today) {
|
|
227
|
-
const plan = [];
|
|
228
|
-
const touched = new Set();
|
|
229
|
-
const repo = (name) => repos.find((r) => r.name === name);
|
|
230
|
-
/** Plan a write when the transform changes the file, saying what it does; a missing file is left alone. */
|
|
231
|
-
const edit = async (r, rel, what, transform) => {
|
|
232
|
-
const path = join(r.path, rel);
|
|
233
|
-
const text = await ctx.readFile(path).catch(() => undefined);
|
|
234
|
-
if (text === undefined)
|
|
235
|
-
return;
|
|
236
|
-
const edited = transform(text);
|
|
237
|
-
if (edited === text)
|
|
238
|
-
return;
|
|
239
|
-
ctx.say(` ${r.name}: ${rel}: ${what}`);
|
|
240
|
-
plan.push(write(path, edited));
|
|
241
|
-
touched.add(r);
|
|
242
|
-
};
|
|
243
|
-
/** The tracked files of a repo containing a string, by pathspec. */
|
|
244
|
-
const grep = async (r, needle, pathspecs) => (await ctx.read('git', ['grep', '-l', needle, '--', ...pathspecs], { cwd: r.path }).catch(() => ''))
|
|
245
|
-
.split('\n')
|
|
246
|
-
.filter(Boolean);
|
|
247
|
-
const primitives = repo(PRIMITIVES);
|
|
248
|
-
if (primitives) {
|
|
249
|
-
for (const c of COLLECTIONS)
|
|
250
|
-
await edit(primitives, galaxyFile(c), `plexus.${c} version → ${next}`, (t) => bumpGalaxyVersion(t, next));
|
|
251
|
-
await edit(primitives, RUNNER_IMAGE_PIN_FILE, `runner image → ${next}`, (t) => bumpRunnerImagePin(t, next));
|
|
252
|
-
for (const p of TRAIN_PACKAGES)
|
|
253
|
-
await edit(primitives, `${p.dir}/package.json`, `${p.name} → ${next}`, (t) => bumpManifestVersion(t, next));
|
|
254
|
-
}
|
|
255
|
-
// Only the pins of the plexus.* collections: a collection from elsewhere in the same file stays untouched.
|
|
256
|
-
const operationsPreset = repo('preset-repo-operations');
|
|
257
|
-
if (operationsPreset)
|
|
258
|
-
await edit(operationsPreset, 'template/requirements.yml', `plexus.* pins → ${next}`, (t) => bumpCollectionPin(t, next));
|
|
259
|
-
for (const r of repos) {
|
|
260
|
-
for (const f of await grep(r, WORKFLOW_REF, ['*.yml', '*.yaml', '*.jinja']))
|
|
261
|
-
await edit(r, f, `workflow refs → @${next}`, (t) => bumpWorkflowRefs(t, next));
|
|
262
|
-
for (const f of await grep(r, PLX_PIN, ['*.toml', '*.toml.jinja']))
|
|
263
|
-
await edit(r, f, `plx pin → ${next}`, (t) => bumpPlxPin(t, next));
|
|
264
|
-
for (const f of await grep(r, `"${CONFIG_PIN}"`, ['*package.json', '*package.json.jinja']))
|
|
265
|
-
await edit(r, f, `${CONFIG_PIN} pin → ${next}`, (t) => bumpConfigPin(t, next));
|
|
266
|
-
for (const f of await grep(r, `"${CONFIG_PIN}"`, ['*pnpm-workspace.yaml', '*pnpm-workspace.yaml.jinja']))
|
|
267
|
-
await edit(r, f, `${CONFIG_PIN} catalog entry → ${next}`, (t) => bumpCatalogPin(t, next));
|
|
268
|
-
}
|
|
269
|
-
// The map carries the train version and the date it was cut (§ 1.5 PLX); a
|
|
270
|
-
// standard module is stamped `changed` when its extracted requirement lines
|
|
271
|
-
// differ from the previous train's, read with the same extractor the
|
|
272
|
-
// compendium's check runs, so the two never disagree.
|
|
273
|
-
const comp = repo('compendium');
|
|
274
|
-
if (comp) {
|
|
275
|
-
await edit(comp, MAP_PAGE, `version → ${next}, timestamp → ${today}`, (t) => stampStandard(t, next, today));
|
|
276
|
-
for (const page of await modulePages(ctx, comp.path)) {
|
|
277
|
-
const text = await ctx.readFile(join(comp.path, page));
|
|
278
|
-
if (frontmatterField(text, 'maturity') !== 'standard')
|
|
279
|
-
continue;
|
|
280
|
-
const previous = comp.tag
|
|
281
|
-
? await ctx.read('git', ['show', `${comp.tag}:${page}`], { cwd: comp.path }).catch(() => '')
|
|
282
|
-
: '';
|
|
283
|
-
if (extractRequirements(text).join('\n') === extractRequirements(previous).join('\n'))
|
|
284
|
-
continue;
|
|
285
|
-
await edit(comp, page, `requirements changed since ${comp.latest ?? 'the beginning'} → changed: ${next}`, (t) => stampChanged(t, next));
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
for (const r of train.repos) {
|
|
289
|
-
if (!touched.has(r))
|
|
290
|
-
continue;
|
|
291
|
-
plan.push(run('git', ['add', '-A'], { cwd: r.path }));
|
|
292
|
-
plan.push(run('git', ['commit', '--quiet', '-m', `chore: train ${next} bookkeeping`], { cwd: r.path }));
|
|
293
|
-
}
|
|
294
|
-
return plan;
|
|
295
|
-
}
|
|
296
|
-
//# sourceMappingURL=ship.js.map
|
package/dist/ship.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ship.js","sourceRoot":"","sources":["../src/ship.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wEAAwE;AACxE,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,qDAAqD;AACrD,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,mEAAmE;AACnE,2EAA2E;AAC3E,4FAA4F;AAC5F,+EAA+E;AAC/E,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACz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AAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,IAAI,cAAc,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1G,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/train.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { Context } from './context.ts';
|
|
2
|
-
/** The repo whose tag publishes the train-versioned packages; it is released first. */
|
|
3
|
-
export declare const PRIMITIVES = "primitives";
|
|
4
|
-
/**
|
|
5
|
-
* The repo whose releases are the trains as a repo outside the workspace sees
|
|
6
|
-
* them: it is released last, so a train shows there once it is cut everywhere,
|
|
7
|
-
* and its release carries the train manifest (manifest.ts).
|
|
8
|
-
*/
|
|
9
|
-
export declare const COMPENDIUM = "compendium";
|
|
10
|
-
/** The repos stamped with the train tag, in release order. */
|
|
11
|
-
export declare const TRAIN_REPOS: readonly ["primitives", "preset-repo-turbo", "preset-app-nextjs", "preset-repo-operations", "compendium"];
|
|
12
|
-
/**
|
|
13
|
-
* The train is cut in two phases: `primitives` alone, whose release publishes
|
|
14
|
-
* the train-versioned packages, then every other repo once those packages are
|
|
15
|
-
* on npm, because the presets and the compendium pin them at the train number
|
|
16
|
-
* and their commit hooks install the pin.
|
|
17
|
-
*/
|
|
18
|
-
export declare const PHASES: readonly (readonly string[])[];
|
|
19
|
-
/** The packages published at the train number from `primitives` (§ 1.6 PLX), by their directory there. */
|
|
20
|
-
export declare const TRAIN_PACKAGES: readonly [{
|
|
21
|
-
readonly name: "@plexus-ms/cli";
|
|
22
|
-
readonly dir: "packages/cli";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "@plexus-ms/cli-ci";
|
|
25
|
-
readonly dir: "packages/cli-ci";
|
|
26
|
-
}, {
|
|
27
|
-
readonly name: "@plexus-ms/lib";
|
|
28
|
-
readonly dir: "packages/lib";
|
|
29
|
-
}, {
|
|
30
|
-
readonly name: "@plexus-ms/config";
|
|
31
|
-
readonly dir: "packages/config";
|
|
32
|
-
}];
|
|
33
|
-
/** The umbrella directory holding the train repos, relative to the workspace. */
|
|
34
|
-
export declare const UPSTREAM = "plexus-ms";
|
|
35
|
-
/** A train version is plain semver, no `v` prefix (§ 1.5 PLX). */
|
|
36
|
-
export declare const isTrainVersion: (v: string) => boolean;
|
|
37
|
-
export declare function nextMinor(version: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* The newest train tag of a repo across both eras (`v0.21` and `0.22.0`),
|
|
40
|
-
* compared numerically on the v-stripped form: a plain version sort would rank
|
|
41
|
-
* every v-tag above every plain tag. A prerelease tag (`0.100.0-rc.1`, a
|
|
42
|
-
* publishing rehearsal) is not a train and never the latest.
|
|
43
|
-
*/
|
|
44
|
-
export declare function latestTag(tags: string[]): string | undefined;
|
|
45
|
-
export interface TrainRepo {
|
|
46
|
-
name: string;
|
|
47
|
-
path: string;
|
|
48
|
-
/** The latest tag as git has it; undefined for a repo never tagged. */
|
|
49
|
-
tag?: string;
|
|
50
|
-
/** The same, v-stripped: the train version it names. */
|
|
51
|
-
latest?: string;
|
|
52
|
-
/** `git log --oneline` since the latest tag. */
|
|
53
|
-
pending: string[];
|
|
54
|
-
}
|
|
55
|
-
export interface Train {
|
|
56
|
-
repos: TrainRepo[];
|
|
57
|
-
/** The highest tag across all repos, v-stripped. */
|
|
58
|
-
last?: string;
|
|
59
|
-
/** True when the repos' latest tags disagree: a run that stopped mid-tag. */
|
|
60
|
-
skew: boolean;
|
|
61
|
-
}
|
|
62
|
-
/** Fetch every train repo and read its tags and pending commits. */
|
|
63
|
-
export declare function readTrain(ctx: Context, upstream: string): Promise<Train>;
|
|
64
|
-
/** The train's repos in release order, grouped by phase. */
|
|
65
|
-
export declare const phasesOf: (train: Train) => TrainRepo[][];
|
|
66
|
-
/** Every train repo on main, clean, and not behind origin; throws naming the first offender. */
|
|
67
|
-
export declare function preflightRelease(ctx: Context, train: Train): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* The forge CLI is what creates the releases and the consumers' pull requests;
|
|
70
|
-
* an expired login is found here, before anything is written.
|
|
71
|
-
*/
|
|
72
|
-
export declare function preflightForge(ctx: Context): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* The version a run releases or propagates. `propagateOnly` takes the current
|
|
75
|
-
* train; a release takes the explicit version or the next minor, refusing to
|
|
76
|
-
* derive one while the repos' tags disagree.
|
|
77
|
-
*/
|
|
78
|
-
export declare function resolveVersion(train: Train, explicit: string | undefined, propagateOnly: boolean): string;
|
|
79
|
-
/** A mistake in the arguments, as opposed to a failed run: exit code 2 in the CLI. */
|
|
80
|
-
export declare class UsageError extends Error {
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=train.d.ts.map
|
package/dist/train.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"train.d.ts","sourceRoot":"","sources":["../src/train.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,uFAAuF;AACvF,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,WAAW,2GAMd,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAgE,CAAC;AAElH,0GAA0G;AAC1G,eAAO,MAAM,cAAc;;;;;;;;;;;;EAKjB,CAAC;AAEX,iFAAiF;AACjF,eAAO,MAAM,QAAQ,cAAc,CAAC;AAEpC,kEAAkE;AAClE,eAAO,MAAM,cAAc,GAAI,G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 -1,138 +0,0 @@
|
|
|
1
|
-
// The train (§ 1.5 PLX): one version, tagged identically on every train repo
|
|
2
|
-
// whether or not it changed. This file reads the train's state from the
|
|
3
|
-
// upstream umbrella (the `plexus-ms` directory of a workspace) and decides the
|
|
4
|
-
// next version; `ship` acts on it.
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { compareTrains } from "./doctor.js";
|
|
7
|
-
/** The repo whose tag publishes the train-versioned packages; it is released first. */
|
|
8
|
-
export const PRIMITIVES = 'primitives';
|
|
9
|
-
/**
|
|
10
|
-
* The repo whose releases are the trains as a repo outside the workspace sees
|
|
11
|
-
* them: it is released last, so a train shows there once it is cut everywhere,
|
|
12
|
-
* and its release carries the train manifest (manifest.ts).
|
|
13
|
-
*/
|
|
14
|
-
export const COMPENDIUM = 'compendium';
|
|
15
|
-
/** The repos stamped with the train tag, in release order. */
|
|
16
|
-
export const TRAIN_REPOS = [
|
|
17
|
-
PRIMITIVES,
|
|
18
|
-
'preset-repo-turbo',
|
|
19
|
-
'preset-app-nextjs',
|
|
20
|
-
'preset-repo-operations',
|
|
21
|
-
COMPENDIUM,
|
|
22
|
-
];
|
|
23
|
-
/**
|
|
24
|
-
* The train is cut in two phases: `primitives` alone, whose release publishes
|
|
25
|
-
* the train-versioned packages, then every other repo once those packages are
|
|
26
|
-
* on npm, because the presets and the compendium pin them at the train number
|
|
27
|
-
* and their commit hooks install the pin.
|
|
28
|
-
*/
|
|
29
|
-
export const PHASES = [[PRIMITIVES], TRAIN_REPOS.filter((r) => r !== PRIMITIVES)];
|
|
30
|
-
/** The packages published at the train number from `primitives` (§ 1.6 PLX), by their directory there. */
|
|
31
|
-
export const TRAIN_PACKAGES = [
|
|
32
|
-
{ name: '@plexus-ms/cli', dir: 'packages/cli' },
|
|
33
|
-
{ name: '@plexus-ms/cli-ci', dir: 'packages/cli-ci' },
|
|
34
|
-
{ name: '@plexus-ms/lib', dir: 'packages/lib' },
|
|
35
|
-
{ name: '@plexus-ms/config', dir: 'packages/config' },
|
|
36
|
-
];
|
|
37
|
-
/** The umbrella directory holding the train repos, relative to the workspace. */
|
|
38
|
-
export const UPSTREAM = 'plexus-ms';
|
|
39
|
-
/** A train version is plain semver, no `v` prefix (§ 1.5 PLX). */
|
|
40
|
-
export const isTrainVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
|
|
41
|
-
export function nextMinor(version) {
|
|
42
|
-
const [major = '0', minor = '0'] = version.split('.');
|
|
43
|
-
return `${major}.${Number(minor) + 1}.0`;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The newest train tag of a repo across both eras (`v0.21` and `0.22.0`),
|
|
47
|
-
* compared numerically on the v-stripped form: a plain version sort would rank
|
|
48
|
-
* every v-tag above every plain tag. A prerelease tag (`0.100.0-rc.1`, a
|
|
49
|
-
* publishing rehearsal) is not a train and never the latest.
|
|
50
|
-
*/
|
|
51
|
-
export function latestTag(tags) {
|
|
52
|
-
return tags
|
|
53
|
-
.filter((t) => /^v?\d+(\.\d+){1,2}$/.test(t))
|
|
54
|
-
.sort((a, b) => compareTrains(a.replace(/^v/, ''), b.replace(/^v/, '')))
|
|
55
|
-
.at(-1);
|
|
56
|
-
}
|
|
57
|
-
/** Fetch every train repo and read its tags and pending commits. */
|
|
58
|
-
export async function readTrain(ctx, upstream) {
|
|
59
|
-
const repos = [];
|
|
60
|
-
const all = new Set();
|
|
61
|
-
for (const name of TRAIN_REPOS) {
|
|
62
|
-
const path = join(upstream, name);
|
|
63
|
-
try {
|
|
64
|
-
await ctx.read('git', ['rev-parse', '--git-dir'], { cwd: path });
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
throw new Error(`${path} is not a git repo`);
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
await ctx.read('git', ['fetch', 'origin', '--tags', '--quiet'], { cwd: path });
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
throw new Error(`${name}: fetch from origin failed`);
|
|
74
|
-
}
|
|
75
|
-
const tags = (await ctx.read('git', ['tag', '--list', 'v*', '[0-9]*'], { cwd: path })).split('\n').filter(Boolean);
|
|
76
|
-
for (const t of tags)
|
|
77
|
-
all.add(t.replace(/^v/, ''));
|
|
78
|
-
const tag = latestTag(tags);
|
|
79
|
-
const range = tag ? `${tag}..HEAD` : 'HEAD';
|
|
80
|
-
const pending = (await ctx.read('git', ['log', '--oneline', range], { cwd: path })).split('\n').filter(Boolean);
|
|
81
|
-
repos.push({ name, path, tag, latest: tag?.replace(/^v/, ''), pending });
|
|
82
|
-
}
|
|
83
|
-
const latest = repos.map((r) => r.latest);
|
|
84
|
-
return { repos, last: latestTag([...all]), skew: latest.some((l) => l !== latest[0]) };
|
|
85
|
-
}
|
|
86
|
-
/** The train's repos in release order, grouped by phase. */
|
|
87
|
-
export const phasesOf = (train) => PHASES.map((names) => train.repos.filter((r) => names.includes(r.name)));
|
|
88
|
-
/** Every train repo on main, clean, and not behind origin; throws naming the first offender. */
|
|
89
|
-
export async function preflightRelease(ctx, train) {
|
|
90
|
-
for (const { name, path } of train.repos) {
|
|
91
|
-
const branch = (await ctx.read('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: path })).trim();
|
|
92
|
-
if (branch !== 'main')
|
|
93
|
-
throw new Error(`${name} is on '${branch}', trains cut from main`);
|
|
94
|
-
if ((await ctx.read('git', ['status', '--porcelain'], { cwd: path })).trim() !== '')
|
|
95
|
-
throw new Error(`${name} has uncommitted changes — commit first`);
|
|
96
|
-
const behind = (await ctx.read('git', ['rev-list', '--count', 'main..origin/main'], { cwd: path })).trim();
|
|
97
|
-
if (behind !== '0')
|
|
98
|
-
throw new Error(`${name} is ${behind} commit(s) behind origin/main — pull first, or the tag lands on a stale commit`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* The forge CLI is what creates the releases and the consumers' pull requests;
|
|
103
|
-
* an expired login is found here, before anything is written.
|
|
104
|
-
*/
|
|
105
|
-
export async function preflightForge(ctx) {
|
|
106
|
-
try {
|
|
107
|
-
await ctx.read('gh', ['auth', 'status']);
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
throw new Error('gh is not logged in (gh auth status failed) — run gh auth login first');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* The version a run releases or propagates. `propagateOnly` takes the current
|
|
115
|
-
* train; a release takes the explicit version or the next minor, refusing to
|
|
116
|
-
* derive one while the repos' tags disagree.
|
|
117
|
-
*/
|
|
118
|
-
export function resolveVersion(train, explicit, propagateOnly) {
|
|
119
|
-
if (explicit !== undefined && !isTrainVersion(explicit))
|
|
120
|
-
throw new UsageError(`'${explicit}' is not plain semver (X.Y.Z, no v)`);
|
|
121
|
-
if (propagateOnly) {
|
|
122
|
-
const v = explicit ?? train.last;
|
|
123
|
-
if (!v)
|
|
124
|
-
throw new Error('no train version found to propagate');
|
|
125
|
-
return v;
|
|
126
|
-
}
|
|
127
|
-
if (explicit)
|
|
128
|
-
return explicit;
|
|
129
|
-
if (train.skew) {
|
|
130
|
-
const report = train.repos.map((r) => ` ${r.name}: ${r.latest ?? 'none'}`).join('\n');
|
|
131
|
-
throw new Error(`the train repos' latest tags disagree:\n${report}\npass the version explicitly (--train ${train.last}) to finish the half-tagged train, or a higher one to start a new one`);
|
|
132
|
-
}
|
|
133
|
-
return train.last ? nextMinor(train.last) : '0.1.0';
|
|
134
|
-
}
|
|
135
|
-
/** A mistake in the arguments, as opposed to a failed run: exit code 2 in the CLI. */
|
|
136
|
-
export class UsageError extends Error {
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=train.js.map
|
package/dist/train.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"train.js","sourceRoot":"","sources":["../src/train.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wEAAwE;AACxE,+EAA+E;AAC/E,mCAAmC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEj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