@fairgarden/distribution 0.1.0-alpha.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/Readme.md +94 -0
- package/dist/add-module.d.ts +58 -0
- package/dist/add-module.d.ts.map +1 -0
- package/dist/add-module.js +250 -0
- package/dist/add-module.js.map +1 -0
- package/dist/canary.d.ts +58 -0
- package/dist/canary.d.ts.map +1 -0
- package/dist/canary.js +117 -0
- package/dist/canary.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +747 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-edit.d.ts +18 -0
- package/dist/config-edit.d.ts.map +1 -0
- package/dist/config-edit.js +166 -0
- package/dist/config-edit.js.map +1 -0
- package/dist/extends.d.ts +59 -0
- package/dist/extends.d.ts.map +1 -0
- package/dist/extends.js +163 -0
- package/dist/extends.js.map +1 -0
- package/dist/extract.d.ts +31 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +177 -0
- package/dist/extract.js.map +1 -0
- package/dist/git-url.d.ts +19 -0
- package/dist/git-url.d.ts.map +1 -0
- package/dist/git-url.js +55 -0
- package/dist/git-url.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/overrides.d.ts +32 -0
- package/dist/overrides.d.ts.map +1 -0
- package/dist/overrides.js +81 -0
- package/dist/overrides.js.map +1 -0
- package/dist/readme.d.ts +58 -0
- package/dist/readme.d.ts.map +1 -0
- package/dist/readme.js +299 -0
- package/dist/readme.js.map +1 -0
- package/dist/release.d.ts +140 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +409 -0
- package/dist/release.js.map +1 -0
- package/dist/scaffold.d.ts +46 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +389 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/submodules.d.ts +95 -0
- package/dist/submodules.d.ts.map +1 -0
- package/dist/submodules.js +225 -0
- package/dist/submodules.js.map +1 -0
- package/dist/workflows.d.ts +57 -0
- package/dist/workflows.d.ts.map +1 -0
- package/dist/workflows.js +358 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +51 -0
package/dist/release.js
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { appendFile, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import semver from 'semver';
|
|
5
|
+
import { isPublic } from "./canary.js";
|
|
6
|
+
import { writeReadmes } from "./readme.js";
|
|
7
|
+
import { isDistribution } from "./submodules.js";
|
|
8
|
+
/** Run git, returning undefined rather than throwing when it fails. */
|
|
9
|
+
const git = (cwd, args) => {
|
|
10
|
+
try {
|
|
11
|
+
return execFileSync('git', args, {
|
|
12
|
+
cwd,
|
|
13
|
+
encoding: 'utf8',
|
|
14
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
15
|
+
}).trim();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/** Run git for effect, letting a failure surface. */
|
|
22
|
+
const run = (cwd, args) => {
|
|
23
|
+
execFileSync('git', args, { cwd, stdio: ['ignore', 'inherit', 'inherit'] });
|
|
24
|
+
};
|
|
25
|
+
export class ReleaseError extends Error {
|
|
26
|
+
}
|
|
27
|
+
const maintenanceBranch = (version) => `v${version.major}-${version.minor}`;
|
|
28
|
+
/**
|
|
29
|
+
* Work out what a release leaves behind.
|
|
30
|
+
*
|
|
31
|
+
* Main always carries the next unreleased version, so the release is the moment
|
|
32
|
+
* main moves on. Which way it moves is a decision nobody else can make: a minor
|
|
33
|
+
* is the usual answer, a major says something was removed or changed meaning,
|
|
34
|
+
* and a patch says this branch *is* the line and stays on it.
|
|
35
|
+
*/
|
|
36
|
+
export const planRelease = (released, { bump, id } = {}) => {
|
|
37
|
+
const parsed = semver.parse(released);
|
|
38
|
+
if (!parsed) {
|
|
39
|
+
throw new ReleaseError(`\`${released}\` is not a version this can release.`);
|
|
40
|
+
}
|
|
41
|
+
// A prerelease is not a line anyone maintains — there is no 2.0.0-alpha.0
|
|
42
|
+
// that someone is still running and needs a fix for — so it only moves
|
|
43
|
+
// forward, along its own identifier or on to the next one.
|
|
44
|
+
if (parsed.prerelease.length > 0) {
|
|
45
|
+
// Without an identifier, carry on with the one the version already has.
|
|
46
|
+
// Defaulting to `alpha` would take 2.0.0-beta.2 back to 2.0.0-alpha.0,
|
|
47
|
+
// which is lower than what is already published.
|
|
48
|
+
const carries = String(parsed.prerelease[0]);
|
|
49
|
+
const next = !id || id === carries
|
|
50
|
+
? semver.inc(released, 'prerelease')
|
|
51
|
+
: semver.inc(released, 'prerelease', id);
|
|
52
|
+
if (!next)
|
|
53
|
+
throw new ReleaseError(`Cannot advance \`${released}\`.`);
|
|
54
|
+
if (semver.lte(next, released)) {
|
|
55
|
+
throw new ReleaseError(`Moving ${released} to ${next} would go backwards. ` +
|
|
56
|
+
`\`${carries}\` is already past \`${id}\`.`);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
released,
|
|
60
|
+
maintenance: undefined,
|
|
61
|
+
next: { branch: releaseBranch(next), version: next },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (!bump) {
|
|
65
|
+
throw new ReleaseError(`Say which way ${released} moves on: --patch, --minor or --major. ` +
|
|
66
|
+
'Run with --dry-run to see what each would do.');
|
|
67
|
+
}
|
|
68
|
+
const nextVersion = semver.inc(released, bump);
|
|
69
|
+
if (!nextVersion)
|
|
70
|
+
throw new ReleaseError(`Cannot take the next ${bump} after ${released}.`);
|
|
71
|
+
return {
|
|
72
|
+
released,
|
|
73
|
+
// A patch means this branch is the line that carries it, so it keeps going
|
|
74
|
+
// rather than handing off to a branch behind it. A minor or major means
|
|
75
|
+
// main leaves this line, and something has to stay behind for its fixes.
|
|
76
|
+
maintenance: bump === 'patch'
|
|
77
|
+
? undefined
|
|
78
|
+
: {
|
|
79
|
+
branch: maintenanceBranch(parsed),
|
|
80
|
+
version: `${parsed.major}.${parsed.minor}.${parsed.patch + 1}`,
|
|
81
|
+
},
|
|
82
|
+
next: { branch: releaseBranch(nextVersion), version: nextVersion },
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Start the next line early, without main leaving the current one.
|
|
87
|
+
*
|
|
88
|
+
* Main is at 1.6.0 and still has 1.6.x and 1.7.0 to ship; 2.0.0 can be worked
|
|
89
|
+
* on anyway, on a branch of its own, published under a dist tag of its own.
|
|
90
|
+
* Nothing here touches main — that is the point.
|
|
91
|
+
*/
|
|
92
|
+
export const planPrerelease = (current, { bump, id = 'alpha' }) => {
|
|
93
|
+
const parsed = semver.parse(current);
|
|
94
|
+
if (!parsed) {
|
|
95
|
+
throw new ReleaseError(`\`${current}\` is not a version to branch from.`);
|
|
96
|
+
}
|
|
97
|
+
if (parsed.prerelease.length > 0) {
|
|
98
|
+
throw new ReleaseError(`${current} is already a prerelease. Move it along with \`fg-dist release\` instead.`);
|
|
99
|
+
}
|
|
100
|
+
const version = semver.inc(current, bump === 'major' ? 'premajor' : 'preminor', id);
|
|
101
|
+
if (!version)
|
|
102
|
+
throw new ReleaseError(`Cannot start a ${bump} prerelease after ${current}.`);
|
|
103
|
+
const next = semver.parse(version);
|
|
104
|
+
// The same name the line would get as a maintenance branch, because it is
|
|
105
|
+
// the same line: if it ships from here, this is where its fixes go.
|
|
106
|
+
const branch = bump === 'major' ? `v${next.major}` : `v${next.major}-${next.minor}`;
|
|
107
|
+
return { version, branch, from: current };
|
|
108
|
+
};
|
|
109
|
+
const releaseBranch = (version) => `release/v${version}`;
|
|
110
|
+
const manifestPath = (root) => path.join(root, 'package.json');
|
|
111
|
+
const readVersion = async (root) => {
|
|
112
|
+
const raw = await readFile(manifestPath(root), 'utf8').catch(() => undefined);
|
|
113
|
+
if (!raw)
|
|
114
|
+
throw new ReleaseError('No package.json here. Run this inside a module.');
|
|
115
|
+
const version = JSON.parse(raw).version;
|
|
116
|
+
if (typeof version !== 'string') {
|
|
117
|
+
throw new ReleaseError('package.json has no version to release.');
|
|
118
|
+
}
|
|
119
|
+
return version;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Set the version in package.json, leaving the rest of the file untouched.
|
|
123
|
+
*
|
|
124
|
+
* Spliced rather than re-serialised: a manifest carries key order, comments in
|
|
125
|
+
* some tools, and whatever indentation the repository settled on, and a
|
|
126
|
+
* release is no occasion to reformat it.
|
|
127
|
+
*/
|
|
128
|
+
export const setVersion = (source, version) => {
|
|
129
|
+
// What the manifest actually parses to. Everything below is about finding
|
|
130
|
+
// where *that* value is written, rather than the first thing shaped like it:
|
|
131
|
+
// a `volta` or `engines` block can hold a "version" key of its own, and can
|
|
132
|
+
// sit above the real one.
|
|
133
|
+
const current = JSON.parse(source).version;
|
|
134
|
+
if (typeof current !== 'string') {
|
|
135
|
+
throw new ReleaseError('package.json has no version field to set.');
|
|
136
|
+
}
|
|
137
|
+
const online = [
|
|
138
|
+
...source.matchAll(/^([ \t]*)"version"([ \t]*):([ \t]*)"([^"]*)"/gm),
|
|
139
|
+
]
|
|
140
|
+
.filter((match) => match[4] === current)
|
|
141
|
+
// Shallowest indentation is the top level. A nested key holding the same
|
|
142
|
+
// string is indented further, by any formatter anyone actually uses.
|
|
143
|
+
.sort((a, b) => a[1].length - b[1].length);
|
|
144
|
+
const match = online[0];
|
|
145
|
+
if (match) {
|
|
146
|
+
return (source.slice(0, match.index) +
|
|
147
|
+
`${match[1]}"version"${match[2]}:${match[3]}"${version}"` +
|
|
148
|
+
source.slice(match.index + match[0].length));
|
|
149
|
+
}
|
|
150
|
+
// Written on one line, so there are no indents to compare. Anchor on the
|
|
151
|
+
// value, which is the best this can do without a JSON parser that records
|
|
152
|
+
// where it read things.
|
|
153
|
+
const escaped = current.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
154
|
+
const inline = new RegExp(`"version"(\\s*):(\\s*)"${escaped}"`).exec(source);
|
|
155
|
+
if (!inline)
|
|
156
|
+
throw new ReleaseError('package.json has no version field to set.');
|
|
157
|
+
return (source.slice(0, inline.index) +
|
|
158
|
+
`"version"${inline[1]}:${inline[2]}"${version}"` +
|
|
159
|
+
source.slice(inline.index + inline[0].length));
|
|
160
|
+
};
|
|
161
|
+
const writeVersion = async (root, version) => {
|
|
162
|
+
const source = await readFile(manifestPath(root), 'utf8');
|
|
163
|
+
await writeFile(manifestPath(root), setVersion(source, version));
|
|
164
|
+
};
|
|
165
|
+
/** A distribution is versioned by date and releases by moving submodule pins. */
|
|
166
|
+
const assertModule = (root) => {
|
|
167
|
+
if (isDistribution(root)) {
|
|
168
|
+
throw new ReleaseError('This is a distribution, not a module. A distribution is versioned by date; ' +
|
|
169
|
+
'release its modules individually, then `fg-dist bump` to take them.');
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
/** Read the release the repository is standing on, without changing anything. */
|
|
173
|
+
export const readRelease = async (root, { bump, id } = {}) => {
|
|
174
|
+
assertModule(root);
|
|
175
|
+
const released = await readVersion(root);
|
|
176
|
+
const plan = planRelease(released, { bump, id });
|
|
177
|
+
const tag = `v${released}`;
|
|
178
|
+
const tagged = git(root, ['rev-parse', '--verify', `refs/tags/${tag}`]) !== undefined;
|
|
179
|
+
return { ...plan, base: tagged ? tag : 'HEAD', tagged };
|
|
180
|
+
};
|
|
181
|
+
const currentBranch = (root) => {
|
|
182
|
+
const name = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
183
|
+
return name === 'HEAD' ? undefined : name;
|
|
184
|
+
};
|
|
185
|
+
const isDirty = (root) => (git(root, ['status', '--porcelain']) ?? '') !== '';
|
|
186
|
+
const branchExists = (root, branch) => git(root, ['rev-parse', '--verify', `refs/heads/${branch}`]) !== undefined;
|
|
187
|
+
/** Record the version in the readme, so it is visible where people browse. */
|
|
188
|
+
const recordVersion = async (root) => {
|
|
189
|
+
await writeReadmes(root);
|
|
190
|
+
};
|
|
191
|
+
const commitAll = (root, message) => {
|
|
192
|
+
run(root, ['add', '-A']);
|
|
193
|
+
run(root, ['commit', '-m', message]);
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Move a module on from the release it has just published.
|
|
197
|
+
*
|
|
198
|
+
* Two branches come out of it: `v1-6` where 1.6.x is maintained, and a pull
|
|
199
|
+
* request moving main to 1.7.0. The pull request is where main's bump gets
|
|
200
|
+
* reviewed like any other change; the maintenance branch is not a proposal, so
|
|
201
|
+
* it is just pushed.
|
|
202
|
+
*/
|
|
203
|
+
export const release = async (root, { bump, id, dryRun = false, push = true } = {}) => {
|
|
204
|
+
const plan = await readRelease(root, { bump, id });
|
|
205
|
+
if (dryRun)
|
|
206
|
+
return { plan, base: currentBranch(root) ?? 'HEAD', created: [], pushed: false, pullRequest: undefined };
|
|
207
|
+
// Both branches are cut from what is committed, and the bumps are committed
|
|
208
|
+
// on top. Anything already in the working tree would be swept into them.
|
|
209
|
+
if (isDirty(root)) {
|
|
210
|
+
throw new ReleaseError('The working tree has uncommitted changes. Commit or stash them before releasing.');
|
|
211
|
+
}
|
|
212
|
+
const startedOn = currentBranch(root);
|
|
213
|
+
if (!startedOn) {
|
|
214
|
+
throw new ReleaseError('HEAD is detached. Check out the branch you release from.');
|
|
215
|
+
}
|
|
216
|
+
for (const branch of [plan.maintenance?.branch, plan.next.branch]) {
|
|
217
|
+
if (branch && branchExists(root, branch)) {
|
|
218
|
+
throw new ReleaseError(`Branch \`${branch}\` already exists. Delete it or pick another version.`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const created = [];
|
|
222
|
+
try {
|
|
223
|
+
if (plan.maintenance) {
|
|
224
|
+
// Cut from the tag where possible: main may have moved on since the
|
|
225
|
+
// release, and those commits are not part of 1.6.x.
|
|
226
|
+
run(root, ['checkout', '-b', plan.maintenance.branch, plan.base]);
|
|
227
|
+
created.push(plan.maintenance.branch);
|
|
228
|
+
await writeVersion(root, plan.maintenance.version);
|
|
229
|
+
await recordVersion(root);
|
|
230
|
+
commitAll(root, `Open ${plan.maintenance.version} for maintenance`);
|
|
231
|
+
}
|
|
232
|
+
run(root, ['checkout', '-b', plan.next.branch, startedOn]);
|
|
233
|
+
created.push(plan.next.branch);
|
|
234
|
+
await writeVersion(root, plan.next.version);
|
|
235
|
+
await recordVersion(root);
|
|
236
|
+
commitAll(root, `Bump to ${plan.next.version}`);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
// Leave the branches for inspection rather than unwinding half a release,
|
|
240
|
+
// but not the edits: a commit that failed on a hook or a missing identity
|
|
241
|
+
// leaves them staged, and checking out would carry them onto main. The
|
|
242
|
+
// tree was clean on the way in, so everything here is ours to drop.
|
|
243
|
+
git(root, ['reset', '--hard', 'HEAD']);
|
|
244
|
+
git(root, ['checkout', startedOn]);
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
if (!push) {
|
|
248
|
+
git(root, ['checkout', startedOn]);
|
|
249
|
+
return { plan, base: startedOn, created, pushed: false, pullRequest: undefined };
|
|
250
|
+
}
|
|
251
|
+
// A push can fail for reasons that have nothing to do with the release — no
|
|
252
|
+
// origin, expired credentials, a branch already on the remote. The branches
|
|
253
|
+
// are made either way, so put the checkout back before the failure leaves
|
|
254
|
+
// someone standing somewhere they did not ask to be.
|
|
255
|
+
let pullRequest;
|
|
256
|
+
try {
|
|
257
|
+
for (const branch of created) {
|
|
258
|
+
run(root, ['push', '-u', 'origin', branch]);
|
|
259
|
+
}
|
|
260
|
+
pullRequest = openPullRequest(root, plan, startedOn);
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
// The branches are made and committed, so a rerun would only say they
|
|
264
|
+
// already exist. Say what is left to do instead.
|
|
265
|
+
throw new ReleaseError(`${error instanceof Error ? error.message : String(error)}\n\n` +
|
|
266
|
+
'The branches are made; only the push failed. Finish it with:\n' +
|
|
267
|
+
created.map((branch) => ` git push -u origin ${branch}`).join('\n'));
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
git(root, ['checkout', startedOn]);
|
|
271
|
+
}
|
|
272
|
+
return { plan, base: startedOn, created, pushed: true, pullRequest };
|
|
273
|
+
};
|
|
274
|
+
const openPullRequest = (root, plan, base) => {
|
|
275
|
+
const body = [
|
|
276
|
+
`\`${plan.released}\` is released. This moves ${base} on to the next unreleased version.`,
|
|
277
|
+
'',
|
|
278
|
+
plan.maintenance
|
|
279
|
+
? `Fixes to \`${plan.released}\` go to \`${plan.maintenance.branch}\`, which starts at \`${plan.maintenance.version}\`.`
|
|
280
|
+
: 'No maintenance branch: a prerelease has no line to maintain.',
|
|
281
|
+
].join('\n');
|
|
282
|
+
try {
|
|
283
|
+
return execFileSync('gh', [
|
|
284
|
+
'pr',
|
|
285
|
+
'create',
|
|
286
|
+
'--base',
|
|
287
|
+
base,
|
|
288
|
+
'--head',
|
|
289
|
+
plan.next.branch,
|
|
290
|
+
'--title',
|
|
291
|
+
`Bump to ${plan.next.version}`,
|
|
292
|
+
'--body',
|
|
293
|
+
body,
|
|
294
|
+
], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
// gh is not everywhere, and not having it should not undo a good release.
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Check that the version in the manifest is one that can be released.
|
|
303
|
+
*
|
|
304
|
+
* Main is meant to carry the next unreleased version, so finding that version
|
|
305
|
+
* already on npm means {@link release} has not run since the last one — and
|
|
306
|
+
* publishing would either fail or, worse, succeed as a republish.
|
|
307
|
+
*/
|
|
308
|
+
export const checkReleasable = async (root, { published } = {}) => {
|
|
309
|
+
const raw = await readFile(manifestPath(root), 'utf8').catch(() => undefined);
|
|
310
|
+
if (!raw)
|
|
311
|
+
throw new ReleaseError('No package.json here. Run this inside a module.');
|
|
312
|
+
const manifest = JSON.parse(raw);
|
|
313
|
+
const { name, version } = manifest;
|
|
314
|
+
if (typeof name !== 'string' || typeof version !== 'string') {
|
|
315
|
+
throw new ReleaseError('package.json needs a name and a version to release.');
|
|
316
|
+
}
|
|
317
|
+
const tag = `v${version}`;
|
|
318
|
+
// The workflow tags after it publishes, so a tag that is already here means
|
|
319
|
+
// a red job *after* an irreversible publish — and a later release would cut
|
|
320
|
+
// its maintenance branch from whatever that stale tag points at.
|
|
321
|
+
if (git(root, ['rev-parse', '--verify', `refs/tags/${tag}`])) {
|
|
322
|
+
throw new ReleaseError(`${tag} already exists here. Either ${version} has been released, or the ` +
|
|
323
|
+
'tag was written before it was. Move on to the next version first.');
|
|
324
|
+
}
|
|
325
|
+
const lookup = published ?? onNpm;
|
|
326
|
+
if (lookup(`${name}@${version}`)) {
|
|
327
|
+
// Published but untagged is where a release job that died between the two
|
|
328
|
+
// ends up. Rerunning cannot publish again, so the tag is all that is left.
|
|
329
|
+
throw new ReleaseError(`${name}@${version} is already on npm, and ${tag} does not exist here.\n` +
|
|
330
|
+
'If the release job failed after publishing, only the tag is missing:\n' +
|
|
331
|
+
` git tag ${tag} <the published commit> && git push origin ${tag}\n` +
|
|
332
|
+
'Otherwise run `fg-dist release` to move on to the next version.');
|
|
333
|
+
}
|
|
334
|
+
return { name, version, tag, provenance: isPublic(manifest) };
|
|
335
|
+
};
|
|
336
|
+
/** Whether npm has this exact version, as opposed to having no opinion. */
|
|
337
|
+
const onNpm = (spec) => {
|
|
338
|
+
try {
|
|
339
|
+
const value = execFileSync('npm', ['view', spec, 'version'], {
|
|
340
|
+
encoding: 'utf8',
|
|
341
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
342
|
+
}).trim();
|
|
343
|
+
return value === '' ? undefined : value;
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// No such version, or no registry to ask. Neither blocks a release: npm
|
|
347
|
+
// itself refuses a duplicate, so this check is a clearer message, not the
|
|
348
|
+
// guard of last resort.
|
|
349
|
+
return undefined;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
/** Hand the version to the workflow steps that tag and publish it. */
|
|
353
|
+
export const reportToActions = async (releasable) => {
|
|
354
|
+
const output = process.env.GITHUB_OUTPUT;
|
|
355
|
+
if (!output)
|
|
356
|
+
return;
|
|
357
|
+
await appendFile(output, `version=${releasable.version}\n` +
|
|
358
|
+
`tag=${releasable.tag}\n` +
|
|
359
|
+
`provenance=${releasable.provenance ? 'true' : 'false'}\n`);
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Cut a branch carrying the next line, and leave main where it is.
|
|
363
|
+
*
|
|
364
|
+
* No pull request: this is not a change to the branch you are on, it is a
|
|
365
|
+
* second line starting beside it. Main goes on releasing what it was
|
|
366
|
+
* releasing, and this one publishes under a dist tag of its own until it is
|
|
367
|
+
* ready to become `latest`.
|
|
368
|
+
*/
|
|
369
|
+
export const startPrerelease = async (root, { bump, id = 'alpha', dryRun = false, push = true, }) => {
|
|
370
|
+
assertModule(root);
|
|
371
|
+
const current = await readVersion(root);
|
|
372
|
+
const plan = planPrerelease(current, { bump, id });
|
|
373
|
+
if (dryRun)
|
|
374
|
+
return { plan, created: false, pushed: false };
|
|
375
|
+
if (isDirty(root)) {
|
|
376
|
+
throw new ReleaseError('The working tree has uncommitted changes. Commit or stash them before branching.');
|
|
377
|
+
}
|
|
378
|
+
const startedOn = currentBranch(root);
|
|
379
|
+
if (!startedOn) {
|
|
380
|
+
throw new ReleaseError('HEAD is detached. Check out the branch you are branching from.');
|
|
381
|
+
}
|
|
382
|
+
if (branchExists(root, plan.branch)) {
|
|
383
|
+
throw new ReleaseError(`Branch \`${plan.branch}\` already exists. That line has been started; ` +
|
|
384
|
+
'check it out and use `fg-dist release` to move it along.');
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
run(root, ['checkout', '-b', plan.branch, startedOn]);
|
|
388
|
+
await writeVersion(root, plan.version);
|
|
389
|
+
await recordVersion(root);
|
|
390
|
+
commitAll(root, `Start ${plan.version}`);
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
git(root, ['reset', '--hard', 'HEAD']);
|
|
394
|
+
git(root, ['checkout', startedOn]);
|
|
395
|
+
throw error;
|
|
396
|
+
}
|
|
397
|
+
if (!push) {
|
|
398
|
+
git(root, ['checkout', startedOn]);
|
|
399
|
+
return { plan, created: true, pushed: false };
|
|
400
|
+
}
|
|
401
|
+
try {
|
|
402
|
+
run(root, ['push', '-u', 'origin', plan.branch]);
|
|
403
|
+
}
|
|
404
|
+
finally {
|
|
405
|
+
git(root, ['checkout', startedOn]);
|
|
406
|
+
}
|
|
407
|
+
return { plan, created: true, pushed: true };
|
|
408
|
+
};
|
|
409
|
+
//# sourceMappingURL=release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,uEAAuE;AACvE,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,IAAc,EAAsB,EAAE;IAC9D,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;YAC/B,GAAG;YACH,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SAC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AA;QAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IAC/C,CAAC;IAED,IAAI,CAAC;QACH,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAClD,CAAC;YAAS,CAAC;QACT,GAAG,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAA;IACpC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC9C,CAAC,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Files to write, keyed by path relative to the target directory. */
|
|
2
|
+
export type Files = Record<string, string>;
|
|
3
|
+
/** Versions the generated projects pin, kept beside the ones this package uses. */
|
|
4
|
+
export declare const VERSIONS: {
|
|
5
|
+
readonly monolith: "^0.1.0-alpha.0";
|
|
6
|
+
readonly distribution: "^0.1.0-alpha.0";
|
|
7
|
+
readonly next: "^16.3.5";
|
|
8
|
+
readonly react: "^19.3.0";
|
|
9
|
+
readonly types: {
|
|
10
|
+
readonly node: "^26.6.2";
|
|
11
|
+
readonly react: "^19.3.0";
|
|
12
|
+
readonly reactDom: "^19.3.0";
|
|
13
|
+
};
|
|
14
|
+
readonly eslint: "^9.39.5";
|
|
15
|
+
readonly eslintConfigNext: "^16.3.5";
|
|
16
|
+
readonly portless: "^0.15.6";
|
|
17
|
+
readonly typescript: "^6.0.3";
|
|
18
|
+
readonly pnpm: "pnpm@10.28.0";
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A repository that composes modules.
|
|
22
|
+
*
|
|
23
|
+
* The monolith app lives at `apps/monolith` so modules can be added beside it
|
|
24
|
+
* as `apps/<name>`, which is where `add-module` puts them.
|
|
25
|
+
*/
|
|
26
|
+
export declare const monolithRepo: (name: string, origin?: string) => Files;
|
|
27
|
+
export declare const moduleRepo: (packageName: string, origin?: string) => Files;
|
|
28
|
+
/** Write a file map, creating directories as needed. */
|
|
29
|
+
export declare const write: (root: string, files: Files) => Promise<string[]>;
|
|
30
|
+
/** Whether a directory has anything in it, so `init` never writes over work. */
|
|
31
|
+
export declare const isEmpty: (dir: string) => Promise<boolean>;
|
|
32
|
+
export declare const readPackageName: (root: string) => Promise<string | undefined>;
|
|
33
|
+
/** `2024.01.15` — the date-based version a distribution is released under. */
|
|
34
|
+
export declare const calendarVersion: (on?: Date) => string;
|
|
35
|
+
/**
|
|
36
|
+
* A repository that ships a set of modules to end users.
|
|
37
|
+
*
|
|
38
|
+
* The root package.json is the distribution manifest: its version is the date
|
|
39
|
+
* it was released, and its dependencies are the modules it ships, each at a
|
|
40
|
+
* semver version. `extends` names another distribution whose modules this one
|
|
41
|
+
* inherits and may move ahead of, but never behind.
|
|
42
|
+
*/
|
|
43
|
+
export declare const distributionRepo: (name: string, origin?: string, parent?: string, { monolith }?: {
|
|
44
|
+
monolith?: boolean;
|
|
45
|
+
}) => Files;
|
|
46
|
+
//# sourceMappingURL=scaffold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAIA,sEAAsE;AACtE,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAI1C,mFAAmF;AACnF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;CAkBX,CAAA;AAwCV;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,KA4F3D,CAAA;AAYF,eAAO,MAAM,UAAU,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,KAAG,KAyGhE,CAAA;AAEF,wDAAwD;AACxD,eAAO,MAAM,KAAK,GAAU,MAAM,MAAM,EAAE,OAAO,KAAK,KAAG,OAAO,CAAC,MAAM,EAAE,CAWxE,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,OAAO,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAI1D,CAAA;AAED,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAO9E,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,eAAe,GAAI,KAAI,IAAiB,KAAG,MAK3C,CAAA;AAEb;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,SAAS,MAAM,EACf,eAAqB;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KAC/C,KAgFF,CAAA"}
|