@fairgarden/distribution 0.1.0-0.canary.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.
Files changed (82) hide show
  1. package/Readme.md +97 -0
  2. package/dist/add-module.d.ts +62 -0
  3. package/dist/add-module.d.ts.map +1 -0
  4. package/dist/add-module.js +279 -0
  5. package/dist/add-module.js.map +1 -0
  6. package/dist/calver.d.ts +65 -0
  7. package/dist/calver.d.ts.map +1 -0
  8. package/dist/calver.js +115 -0
  9. package/dist/calver.js.map +1 -0
  10. package/dist/canary.d.ts +58 -0
  11. package/dist/canary.d.ts.map +1 -0
  12. package/dist/canary.js +130 -0
  13. package/dist/canary.js.map +1 -0
  14. package/dist/changelog.d.ts +111 -0
  15. package/dist/changelog.d.ts.map +1 -0
  16. package/dist/changelog.js +285 -0
  17. package/dist/changelog.js.map +1 -0
  18. package/dist/cli.d.ts +3 -0
  19. package/dist/cli.d.ts.map +1 -0
  20. package/dist/cli.js +1076 -0
  21. package/dist/cli.js.map +1 -0
  22. package/dist/config-edit.d.ts +18 -0
  23. package/dist/config-edit.d.ts.map +1 -0
  24. package/dist/config-edit.js +166 -0
  25. package/dist/config-edit.js.map +1 -0
  26. package/dist/extends.d.ts +60 -0
  27. package/dist/extends.d.ts.map +1 -0
  28. package/dist/extends.js +173 -0
  29. package/dist/extends.js.map +1 -0
  30. package/dist/extract.d.ts +31 -0
  31. package/dist/extract.d.ts.map +1 -0
  32. package/dist/extract.js +177 -0
  33. package/dist/extract.js.map +1 -0
  34. package/dist/forks.d.ts +116 -0
  35. package/dist/forks.d.ts.map +1 -0
  36. package/dist/forks.js +357 -0
  37. package/dist/forks.js.map +1 -0
  38. package/dist/git-url.d.ts +19 -0
  39. package/dist/git-url.d.ts.map +1 -0
  40. package/dist/git-url.js +55 -0
  41. package/dist/git-url.js.map +1 -0
  42. package/dist/index.d.ts +21 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +11 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/inherit.d.ts +18 -0
  47. package/dist/inherit.d.ts.map +1 -0
  48. package/dist/inherit.js +84 -0
  49. package/dist/inherit.js.map +1 -0
  50. package/dist/manifest.d.ts +43 -0
  51. package/dist/manifest.d.ts.map +1 -0
  52. package/dist/manifest.js +64 -0
  53. package/dist/manifest.js.map +1 -0
  54. package/dist/overrides.d.ts +32 -0
  55. package/dist/overrides.d.ts.map +1 -0
  56. package/dist/overrides.js +81 -0
  57. package/dist/overrides.js.map +1 -0
  58. package/dist/policy.d.ts +86 -0
  59. package/dist/policy.d.ts.map +1 -0
  60. package/dist/policy.js +269 -0
  61. package/dist/policy.js.map +1 -0
  62. package/dist/readme.d.ts +60 -0
  63. package/dist/readme.d.ts.map +1 -0
  64. package/dist/readme.js +304 -0
  65. package/dist/readme.js.map +1 -0
  66. package/dist/release.d.ts +164 -0
  67. package/dist/release.d.ts.map +1 -0
  68. package/dist/release.js +454 -0
  69. package/dist/release.js.map +1 -0
  70. package/dist/scaffold.d.ts +45 -0
  71. package/dist/scaffold.d.ts.map +1 -0
  72. package/dist/scaffold.js +492 -0
  73. package/dist/scaffold.js.map +1 -0
  74. package/dist/submodules.d.ts +144 -0
  75. package/dist/submodules.d.ts.map +1 -0
  76. package/dist/submodules.js +315 -0
  77. package/dist/submodules.js.map +1 -0
  78. package/dist/workflows.d.ts +102 -0
  79. package/dist/workflows.d.ts.map +1 -0
  80. package/dist/workflows.js +710 -0
  81. package/dist/workflows.js.map +1 -0
  82. package/package.json +54 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readme.js","sourceRoot":"","sources":["../src/readme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CA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AAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAA;IAChD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,OAAO,GAAmB,EAAE,CAAA;IAClC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;QAEpE,wEAAwE;QACxE,yCAAyC;QACzC,IAAI,OAAO,GAAG,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAA;QACpD,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE,CAAC;YAC7C,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;QACvD,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,KAAK,QAAQ,CAAA;QACpC,IAAI,OAAO,IAAI,CAAC,KAAK;YAAE,MAAM,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACrD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AACnC,CAAC,CAAA"}
