@williamthorsen/release-kit 16.1.0 → 16.1.2

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 (63) hide show
  1. package/.meta/changelog.json +45 -0
  2. package/.readyup/kits/default.js +2 -2
  3. package/.readyup/kits/npm-auto-publish.js +1 -1
  4. package/.readyup/manifest.json +6 -6
  5. package/CHANGELOG.md +16 -0
  6. package/README.md +3 -5
  7. package/bin/release-kit.js +7 -3
  8. package/dist/esm/assertCleanWorkingTree.js +14 -7
  9. package/dist/esm/assertReleasesOnNpm.js +11 -2
  10. package/dist/esm/assertTaggedBaseline.js +2 -1
  11. package/dist/esm/assertTarballsComplete.js +15 -3
  12. package/dist/esm/buildChangelogEntries.js +2 -2
  13. package/dist/esm/buildDependencyGraph.js +5 -4
  14. package/dist/esm/bumpVersion.js +3 -2
  15. package/dist/esm/changelogOverrides.js +3 -2
  16. package/dist/esm/cli.js +11 -0
  17. package/dist/esm/commitCommand.js +11 -5
  18. package/dist/esm/compareVersions.js +2 -1
  19. package/dist/esm/createGithubRelease.js +7 -1
  20. package/dist/esm/createGithubReleaseCommand.js +3 -4
  21. package/dist/esm/createTags.js +6 -4
  22. package/dist/esm/deleteFileIfExists.js +2 -1
  23. package/dist/esm/deriveDirectoryConfig.js +7 -6
  24. package/dist/esm/deriveWorkspaceConfig.js +4 -3
  25. package/dist/esm/enterRepoRoot.js +2 -1
  26. package/dist/esm/enumerateReleaseWindows.js +2 -2
  27. package/dist/esm/init/initCommand.js +10 -1
  28. package/dist/esm/init/updateTemplatesCommand.js +10 -1
  29. package/dist/esm/loadConfig.js +6 -5
  30. package/dist/esm/mergeConfig.js +5 -4
  31. package/dist/esm/monorepoConfigAssertions.js +6 -5
  32. package/dist/esm/packFromCleanCheckout.js +12 -3
  33. package/dist/esm/planVersionBump.js +6 -5
  34. package/dist/esm/prepareCommand.js +12 -22
  35. package/dist/esm/prepareComposite.js +2 -1
  36. package/dist/esm/prepareRunContext.js +2 -2
  37. package/dist/esm/previewTagPrefixes.js +2 -2
  38. package/dist/esm/publish.js +7 -1
  39. package/dist/esm/publishCommand.js +4 -18
  40. package/dist/esm/pushCommand.js +5 -12
  41. package/dist/esm/pushRelease.js +18 -6
  42. package/dist/esm/releaseFiles.js +2 -2
  43. package/dist/esm/releasePlan.js +2 -2
  44. package/dist/esm/resolveCommandTags.d.ts +4 -4
  45. package/dist/esm/resolveCommandTags.js +3 -5
  46. package/dist/esm/resolveReleaseDeclaration.js +9 -8
  47. package/dist/esm/resolveReleaseTags.js +11 -4
  48. package/dist/esm/resolveReleaseTargets.js +2 -1
  49. package/dist/esm/runCli.d.ts +5 -0
  50. package/dist/esm/runCli.js +224 -0
  51. package/dist/esm/showTagPrefixesCommand.js +5 -3
  52. package/dist/esm/sync-labels/generateCommand.js +4 -1
  53. package/dist/esm/sync-labels/initCommand.js +7 -1
  54. package/dist/esm/sync-labels/presets.js +7 -7
  55. package/dist/esm/sync-labels/resolveLabels.js +4 -3
  56. package/dist/esm/sync-labels/templates.js +2 -2
  57. package/dist/esm/tagCommand.js +2 -9
  58. package/dist/esm/user-error-chaining.d.ts +13 -0
  59. package/dist/esm/user-error-chaining.js +11 -0
  60. package/dist/esm/validateOverridesCommand.js +7 -1
  61. package/package.json +6 -6
  62. package/dist/esm/bin/release-kit.js +0 -240
  63. /package/dist/esm/{bin/release-kit.d.ts → cli.d.ts} +0 -0
