@williamthorsen/release-kit 16.1.1 → 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 (59) hide show
  1. package/.meta/changelog.json +17 -0
  2. package/.readyup/kits/default.js +1 -1
  3. package/.readyup/manifest.json +3 -3
  4. package/CHANGELOG.md +6 -0
  5. package/README.md +2 -2
  6. package/dist/esm/assertCleanWorkingTree.js +14 -7
  7. package/dist/esm/assertReleasesOnNpm.js +11 -2
  8. package/dist/esm/assertTaggedBaseline.js +2 -1
  9. package/dist/esm/assertTarballsComplete.js +15 -3
  10. package/dist/esm/buildChangelogEntries.js +2 -2
  11. package/dist/esm/buildDependencyGraph.js +5 -4
  12. package/dist/esm/bumpVersion.js +3 -2
  13. package/dist/esm/changelogOverrides.js +3 -2
  14. package/dist/esm/cli.js +8 -237
  15. package/dist/esm/commitCommand.js +11 -5
  16. package/dist/esm/compareVersions.js +2 -1
  17. package/dist/esm/createGithubRelease.js +7 -1
  18. package/dist/esm/createGithubReleaseCommand.js +3 -4
  19. package/dist/esm/createTags.js +6 -4
  20. package/dist/esm/deleteFileIfExists.js +2 -1
  21. package/dist/esm/deriveDirectoryConfig.js +7 -6
  22. package/dist/esm/deriveWorkspaceConfig.js +4 -3
  23. package/dist/esm/enterRepoRoot.js +2 -1
  24. package/dist/esm/enumerateReleaseWindows.js +2 -2
  25. package/dist/esm/init/initCommand.js +10 -1
  26. package/dist/esm/init/updateTemplatesCommand.js +10 -1
  27. package/dist/esm/loadConfig.js +6 -5
  28. package/dist/esm/mergeConfig.js +5 -4
  29. package/dist/esm/monorepoConfigAssertions.js +6 -5
  30. package/dist/esm/packFromCleanCheckout.js +12 -3
  31. package/dist/esm/planVersionBump.js +6 -5
  32. package/dist/esm/prepareCommand.js +12 -22
  33. package/dist/esm/prepareComposite.js +2 -1
  34. package/dist/esm/prepareRunContext.js +2 -2
  35. package/dist/esm/previewTagPrefixes.js +2 -2
  36. package/dist/esm/publish.js +7 -1
  37. package/dist/esm/publishCommand.js +4 -18
  38. package/dist/esm/pushCommand.js +5 -12
  39. package/dist/esm/pushRelease.js +18 -6
  40. package/dist/esm/releaseFiles.js +2 -2
  41. package/dist/esm/releasePlan.js +2 -2
  42. package/dist/esm/resolveCommandTags.d.ts +4 -4
  43. package/dist/esm/resolveCommandTags.js +3 -5
  44. package/dist/esm/resolveReleaseDeclaration.js +9 -8
  45. package/dist/esm/resolveReleaseTags.js +11 -4
  46. package/dist/esm/resolveReleaseTargets.js +2 -1
  47. package/dist/esm/runCli.d.ts +5 -0
  48. package/dist/esm/runCli.js +224 -0
  49. package/dist/esm/showTagPrefixesCommand.js +5 -3
  50. package/dist/esm/sync-labels/generateCommand.js +4 -1
  51. package/dist/esm/sync-labels/initCommand.js +7 -1
  52. package/dist/esm/sync-labels/presets.js +7 -7
  53. package/dist/esm/sync-labels/resolveLabels.js +4 -3
  54. package/dist/esm/sync-labels/templates.js +2 -2
  55. package/dist/esm/tagCommand.js +2 -9
  56. package/dist/esm/user-error-chaining.d.ts +13 -0
  57. package/dist/esm/user-error-chaining.js +11 -0
  58. package/dist/esm/validateOverridesCommand.js +7 -1
  59. package/package.json +2 -2
@@ -1,5 +1,4 @@
1
- import { parseArgsOrExit, reportError } from '@williamthorsen/nmr-core';
2
- import { describeError } from '@williamthorsen/toolbelt.errors';
1
+ import { parseArgsOrExit } from '@williamthorsen/nmr-core';
3
2
  import { createTags } from "./createTags.js";