@@ -0,0 +1,164 @@
1
+ export declare class ReleaseError extends Error {
2
+ }
3
+ export interface Branch {
4
+ branch: string;
5
+ version: string;
6
+ }
7
+ export interface ReleasePlan {
8
+ /** The version that has just been released, read from the manifest. */
9
+ released: string;
10
+ /**
11
+ * Where fixes to the released version go. Undefined for a prerelease, which
12
+ * has nothing to maintain.
13
+ */
14
+ maintenance: Branch | undefined;
15
+ /** The bump that main takes, opened as a pull request. */
16
+ next: Branch;
17
+ /** What the maintenance branch is cut from: the release tag, or HEAD. */
18
+ base: string;
19
+ /** Whether {@link base} is the release tag rather than wherever HEAD is. */
20
+ tagged: boolean;
21
+ }
22
+ /**
23
+ * Work out the two branches a release leaves behind.
24
+ *
25
+ * Main always carries the next unreleased version, so the release is the
26
+ * moment main moves on: once 1.6.0 is published, main becomes 1.7.0 and 1.6.x
27
+ * continues on its own branch, starting at the patch nobody has written yet.
28
+ */
29
+ export type Bump = 'patch' | 'minor' | 'major';
30
+ /**
31
+ * Work out what a release leaves behind.
32
+ *
33
+ * Main always carries the next unreleased version, so the release is the moment
34
+ * main moves on. Which way it moves is a decision nobody else can make: a minor
35
+ * is the usual answer, a major says something was removed or changed meaning,
36
+ * and a patch says this branch *is* the line and stays on it.
37
+ */
38
+ export declare const planRelease: (released: string, { bump, id }?: {
39
+ bump?: Bump;
40
+ id?: string;
41
+ }) => Omit<ReleasePlan, "base" | "tagged">;
42
+ export interface PrereleasePlan {
43
+ /** The version the branch is cut to carry. */
44
+ version: string;
45
+ /** The branch it lives on, which becomes that line's branch if it ships. */
46
+ branch: string;
47
+ /** The version on the branch this was cut from, which keeps going. */
48
+ from: string;
49
+ }
50
+ /**
51
+ * Start the next line early, without main leaving the current one.
52
+ *
53
+ * Main is at 1.6.0 and still has 1.6.x and 1.7.0 to ship; 2.0.0 can be worked
54
+ * on anyway, on a branch of its own, published under a dist tag of its own.
55
+ * Nothing here touches main — that is the point.
56
+ */
57
+ export declare const planPrerelease: (current: string, { bump, id }: {
58
+ bump: Exclude<Bump, "patch">;
59
+ id?: string;
60
+ }) => PrereleasePlan;
61
+ /**
62
+ * Set the version in package.json, leaving the rest of the file untouched.
63
+ *
64
+ * Spliced rather than re-serialised: a manifest carries key order, comments in
65
+ * some tools, and whatever indentation the repository settled on, and a
66
+ * release is no occasion to reformat it.
67
+ */
68
+ export declare const setVersion: (source: string, version: string) => string;
69
+ export interface DistributionRelease {
70
+ name: string;
71
+ /** The version in the manifest before. */
72
+ from: string;
73
+ /** Whether that was published already. */
74
+ published: boolean;
75
+ /** The version the publish workflow releases next. */
76
+ version: string;
77
+ }
78
+ /**
79
+ * Set the version a distribution publishes next — see calver.ts for the shape.
80
+ *
81
+ * Run after publishing, it moves on; run again when the month has turned, it
82
+ * moves a release not yet published to this month's first. Nothing branches:
83
+ * a distribution has no lines of its own, only the modules it pins, and those
84
+ * are released on their own.
85
+ */
86
+ export declare const releaseDistribution: (root: string, { dryRun, on, id, stable, published: lookup, }?: {
87
+ dryRun?: boolean;
88
+ on?: Date;
89
+ id?: string;
90
+ stable?: boolean;
91
+ published?: (spec: string) => string | undefined;
92
+ }) => Promise<DistributionRelease>;
93
+ /** Read the release the repository is standing on, without changing anything. */
94
+ export declare const readRelease: (root: string, { bump, id }?: {
95
+ bump?: Bump;
96
+ id?: string;
97
+ }) => Promise<ReleasePlan>;
98
+ export interface ReleaseOptions {
99
+ /** Which way main moves on. Required, unless this is a prerelease. */
100
+ bump?: Bump;
101
+ /** Prerelease identifier, for moving alpha to beta to rc. */
102
+ id?: string;
103
+ dryRun?: boolean;
104
+ /** Push the branches and open the pull request. On by default. */
105
+ push?: boolean;
106
+ }
107
+ export interface ReleaseOutcome {
108
+ plan: ReleasePlan;
109
+ /** The branch this was released from, which the pull request is against. */
110
+ base: string;
111
+ /** Branches that were created, in the order they were created. */
112
+ created: string[];
113
+ pushed: boolean;
114
+ /** The pull request, when `gh` was there to open one. */
115
+ pullRequest: string | undefined;
116
+ }
117
+ /**
118
+ * Move a module on from the release it has just published.
119
+ *
120
+ * Two branches come out of it: `v1-6` where 1.6.x is maintained, and a pull
121
+ * request moving main to 1.7.0. The pull request is where main's bump gets
122
+ * reviewed like any other change; the maintenance branch is not a proposal, so
123
+ * it is just pushed.
124
+ */
125
+ export declare const release: (root: string, { bump, id, dryRun, push }?: ReleaseOptions) => Promise<ReleaseOutcome>;
126
+ export interface Releasable {
127
+ name: string;
128
+ version: string;
129
+ tag: string;
130
+ /** Whether npm will generate provenance; it refuses for restricted packages. */
131
+ provenance: boolean;
132
+ }
133
+ /**
134
+ * Check that the version in the manifest is one that can be released.
135
+ *
136
+ * Main is meant to carry the next unreleased version, so finding that version
137
+ * already on npm means {@link release} has not run since the last one — and
138
+ * publishing would either fail or, worse, succeed as a republish.
139
+ */
140
+ export declare const checkReleasable: (root: string, { published }?: {
141
+ published?: (spec: string) => string | undefined;
142
+ }) => Promise<Releasable>;
143
+ /** Hand the version to the workflow steps that tag and publish it. */
144
+ export declare const reportToActions: (releasable: Releasable) => Promise<void>;
145
+ export interface PrereleaseOutcome {
146
+ plan: PrereleasePlan;
147
+ created: boolean;
148
+ pushed: boolean;
149
+ }
150
+ /**
151
+ * Cut a branch carrying the next line, and leave main where it is.
152
+ *
153
+ * No pull request: this is not a change to the branch you are on, it is a
154
+ * second line starting beside it. Main goes on releasing what it was
155
+ * releasing, and this one publishes under a dist tag of its own until it is
156
+ * ready to become `latest`.
157
+ */
158
+ export declare const startPrerelease: (root: string, { bump, id, dryRun, push, }: {
159
+ bump: Exclude<Bump, "patch">;
160
+ id?: string;
161
+ dryRun?: boolean;
162
+ push?: boolean;
163
+ }) => Promise<PrereleaseOutcome>;
164
+ //# sourceMappingURL=release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAkCA,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,WAAW,EAAE,MAAM,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AS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;CAAO,KACvE,OAAO,CAAC,UAAU,CAkDpB,CAAA;AAkBD,sEAAsE;AACtE,eAAO,MAAM,eAAe,GAAU,YAAY,UAAU,KAAG,OAAO,CAAC,IAAI,CAS1E,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,6BAKG;IACD,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,KACA,OAAO,CAAC,iBAAiB,CAgD3B,CAAA"}
@@ -0,0 +1,454 @@
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 { moveSection, openSection } from "./changelog.js";
8
+ import { assertCalendarVersion, isFromPastMonth, monthOf, nextCalendarVersion, npmVersion, } from "./calver.js";
9
+ import { isDistribution } from "./submodules.js";
10
+ /** Run git, returning undefined rather than throwing when it fails. */
11
+ const git = (cwd, args) => {
12
+ try {
13
+ return execFileSync('git', args, {
14
+ cwd,
15
+ encoding: 'utf8',
16
+ stdio: ['ignore', 'pipe', 'ignore'],
17
+ }).trim();
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ };
23
+ /** Run git for effect, letting a failure surface. */
24
+ const run = (cwd, args) => {
25
+ execFileSync('git', args, { cwd, stdio: ['ignore', 'inherit', 'inherit'] });
26
+ };
27
+ export class ReleaseError extends Error {
28
+ }
29
+ const maintenanceBranch = (version) => `v${version.major}-${version.minor}`;
30
+ /**
31
+ * Work out what a release leaves behind.
32
+ *
33
+ * Main always carries the next unreleased version, so the release is the moment
34
+ * main moves on. Which way it moves is a decision nobody else can make: a minor
35
+ * is the usual answer, a major says something was removed or changed meaning,
36
+ * and a patch says this branch *is* the line and stays on it.
37
+ */
38
+ export const planRelease = (released, { bump, id } = {}) => {
39
+ const parsed = semver.parse(released);
40
+ if (!parsed) {
41
+ throw new ReleaseError(`\`${released}\` is not a version this can release.`);
42
+ }
43
+ // A prerelease is not a line anyone maintains — there is no 2.0.0-alpha.0
44
+ // that someone is still running and needs a fix for — so it only moves
45
+ // forward, along its own identifier or on to the next one.
46
+ if (parsed.prerelease.length > 0) {
47
+ // Without an identifier, carry on with the one the version already has.
48
+ // Defaulting to `alpha` would take 2.0.0-beta.2 back to 2.0.0-alpha.0,
49
+ // which is lower than what is already published.
50
+ const carries = String(parsed.prerelease[0]);
51
+ const next = !id || id === carries
52
+ ? semver.inc(released, 'prerelease')
53
+ : semver.inc(released, 'prerelease', id);
54
+ if (!next)
55
+ throw new ReleaseError(`Cannot advance \`${released}\`.`);
56
+ if (semver.lte(next, released)) {
57
+ throw new ReleaseError(`Moving ${released} to ${next} would go backwards. ` +
58
+ `\`${carries}\` is already past \`${id}\`.`);
59
+ }
60
+ return {
61
+ released,
62
+ maintenance: undefined,
63
+ next: { branch: releaseBranch(next), version: next },
64
+ };
65
+ }
66
+ if (!bump) {
67
+ throw new ReleaseError(`Say which way ${released} moves on: --patch, --minor or --major. ` +
68
+ 'Run with --dry-run to see what each would do.');
69
+ }
70
+ const nextVersion = semver.inc(released, bump);
71
+ if (!nextVersion)
72
+ throw new ReleaseError(`Cannot take the next ${bump} after ${released}.`);
73
+ return {
74
+ released,
75
+ // A patch means this branch is the line that carries it, so it keeps going
76
+ // rather than handing off to a branch behind it. A minor or major means
77
+ // main leaves this line, and something has to stay behind for its fixes.
78
+ maintenance: bump === 'patch'
79
+ ? undefined
80
+ : {
81
+ branch: maintenanceBranch(parsed),
82
+ version: `${parsed.major}.${parsed.minor}.${parsed.patch + 1}`,
83
+ },
84
+ next: { branch: releaseBranch(nextVersion), version: nextVersion },
85
+ };
86
+ };
87
+ /**
88
+ * Start the next line early, without main leaving the current one.
89
+ *
90
+ * Main is at 1.6.0 and still has 1.6.x and 1.7.0 to ship; 2.0.0 can be worked
91
+ * on anyway, on a branch of its own, published under a dist tag of its own.
92
+ * Nothing here touches main — that is the point.
93
+ */
94
+ export const planPrerelease = (current, { bump, id = 'alpha' }) => {
95
+ const parsed = semver.parse(current);
96
+ if (!parsed) {
97
+ throw new ReleaseError(`\`${current}\` is not a version to branch from.`);
98
+ }
99
+ if (parsed.prerelease.length > 0) {
100
+ throw new ReleaseError(`${current} is already a prerelease. Move it along with \`fg-dist release\` instead.`);
101
+ }
102
+ const version = semver.inc(current, bump === 'major' ? 'premajor' : 'preminor', id);
103
+ if (!version)
104
+ throw new ReleaseError(`Cannot start a ${bump} prerelease after ${current}.`);
105
+ const next = semver.parse(version);
106
+ // The same name the line would get as a maintenance branch, because it is
107
+ // the same line: if it ships from here, this is where its fixes go.
108
+ const branch = bump === 'major' ? `v${next.major}` : `v${next.major}-${next.minor}`;
109
+ return { version, branch, from: current };
110
+ };
111
+ const releaseBranch = (version) => `release/v${version}`;
112
+ const manifestPath = (root) => path.join(root, 'package.json');
113
+ const readVersion = async (root) => {
114
+ const raw = await readFile(manifestPath(root), 'utf8').catch(() => undefined);
115
+ if (!raw)
116
+ throw new ReleaseError('No package.json here. Run this inside a module.');
117
+ const version = JSON.parse(raw).version;
118
+ if (typeof version !== 'string') {
119
+ throw new ReleaseError('package.json has no version to release.');
120
+ }
121
+ return version;
122
+ };
123
+ /**
124
+ * Set the version in package.json, leaving the rest of the file untouched.
125
+ *
126
+ * Spliced rather than re-serialised: a manifest carries key order, comments in
127
+ * some tools, and whatever indentation the repository settled on, and a
128
+ * release is no occasion to reformat it.
129
+ */
130
+ export const setVersion = (source, version) => {
131
+ // What the manifest actually parses to. Everything below is about finding
132
+ // where *that* value is written, rather than the first thing shaped like it:
133
+ // a `volta` or `engines` block can hold a "version" key of its own, and can
134
+ // sit above the real one.
135
+ const current = JSON.parse(source).version;
136
+ if (typeof current !== 'string') {
137
+ throw new ReleaseError('package.json has no version field to set.');
138
+ }
139
+ const online = [
140
+ ...source.matchAll(/^([ \t]*)"version"([ \t]*):([ \t]*)"([^"]*)"/gm),
141
+ ]
142
+ .filter((match) => match[4] === current)
143
+ // Shallowest indentation is the top level. A nested key holding the same
144
+ // string is indented further, by any formatter anyone actually uses.
145
+ .sort((a, b) => a[1].length - b[1].length);
146
+ const match = online[0];
147
+ if (match) {
148
+ return (source.slice(0, match.index) +
149
+ `${match[1]}"version"${match[2]}:${match[3]}"${version}"` +
150
+ source.slice(match.index + match[0].length));
151
+ }
152
+ // Written on one line, so there are no indents to compare. Anchor on the
153
+ // value, which is the best this can do without a JSON parser that records
154
+ // where it read things.
155
+ const escaped = current.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
156
+ const inline = new RegExp(`"version"(\\s*):(\\s*)"${escaped}"`).exec(source);
157
+ if (!inline)
158
+ throw new ReleaseError('package.json has no version field to set.');
159
+ return (source.slice(0, inline.index) +
160
+ `"version"${inline[1]}:${inline[2]}"${version}"` +
161
+ source.slice(inline.index + inline[0].length));
162
+ };
163
+ const writeVersion = async (root, version) => {
164
+ const source = await readFile(manifestPath(root), 'utf8');
165
+ await writeFile(manifestPath(root), setVersion(source, version));
166
+ };
167
+ /** A distribution is versioned by month and release, and releases by moving submodule pins. */
168
+ const assertModule = (root) => {
169
+ if (isDistribution(root)) {
170
+ throw new ReleaseError('This is a distribution, not a module. Its version is YY.MM.NN, which `fg-dist release` ' +
171
+ 'moves on; release its modules individually, then `fg-dist bump` to take them.');
172
+ }
173
+ };
174
+ /**
175
+ * Set the version a distribution publishes next — see calver.ts for the shape.
176
+ *
177
+ * Run after publishing, it moves on; run again when the month has turned, it
178
+ * moves a release not yet published to this month's first. Nothing branches:
179
+ * a distribution has no lines of its own, only the modules it pins, and those
180
+ * are released on their own.
181
+ */
182
+ export const releaseDistribution = async (root, { dryRun = false, on, id, stable, published: lookup = onNpm, } = {}) => {
183
+ const manifest = JSON.parse(await readFile(manifestPath(root), 'utf8'));
184
+ const from = manifest.version;
185
+ assertCalendarVersion(from);
186
+ // Tagged by the workflow once it has published; npm has it either way.
187
+ const published = git(root, ['rev-parse', '--verify', `refs/tags/v${from}`]) !== undefined ||
188
+ lookup(`${manifest.name}@${npmVersion(from)}`) !== undefined;
189
+ let version;
190
+ try {
191
+ version = nextCalendarVersion(from, { published, on, id, stable });
192
+ }
193
+ catch (error) {
194
+ throw new ReleaseError(error instanceof Error ? error.message : String(error));
195
+ }
196
+ if (!dryRun && version !== from) {
197
+ await writeVersion(root, version);
198
+ await moveSection(root, from, version, { published });
199
+ }
200
+ return { name: manifest.name, from, published, version };
201
+ };
202
+ /** Read the release the repository is standing on, without changing anything. */
203
+ export const readRelease = async (root, { bump, id } = {}) => {
204
+ assertModule(root);
205
+ const released = await readVersion(root);
206
+ const plan = planRelease(released, { bump, id });
207
+ const tag = `v${released}`;
208
+ const tagged = git(root, ['rev-parse', '--verify', `refs/tags/${tag}`]) !== undefined;
209
+ return { ...plan, base: tagged ? tag : 'HEAD', tagged };
210
+ };
211
+ const currentBranch = (root) => {
212
+ const name = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']);
213
+ return name === 'HEAD' ? undefined : name;
214
+ };
215
+ const isDirty = (root) => (git(root, ['status', '--porcelain']) ?? '') !== '';
216
+ const branchExists = (root, branch) => git(root, ['rev-parse', '--verify', `refs/heads/${branch}`]) !== undefined;
217
+ /** Record the version in the readme, so it is visible where people browse. */
218
+ const recordVersion = async (root) => {
219
+ await writeReadmes(root);
220
+ // The next version's changes go under a section of its own.
221
+ await openSection(root);
222
+ };
223
+ const commitAll = (root, message) => {
224
+ run(root, ['add', '-A']);
225
+ run(root, ['commit', '-m', message]);
226
+ };
227
+ /**
228
+ * Move a module on from the release it has just published.
229
+ *
230
+ * Two branches come out of it: `v1-6` where 1.6.x is maintained, and a pull
231
+ * request moving main to 1.7.0. The pull request is where main's bump gets
232
+ * reviewed like any other change; the maintenance branch is not a proposal, so
233
+ * it is just pushed.
234
+ */
235
+ export const release = async (root, { bump, id, dryRun = false, push = true } = {}) => {
236
+ const plan = await readRelease(root, { bump, id });
237
+ if (dryRun)
238
+ return { plan, base: currentBranch(root) ?? 'HEAD', created: [], pushed: false, pullRequest: undefined };
239
+ // Both branches are cut from what is committed, and the bumps are committed
240
+ // on top. Anything already in the working tree would be swept into them.
241
+ if (isDirty(root)) {
242
+ throw new ReleaseError('The working tree has uncommitted changes. Commit or stash them before releasing.');
243
+ }
244
+ const startedOn = currentBranch(root);
245
+ if (!startedOn) {
246
+ throw new ReleaseError('HEAD is detached. Check out the branch you release from.');
247
+ }
248
+ for (const branch of [plan.maintenance?.branch, plan.next.branch]) {
249
+ if (branch && branchExists(root, branch)) {
250
+ throw new ReleaseError(`Branch \`${branch}\` already exists. Delete it or pick another version.`);
251
+ }
252
+ }
253
+ const created = [];
254
+ try {
255
+ if (plan.maintenance) {
256
+ // Cut from the tag where possible: main may have moved on since the
257
+ // release, and those commits are not part of 1.6.x.
258
+ run(root, ['checkout', '-b', plan.maintenance.branch, plan.base]);
259
+ created.push(plan.maintenance.branch);
260
+ await writeVersion(root, plan.maintenance.version);
261
+ await recordVersion(root);
262
+ commitAll(root, `Open ${plan.maintenance.version} for maintenance`);
263
+ }
264
+ run(root, ['checkout', '-b', plan.next.branch, startedOn]);
265
+ created.push(plan.next.branch);
266
+ await writeVersion(root, plan.next.version);
267
+ await recordVersion(root);
268
+ commitAll(root, `Bump to ${plan.next.version}`);
269
+ }
270
+ catch (error) {
271
+ // Leave the branches for inspection rather than unwinding half a release,
272
+ // but not the edits: a commit that failed on a hook or a missing identity
273
+ // leaves them staged, and checking out would carry them onto main. The
274
+ // tree was clean on the way in, so everything here is ours to drop.
275
+ git(root, ['reset', '--hard', 'HEAD']);
276
+ git(root, ['checkout', startedOn]);
277
+ throw error;
278
+ }
279
+ if (!push) {
280
+ git(root, ['checkout', startedOn]);
281
+ return { plan, base: startedOn, created, pushed: false, pullRequest: undefined };
282
+ }
283
+ // A push can fail for reasons that have nothing to do with the release — no
284
+ // origin, expired credentials, a branch already on the remote. The branches
285
+ // are made either way, so put the checkout back before the failure leaves
286
+ // someone standing somewhere they did not ask to be.
287
+ let pullRequest;
288
+ try {
289
+ for (const branch of created) {
290
+ run(root, ['push', '-u', 'origin', branch]);
291
+ }
292
+ pullRequest = openPullRequest(root, plan, startedOn);
293
+ }
294
+ catch (error) {
295
+ // The branches are made and committed, so a rerun would only say they
296
+ // already exist. Say what is left to do instead.
297
+ throw new ReleaseError(`${error instanceof Error ? error.message : String(error)}\n\n` +
298
+ 'The branches are made; only the push failed. Finish it with:\n' +
299
+ created.map((branch) => ` git push -u origin ${branch}`).join('\n'));
300
+ }
301
+ finally {
302
+ git(root, ['checkout', startedOn]);
303
+ }
304
+ return { plan, base: startedOn, created, pushed: true, pullRequest };
305
+ };
306
+ const openPullRequest = (root, plan, base) => {
307
+ const body = [
308
+ `\`${plan.released}\` is released. This moves ${base} on to the next unreleased version.`,
309
+ '',
310
+ plan.maintenance
311
+ ? `Fixes to \`${plan.released}\` go to \`${plan.maintenance.branch}\`, which starts at \`${plan.maintenance.version}\`.`
312
+ : 'No maintenance branch: a prerelease has no line to maintain.',
313
+ ].join('\n');
314
+ try {
315
+ return execFileSync('gh', [
316
+ 'pr',
317
+ 'create',
318
+ '--base',
319
+ base,
320
+ '--head',
321
+ plan.next.branch,
322
+ '--title',
323
+ `Bump to ${plan.next.version}`,
324
+ '--body',
325
+ body,
326
+ ], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
327
+ }
328
+ catch {
329
+ // gh is not everywhere, and not having it should not undo a good release.
330
+ return undefined;
331
+ }
332
+ };
333
+ /**
334
+ * Check that the version in the manifest is one that can be released.
335
+ *
336
+ * Main is meant to carry the next unreleased version, so finding that version
337
+ * already on npm means {@link release} has not run since the last one — and
338
+ * publishing would either fail or, worse, succeed as a republish.
339
+ */
340
+ export const checkReleasable = async (root, { published } = {}) => {
341
+ const raw = await readFile(manifestPath(root), 'utf8').catch(() => undefined);
342
+ if (!raw)
343
+ throw new ReleaseError('No package.json here. Run this inside a module.');
344
+ const manifest = JSON.parse(raw);
345
+ const { name } = manifest;
346
+ if (typeof name !== 'string' || typeof manifest.version !== 'string') {
347
+ throw new ReleaseError('package.json needs a name and a version to release.');
348
+ }
349
+ // A distribution's version names the month it is published in, and npm
350
+ // spells it without the zeros; its tag keeps them.
351
+ const distribution = isDistribution(root);
352
+ if (distribution) {
353
+ assertCalendarVersion(manifest.version);
354
+ if (isFromPastMonth(manifest.version)) {
355
+ const { year, month } = monthOf();
356
+ throw new ReleaseError(`${manifest.version} is a release of a month that is over, and it is ` +
357
+ `${String(year).padStart(2, '0')}.${String(month).padStart(2, '0')} now. ` +
358
+ "Run `fg-dist release`, which moves it to this month's first release, and commit it.");
359
+ }
360
+ }
361
+ const version = distribution ? npmVersion(manifest.version) : manifest.version;
362
+ const tag = `v${manifest.version}`;
363
+ // The workflow tags after it publishes, so a tag that is already here means
364
+ // a red job *after* an irreversible publish — and a later release would cut
365
+ // its maintenance branch from whatever that stale tag points at.
366
+ if (git(root, ['rev-parse', '--verify', `refs/tags/${tag}`])) {
367
+ throw new ReleaseError(`${tag} already exists here. Either ${version} has been released, or the ` +
368
+ 'tag was written before it was. Move on to the next version first.');
369
+ }
370
+ const lookup = published ?? onNpm;
371
+ if (lookup(`${name}@${version}`)) {
372
+ // Published but untagged is where a release job that died between the two
373
+ // ends up. Rerunning cannot publish again, so the tag is all that is left.
374
+ throw new ReleaseError(`${name}@${version} is already on npm, and ${tag} does not exist here.\n` +
375
+ 'If the release job failed after publishing, only the tag is missing:\n' +
376
+ ` git tag ${tag} <the published commit> && git push origin ${tag}\n` +
377
+ 'Otherwise run `fg-dist release` to move on to the next version.');
378
+ }
379
+ return { name, version, tag, provenance: isPublic(manifest) };
380
+ };
381
+ /** Whether npm has this exact version, as opposed to having no opinion. */
382
+ const onNpm = (spec) => {
383
+ try {
384
+ const value = execFileSync('npm', ['view', spec, 'version'], {
385
+ encoding: 'utf8',
386
+ stdio: ['ignore', 'pipe', 'ignore'],
387
+ }).trim();
388
+ return value === '' ? undefined : value;
389
+ }
390
+ catch {
391
+ // No such version, or no registry to ask. Neither blocks a release: npm
392
+ // itself refuses a duplicate, so this check is a clearer message, not the
393
+ // guard of last resort.
394
+ return undefined;
395
+ }
396
+ };
397
+ /** Hand the version to the workflow steps that tag and publish it. */
398
+ export const reportToActions = async (releasable) => {
399
+ const output = process.env.GITHUB_OUTPUT;
400
+ if (!output)
401
+ return;
402
+ await appendFile(output, `version=${releasable.version}\n` +
403
+ `tag=${releasable.tag}\n` +
404
+ `provenance=${releasable.provenance ? 'true' : 'false'}\n`);
405
+ };
406
+ /**
407
+ * Cut a branch carrying the next line, and leave main where it is.
408
+ *
409
+ * No pull request: this is not a change to the branch you are on, it is a
410
+ * second line starting beside it. Main goes on releasing what it was
411
+ * releasing, and this one publishes under a dist tag of its own until it is
412
+ * ready to become `latest`.
413
+ */
414
+ export const startPrerelease = async (root, { bump, id = 'alpha', dryRun = false, push = true, }) => {
415
+ assertModule(root);
416
+ const current = await readVersion(root);
417
+ const plan = planPrerelease(current, { bump, id });
418
+ if (dryRun)
419
+ return { plan, created: false, pushed: false };
420
+ if (isDirty(root)) {
421
+ throw new ReleaseError('The working tree has uncommitted changes. Commit or stash them before branching.');
422
+ }
423
+ const startedOn = currentBranch(root);
424
+ if (!startedOn) {
425
+ throw new ReleaseError('HEAD is detached. Check out the branch you are branching from.');
426
+ }
427
+ if (branchExists(root, plan.branch)) {
428
+ throw new ReleaseError(`Branch \`${plan.branch}\` already exists. That line has been started; ` +
429
+ 'check it out and use `fg-dist release` to move it along.');
430
+ }
431
+ try {
432
+ run(root, ['checkout', '-b', plan.branch, startedOn]);
433
+ await writeVersion(root, plan.version);
434
+ await recordVersion(root);
435
+ commitAll(root, `Start ${plan.version}`);
436
+ }
437
+ catch (error) {
438
+ git(root, ['reset', '--hard', 'HEAD']);
439
+ git(root, ['checkout', startedOn]);
440
+ throw error;
441
+ }
442
+ if (!push) {
443
+ git(root, ['checkout', startedOn]);
444
+ return { plan, created: true, pushed: false };
445
+ }
446
+ try {
447
+ run(root, ['push', '-u', 'origin', plan.branch]);
448
+ }
449
+ finally {
450
+ git(root, ['checkout', startedOn]);
451
+ }
452
+ return { plan, created: true, pushed: true };
453
+ };
454
+ //# sourceMappingURL=release.js.map