@@ -1,240 +0,0 @@
1
- #!/usr/bin/env node
2
- import { parseArgsOrExit, reportError, resolveSelfVersion } from '@williamthorsen/nmr-core';
3
- import { describeError } from '@williamthorsen/toolbelt.errors';
4
- import { commitCommand } from "../commitCommand.js";
5
- import { configFlagSchema } from "../configFlagSchema.js";
6
- import { createGithubReleaseCommand } from "../createGithubReleaseCommand.js";
7
- import { enterRepoRoot } from "../enterRepoRoot.js";
8
- import { showInitHelp, showUpdateTemplatesHelp } from "../help/initHelp.js";
9
- import { showOverridesHelp, showOverridesValidateHelp } from "../help/overridesHelp.js";
10
- import { showPrepareHelp } from "../help/prepareHelp.js";
11
- import { showCommitHelp, showCreateGithubReleaseHelp, showPublishHelp, showPushHelp, showShowTagPrefixesHelp, showTagHelp, } from "../help/releaseStepsHelp.js";
12
- import { showSyncLabelsGenerateHelp, showSyncLabelsHelp, showSyncLabelsInitHelp, showSyncLabelsSyncHelp, } from "../help/syncLabelsHelp.js";
13
- import { showUsage } from "../help/usage.js";
14
- import { initCommand } from "../init/initCommand.js";
15
- import { updateTemplatesCommand } from "../init/updateTemplatesCommand.js";
16
- import { prepareCommand } from "../prepareCommand.js";
17
- import { publishCommand } from "../publishCommand.js";
18
- import { pushCommand } from "../pushCommand.js";
19
- import { resolveConfigFlag } from "../resolveConfigFlag.js";
20
- import { resolveStylesOrExit } from "../resolveStylesOrExit.js";
21
- import { showTagPrefixesCommand } from "../showTagPrefixesCommand.js";
22
- import { generateCommand } from "../sync-labels/generateCommand.js";
23
- import { syncLabelsInitCommand } from "../sync-labels/initCommand.js";
24
- import { syncLabelsCommand } from "../sync-labels/syncCommand.js";
25
- import { tagCommand } from "../tagCommand.js";
26
- import { validateOverridesCommand } from "../validateOverridesCommand.js";
27
- const VERSION = resolveSelfVersion(import.meta.url);
28
- function enterRepoRootOrExit() {
29
- try {
30
- return enterRepoRoot();
31
- }
32
- catch (error) {
33
- reportError(describeError(error));
34
- process.exit(1);
35
- }
36
- }
37
- const args = process.argv.slice(2);
38
- const command = args[0];
39
- if (command === '--version' || command === '-V') {
40
- console.info(VERSION);
41
- process.exit(0);
42
- }
43
- if (command === undefined || ['--help', '-h'].includes(command)) {
44
- showUsage();
45
- process.exit(0);
46
- }
47
- const flags = args.slice(1);
48
- const styles = resolveStylesOrExit({
49
- env: process.env,
50
- stderrIsTty: process.stderr.isTTY,
51
- stdoutIsTty: process.stdout.isTTY,
52
- });
53
- if (command === 'prepare') {
54
- if (flags.some((f) => f === '--help' || f === '-h')) {
55
- showPrepareHelp();
56
- process.exit(0);
57
- }
58
- const { invocationDir } = enterRepoRootOrExit();
59
- await prepareCommand(flags, styles, invocationDir);
60
- process.exit(0);
61
- }
62
- if (command === 'commit') {
63
- if (flags.some((f) => f === '--help' || f === '-h')) {
64
- showCommitHelp();
65
- process.exit(0);
66
- }
67
- enterRepoRootOrExit();
68
- try {
69
- commitCommand(flags);
70
- }
71
- catch (error) {
72
- reportError(describeError(error));
73
- process.exit(1);
74
- }
75
- process.exit(0);
76
- }
77
- if (command === 'tag') {
78
- if (flags.some((f) => f === '--help' || f === '-h')) {
79
- showTagHelp();
80
- process.exit(0);
81
- }
82
- enterRepoRootOrExit();
83
- tagCommand(flags, styles);
84
- process.exit(0);
85
- }
86
- if (command === 'push') {
87
- if (flags.some((f) => f === '--help' || f === '-h')) {
88
- showPushHelp();
89
- process.exit(0);
90
- }
91
- const { invocationDir } = enterRepoRootOrExit();
92
- await pushCommand(flags, styles, invocationDir);
93
- process.exit(0);
94
- }
95
- if (command === 'create-github-release') {
96
- if (flags.some((f) => f === '--help' || f === '-h')) {
97
- showCreateGithubReleaseHelp();
98
- process.exit(0);
99
- }
100
- const { invocationDir } = enterRepoRootOrExit();
101
- await createGithubReleaseCommand(flags, styles, invocationDir);
102
- process.exit(0);
103
- }
104
- if (command === 'publish') {
105
- if (flags.some((f) => f === '--help' || f === '-h')) {
106
- showPublishHelp();
107
- process.exit(0);
108
- }
109
- const { invocationDir } = enterRepoRootOrExit();
110
- await publishCommand(flags, styles, invocationDir);
111
- process.exit(0);
112
- }
113
- if (command === 'show-tag-prefixes') {
114
- if (flags.some((f) => f === '--help' || f === '-h')) {
115
- showShowTagPrefixesHelp();
116
- process.exit(0);
117
- }
118
- const { invocationDir } = enterRepoRootOrExit();
119
- const { config } = parseArgsOrExit(flags, configFlagSchema).flags;
120
- const exitCode = await showTagPrefixesCommand(styles, resolveConfigFlag(config, invocationDir));
121
- process.exit(exitCode);
122
- }
123
- if (command === 'init') {
124
- if (flags.some((f) => f === '--help' || f === '-h')) {
125
- showInitHelp();
126
- process.exit(0);
127
- }
128
- enterRepoRootOrExit();
129
- const initFlagSchema = {
130
- isDryRun: { long: '--dry-run', type: 'boolean' },
131
- shouldForce: { long: '--force', type: 'boolean' },
132
- shouldScaffoldConfig: { long: '--with-config', type: 'boolean' },
133
- };
134
- const { isDryRun, shouldForce, shouldScaffoldConfig } = parseArgsOrExit(flags, initFlagSchema).flags;
135
- const exitCode = initCommand({ isDryRun, shouldForce, styles, shouldScaffoldConfig });
136
- process.exit(exitCode);
137
- }
138
- if (command === 'update-templates') {
139
- if (flags.some((f) => f === '--help' || f === '-h')) {
140
- showUpdateTemplatesHelp();
141
- process.exit(0);
142
- }
143
- enterRepoRootOrExit();
144
- const updateTemplatesFlagSchema = {
145
- isDryRun: { long: '--dry-run', type: 'boolean' },
146
- };
147
- const { isDryRun } = parseArgsOrExit(flags, updateTemplatesFlagSchema).flags;
148
- const exitCode = updateTemplatesCommand({ isDryRun, styles });
149
- process.exit(exitCode);
150
- }
151
- if (command === 'sync-labels') {
152
- const subcommand = flags[0];
153
- if (subcommand === undefined || ['--help', '-h'].includes(subcommand)) {
154
- showSyncLabelsHelp();
155
- process.exit(0);
156
- }
157
- const subflags = flags.slice(1);
158
- if (subcommand === 'init') {
159
- if (subflags.some((f) => f === '--help' || f === '-h')) {
160
- showSyncLabelsInitHelp();
161
- process.exit(0);
162
- }
163
- const { invocationDir } = enterRepoRootOrExit();
164
- const syncLabelsInitFlagSchema = {
165
- ...configFlagSchema,
166
- isDryRun: { long: '--dry-run', type: 'boolean' },
167
- shouldForce: { long: '--force', type: 'boolean' },
168
- };
169
- const { config, isDryRun, shouldForce } = parseArgsOrExit(subflags, syncLabelsInitFlagSchema).flags;
170
- const configPath = resolveConfigFlag(config, invocationDir);
171
- const exitCode = await syncLabelsInitCommand({
172
- ...(configPath !== undefined && { configPath }),
173
- isDryRun,
174
- shouldForce,
175
- styles,
176
- });
177
- process.exit(exitCode);
178
- }
179
- if (subcommand === 'generate') {
180
- if (subflags.some((f) => f === '--help' || f === '-h')) {
181
- showSyncLabelsGenerateHelp();
182
- process.exit(0);
183
- }
184
- const { invocationDir } = enterRepoRootOrExit();
185
- const generateFlagSchema = {
186
- ...configFlagSchema,
187
- shouldCheck: { long: '--check', type: 'boolean' },
188
- };
189
- const { shouldCheck, config } = parseArgsOrExit(subflags, generateFlagSchema).flags;
190
- const configPath = resolveConfigFlag(config, invocationDir);
191
- const exitCode = await generateCommand({ shouldCheck, ...(configPath !== undefined && { configPath }), styles });
192
- process.exit(exitCode);
193
- }
194
- if (subcommand === 'sync') {
195
- if (subflags.some((f) => f === '--help' || f === '-h')) {
196
- showSyncLabelsSyncHelp();
197
- process.exit(0);
198
- }
199
- if (subflags.length > 0) {
200
- reportError(`Unknown option: ${subflags[0]}`);
201
- process.exit(1);
202
- }
203
- enterRepoRootOrExit();
204
- const exitCode = syncLabelsCommand();
205
- process.exit(exitCode);
206
- }
207
- reportError(`Unknown subcommand: ${subcommand}`);
208
- showSyncLabelsHelp();
209
- process.exit(1);
210
- }
211
- if (command === 'overrides') {
212
- const subcommand = flags[0];
213
- if (subcommand === undefined || ['--help', '-h'].includes(subcommand)) {
214
- showOverridesHelp();
215
- process.exit(0);
216
- }
217
- const subflags = flags.slice(1);
218
- if (subcommand === 'validate') {
219
- if (subflags.some((f) => f === '--help' || f === '-h')) {
220
- showOverridesValidateHelp();
221
- process.exit(0);
222
- }
223
- const { invocationDir } = enterRepoRootOrExit();
224
- const { config } = parseArgsOrExit(subflags, configFlagSchema).flags;
225
- const result = await validateOverridesCommand(styles, resolveConfigFlag(config, invocationDir));
226
- if (result.exitCode === 0) {
227
- console.info(result.message);
228
- }
229
- else {
230
- process.stderr.write(`${result.message}\n`);
231
- }
232
- process.exit(result.exitCode);
233
- }
234
- reportError(`Unknown subcommand: ${subcommand}`);
235
- showOverridesHelp();
236
- process.exit(1);
237
- }
238
- reportError(`Unknown command: ${command}`);
239
- showUsage();
240
- process.exit(1);
File without changes