4
3
  const tagFlagSchema = {
5
4
  isDryRun: { long: '--dry-run', type: 'boolean' },
@@ -7,11 +6,5 @@ const tagFlagSchema = {
7
6
  };
8
7
  export function tagCommand(argv, styles) {
9
8
  const { isDryRun, shouldSkipGitChecks } = parseArgsOrExit(argv, tagFlagSchema).flags;
10
- try {
11
- createTags({ isDryRun, shouldSkipGitChecks, style: styles.stdout });
12
- }
13
- catch (error) {
14
- reportError(describeError(error));
15
- process.exit(1);
16
- }
9
+ createTags({ isDryRun, shouldSkipGitChecks, style: styles.stdout });
17
10
  }
@@ -0,0 +1,13 @@
1
+ import { UserError } from '@williamthorsen/nmr-core';
2
+ /**
3
+ * Returns `error` as a `UserError` with the same message, for a failure that the tool anticipates, such as a failed
4
+ * external command.
5
+ */
6
+ export declare function asUserError(error: unknown): UserError;
7
+ /** Wraps an anticipated failure as a `UserError` that reads `<message>: <cause's message>`. */
8
+ export declare function chainUserError(message: string, cause: unknown): UserError;
9
+ /**
10
+ * Prefixes an anticipated failure (see `isAnticipatedFailure`) with `<message>: ` as a `UserError`, and returns any
11
+ * other value unchanged, so that a crash keeps its own stack when rethrown.
12
+ */
13
+ export declare function prefixUserError(message: string, error: unknown): unknown;
@@ -0,0 +1,11 @@
1
+ import { isAnticipatedFailure, UserError } from '@williamthorsen/nmr-core';
2
+ import { describeError } from '@williamthorsen/toolbelt.errors';
3
+ export function asUserError(error) {
4
+ return error instanceof UserError ? error : new UserError(describeError(error), { cause: error });
5
+ }
6
+ export function chainUserError(message, cause) {
7
+ return new UserError(`${message}: ${describeError(cause)}`, { cause });
8
+ }
9
+ export function prefixUserError(message, error) {
10
+ return isAnticipatedFailure(error) ? chainUserError(message, error) : error;
11
+ }
@@ -1,4 +1,4 @@
1
- import { formatErrorLine, formatStatusLine } from '@williamthorsen/nmr-core';
1
+ import { formatErrorLine, formatStatusLine, isAnticipatedFailure, } from '@williamthorsen/nmr-core';
2
2
  import { describeError } from '@williamthorsen/toolbelt.errors';
3
3
  import { buildChangelogEntries } from "./buildChangelogEntries.js";
4
4
  import { resolveOverridePath } from "./changelogOverrides.js";
@@ -23,6 +23,9 @@ export async function validateOverridesCommand(styles, configPath, dependencies
23
23
  workspace = discover();
24
24
  }
25
25
  catch (error) {
26
+ if (!isAnticipatedFailure(error)) {
27
+ throw error;
28
+ }
26
29
  return { exitCode: 2, message: formatErrorLine(`Failed to discover workspaces: ${describeError(error)}`) };
27
30
  }
28
31
  if (workspace.kind === 'empty') {
@@ -36,6 +39,9 @@ export async function validateOverridesCommand(styles, configPath, dependencies
36
39
  inputs = buildValidationInputs(resolveReleaseTargets(userConfig, workspace), buildEntries);
37
40
  }
38
41
  catch (error) {
42
+ if (!isAnticipatedFailure(error)) {
43
+ throw error;
44
+ }
39
45
  return { exitCode: 2, message: formatErrorLine(`Failed to resolve overrides scope: ${describeError(error)}`) };
40
46
  }
41
47
  const result = validate(inputs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/release-kit",
3
- "version": "16.1.1",
3
+ "version": "16.1.2",
4
4
  "description": "Version-bumping and changelog-generation toolkit for release workflows",
5
5
  "keywords": [
6
6
  "changelog",
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "@williamthorsen/change-grammar": "0.3.0",
55
- "@williamthorsen/nmr-core": "0.15.0",
55
+ "@williamthorsen/nmr-core": "0.15.1",
56
56
  "@williamthorsen/toolbelt.errors": "0.9.0",
57
57
  "json-stringify-pretty-compact": "4.0.0",
58
58
  "semver": "7.8.6",