rman 1.3.0 → 2.0.0-beta.3

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 (187) hide show
  1. package/README.md +65 -31
  2. package/builtins/platforms/node/augmentation/rmanrc.augmentation.d.ts +83 -0
  3. package/builtins/platforms/node/augmentation/system-info.augmentation.d.ts +26 -0
  4. package/builtins/platforms/node/augmentation/system-info.augmentation.js +79 -0
  5. package/builtins/platforms/node/commands/ci.command.d.ts +133 -0
  6. package/builtins/platforms/node/commands/ci.command.js +60 -0
  7. package/builtins/platforms/node/commands/clean.command.d.ts +185 -0
  8. package/builtins/platforms/node/commands/clean.command.js +74 -0
  9. package/builtins/platforms/node/index.d.ts +8 -0
  10. package/builtins/platforms/node/index.js +8 -0
  11. package/builtins/platforms/node/node-config.interface.d.ts +76 -0
  12. package/builtins/platforms/node/node-config.interface.js +7 -0
  13. package/builtins/platforms/node/node-manifest.provider.d.ts +68 -0
  14. package/builtins/platforms/node/node-manifest.provider.js +125 -0
  15. package/builtins/platforms/node/node.platform.d.ts +53 -0
  16. package/builtins/platforms/node/node.platform.js +134 -0
  17. package/builtins/platforms/node/services/ci.service.d.ts +47 -0
  18. package/builtins/platforms/node/services/ci.service.js +213 -0
  19. package/builtins/platforms/node/services/clean.service.d.ts +53 -0
  20. package/builtins/platforms/node/services/clean.service.js +237 -0
  21. package/builtins/platforms/node/services/publish.service.d.ts +114 -0
  22. package/builtins/platforms/node/services/publish.service.js +371 -0
  23. package/builtins/platforms/node/services/version-plan.service.d.ts +44 -0
  24. package/builtins/platforms/node/services/version-plan.service.js +58 -0
  25. package/builtins/platforms/node/utils/workspace-range.d.ts +26 -0
  26. package/builtins/platforms/node/utils/workspace-range.js +28 -0
  27. package/builtins/presets/index.d.ts +15 -0
  28. package/builtins/presets/index.js +57 -0
  29. package/builtins/presets/node.d.ts +16 -0
  30. package/builtins/presets/node.js +57 -0
  31. package/{services → builtins/publish-targets/docker}/docker-publish.service.d.ts +52 -31
  32. package/{services → builtins/publish-targets/docker}/docker-publish.service.js +49 -26
  33. package/builtins/publish-targets/docker/docker.target.d.ts +54 -0
  34. package/builtins/publish-targets/docker/docker.target.js +40 -0
  35. package/builtins/publish-targets/docker/index.d.ts +2 -0
  36. package/builtins/publish-targets/docker/index.js +2 -0
  37. package/builtins/publish-targets/npm/index.d.ts +2 -0
  38. package/builtins/publish-targets/npm/index.js +2 -0
  39. package/builtins/publish-targets/npm/npm-publish-target.d.ts +73 -0
  40. package/builtins/publish-targets/npm/npm-publish-target.js +95 -0
  41. package/builtins/publish-targets/npm/npm-view.d.ts +48 -0
  42. package/builtins/publish-targets/npm/npm-view.js +71 -0
  43. package/cli.d.ts +8 -0
  44. package/cli.js +228 -93
  45. package/commands/build.command.d.ts +177 -3
  46. package/commands/build.command.js +20 -10
  47. package/commands/changelog.command.d.ts +296 -3
  48. package/commands/changelog.command.js +127 -43
  49. package/commands/config.command.d.ts +44 -3
  50. package/commands/config.command.js +53 -24
  51. package/commands/diff.command.d.ts +37 -3
  52. package/commands/diff.command.js +25 -16
  53. package/commands/exec.command.d.ts +193 -3
  54. package/commands/exec.command.js +60 -58
  55. package/commands/github-release.command.d.ts +154 -3
  56. package/commands/github-release.command.js +67 -37
  57. package/commands/import.command.d.ts +36 -3
  58. package/commands/import.command.js +28 -20
  59. package/commands/info.command.d.ts +35 -7
  60. package/commands/info.command.js +36 -30
  61. package/commands/lint.command.d.ts +176 -0
  62. package/commands/lint.command.js +34 -0
  63. package/commands/list.command.d.ts +163 -3
  64. package/commands/list.command.js +109 -71
  65. package/commands/publish.command.d.ts +231 -0
  66. package/commands/publish.command.js +304 -0
  67. package/commands/run.command.d.ts +186 -6
  68. package/commands/run.command.js +26 -72
  69. package/commands/test.command.d.ts +173 -3
  70. package/commands/test.command.js +16 -10
  71. package/commands/version.command.d.ts +330 -3
  72. package/commands/version.command.js +292 -78
  73. package/commands.d.ts +32 -0
  74. package/commands.js +28 -0
  75. package/constants.js +1 -1
  76. package/core/application.d.ts +116 -0
  77. package/core/application.js +160 -0
  78. package/core/classes/package.d.ts +219 -0
  79. package/core/classes/package.js +214 -0
  80. package/core/classes/registry.d.ts +30 -0
  81. package/core/classes/registry.js +47 -0
  82. package/core/{repository.d.ts → classes/repository.d.ts} +69 -20
  83. package/core/{repository.js → classes/repository.js} +195 -75
  84. package/core/classes/service.d.ts +49 -0
  85. package/core/classes/service.js +40 -0
  86. package/core/{version-scheme.d.ts → classes/version-scheme.d.ts} +23 -1
  87. package/core/{version-scheme.js → classes/version-scheme.js} +29 -1
  88. package/core/classes/workspace.d.ts +275 -0
  89. package/core/classes/workspace.js +537 -0
  90. package/core/command-builder.d.ts +14 -0
  91. package/core/command-builder.js +94 -0
  92. package/core/config/config-file-scope.d.ts +107 -0
  93. package/core/config/config-file-scope.js +226 -0
  94. package/core/config/config-interpolator.d.ts +164 -0
  95. package/core/config/config-interpolator.js +577 -0
  96. package/core/config/config-paths.d.ts +65 -0
  97. package/core/config/config-paths.js +78 -0
  98. package/core/config/config-reader.d.ts +192 -0
  99. package/core/config/config-reader.js +727 -0
  100. package/core/{merge-config.d.ts → config/merge-config.d.ts} +33 -34
  101. package/core/config/merge-config.js +260 -0
  102. package/core/{resolve-target.d.ts → config/resolve-config-target.d.ts} +1 -1
  103. package/core/{resolve-target.js → config/resolve-config-target.js} +1 -1
  104. package/core/{custom-command.d.ts → interfaces/custom-command.d.ts} +46 -10
  105. package/core/{custom-command.js → interfaces/custom-command.js} +44 -17
  106. package/core/{manifest.d.ts → interfaces/manifest.d.ts} +49 -27
  107. package/core/interfaces/manifest.js +132 -0
  108. package/core/interfaces/plugin.d.ts +174 -0
  109. package/core/interfaces/plugin.js +124 -0
  110. package/core/interfaces/publish-target.d.ts +136 -0
  111. package/core/interfaces/publish-target.js +43 -0
  112. package/core/{run-step.d.ts → interfaces/run-step.d.ts} +4 -4
  113. package/core/interfaces/run-step.js +1 -0
  114. package/core/plugin-loader.d.ts +25 -0
  115. package/core/plugin-loader.js +53 -0
  116. package/index.d.ts +122 -24
  117. package/index.js +66 -16
  118. package/interfaces/config-scope.interface.d.ts +223 -0
  119. package/interfaces/config-scope.interface.js +1 -0
  120. package/interfaces/rman-config.interface.d.ts +821 -203
  121. package/interfaces/rman-config.interface.js +78 -1
  122. package/package.json +3 -1
  123. package/services/change-hash.service.d.ts +42 -8
  124. package/services/change-hash.service.js +92 -13
  125. package/services/changelog.service.d.ts +91 -52
  126. package/services/changelog.service.js +460 -74
  127. package/services/config-service.d.ts +8 -0
  128. package/services/config-service.js +3 -0
  129. package/services/exec.service.d.ts +23 -12
  130. package/services/exec.service.js +14 -9
  131. package/services/github-release.service.d.ts +45 -34
  132. package/services/github-release.service.js +15 -12
  133. package/services/import.service.d.ts +25 -14
  134. package/services/import.service.js +9 -5
  135. package/services/list.service.d.ts +67 -13
  136. package/services/list.service.js +62 -15
  137. package/services/run.service.d.ts +35 -22
  138. package/services/run.service.js +316 -233
  139. package/services/system-info.d.ts +1 -1
  140. package/services/version-plan.service.d.ts +35 -8
  141. package/services/version-plan.service.js +96 -36
  142. package/services/version.service.d.ts +34 -14
  143. package/services/version.service.js +35 -16
  144. package/services.d.ts +1 -1
  145. package/services.js +1 -1
  146. package/utils/bin-path.d.ts +6 -7
  147. package/utils/bin-path.js +7 -18
  148. package/utils/branch-guard.d.ts +30 -1
  149. package/utils/branch-guard.js +31 -0
  150. package/utils/color-yaml.d.ts +8 -0
  151. package/utils/color-yaml.js +86 -0
  152. package/utils/exec.d.ts +10 -0
  153. package/utils/exec.js +1 -1
  154. package/utils/git.d.ts +26 -0
  155. package/utils/git.js +65 -0
  156. package/utils/logger.d.ts +2 -2
  157. package/utils/logger.js +1 -1
  158. package/utils/package-filter.d.ts +135 -8
  159. package/utils/package-filter.js +204 -16
  160. package/utils/printable-config.d.ts +9 -1
  161. package/utils/printable-config.js +46 -1
  162. package/utils/progress-panel.d.ts +9 -0
  163. package/utils/progress-panel.js +23 -1
  164. package/utils/release-version.d.ts +1 -1
  165. package/utils/run-bin.d.ts +10 -0
  166. package/utils/run-bin.js +1 -1
  167. package/utils/run-options.d.ts +97 -0
  168. package/utils/run-options.js +81 -0
  169. package/utils/version-group.d.ts +31 -0
  170. package/utils/version-group.js +43 -0
  171. package/utils/version-stamp.d.ts +1 -1
  172. package/utils/version-stamp.js +1 -1
  173. package/commands/changed.command.d.ts +0 -3
  174. package/commands/changed.command.js +0 -29
  175. package/core/config.d.ts +0 -409
  176. package/core/config.js +0 -939
  177. package/core/extends-config.d.ts +0 -27
  178. package/core/extends-config.js +0 -89
  179. package/core/manifest.js +0 -150
  180. package/core/merge-config.js +0 -219
  181. package/core/package.d.ts +0 -83
  182. package/core/package.js +0 -106
  183. package/core/plugin.d.ts +0 -112
  184. package/core/plugin.js +0 -189
  185. package/core/workspace.d.ts +0 -68
  186. package/core/workspace.js +0 -83
  187. /package/{core/run-step.js → builtins/platforms/node/augmentation/rmanrc.augmentation.js} +0 -0
@@ -1,15 +1,25 @@
1
- import { RunService } from '../services/run.service.js';
1
+ import { registerCommand } from '../interfaces/rman-config.interface.js';
2
2
  import { assertAllowedBranch, readBranchGuardOptions } from '../utils/branch-guard.js';
3
- import { applyRunOptions, readRunOptions } from './run.command.js';
4
- export function initCli(repository, program) {
5
- program.command({
6
- command: 'build',
7
- configKeys: ['run.build'],
3
+ import { readRunOptions, runOptions } from '../utils/run-options.js';
4
+ const COMMAND = 'build';
5
+ const config = runOptions;
6
+ const buildCommand = registerCommand(app => {
7
+ const repository = app.repository;
8
+ return {
9
+ command: COMMAND,
8
10
  describe: 'Alias for "run build"',
9
- builder: cmd => applyRunOptions(cmd).example('$0 build', '# Builds packages'),
11
+ /**
12
+ * Read, not owned - and it owns nothing at all. `build` is `run build` under another name, so its
13
+ * settings live in `run.build`, which belongs to `run`. Two commands cannot contribute under one
14
+ * top-level key (interface merging is not a deep merge), and this is why they never needed to.
15
+ */
16
+ configKeys: ['run.build'],
17
+ config,
18
+ examples: [{ command: '$0 build', description: '# Builds packages' }],
10
19
  handler: async (args) => {
11
20
  await assertAllowedBranch(repository, readBranchGuardOptions(args));
12
- await RunService.runScript(repository, 'build', { ...readRunOptions(args), commandName: 'build' });
21
+ await app.getService('run').runScript('build', { ...readRunOptions(args), commandName: 'build' });
13
22
  },
14
- });
15
- }
23
+ };
24
+ });
25
+ export default buildCommand;
@@ -1,3 +1,296 @@
1
- import type { Argv } from 'yargs';
2
- import type { Repository } from '../core/repository.js';
3
- export declare function initCli(repository: Repository, program: Argv): void;
1
+ import type { ConfigValue, RmanConfig } from '../interfaces/rman-config.interface.js';
2
+ declare const COMMAND: "changelog";
3
+ declare const config: {
4
+ from: {
5
+ target: "cli";
6
+ describe: string;
7
+ type: "string";
8
+ };
9
+ write: {
10
+ target: "cli";
11
+ describe: string;
12
+ type: "boolean";
13
+ };
14
+ /** The one option here that is also a config key - hence `'both'`, and hence this command
15
+ * contributing `changelog.filePath` to `RmanConfig`. */
16
+ filePath: {
17
+ target: "both";
18
+ cliName: string;
19
+ describe: string;
20
+ type: "string";
21
+ };
22
+ includeSkipped: {
23
+ target: "cli";
24
+ cliName: string;
25
+ describe: string;
26
+ type: "boolean";
27
+ };
28
+ releaseVersion: {
29
+ target: "cli";
30
+ cliName: string;
31
+ describe: string;
32
+ type: "string";
33
+ };
34
+ /**
35
+ * Config-only, from here down - `.rmanrc "changelog.*"` keys with no reason to be a flag. All
36
+ * three are plain strings or a string list, so this command needs no `Extra` at all: its whole
37
+ * config block is derived from what is declared here.
38
+ */
39
+ ignoreTypes: {
40
+ target: "config";
41
+ describe: string;
42
+ type: "string";
43
+ array: true;
44
+ };
45
+ template: {
46
+ target: "config";
47
+ describe: string;
48
+ type: "string";
49
+ };
50
+ tagPattern: {
51
+ target: "config";
52
+ describe: string;
53
+ type: "string";
54
+ };
55
+ /**
56
+ * **Where a package's history starts being worth documenting**, as one key taking whichever form
57
+ * the answer naturally has - a version or tag, a date, or a commit.
58
+ *
59
+ * `'both'`, because it is a lasting fact about the package ("we do not publish what happened
60
+ * before 2.0"), not a decision per run. That is also what separates it from `--from`, which those
61
+ * three forms would otherwise duplicate: `--from` is this run's boundary and applies identically
62
+ * to every package, while this lives in `.rmanrc`, is cascaded per package, and still holds on
63
+ * the run after next.
64
+ */
65
+ /**
66
+ * **Default `true`, so the flag that does something is `--no-unreleased`** - and that is the one
67
+ * place this deliberately differs from `auto-changelog`, which defaults it off.
68
+ *
69
+ * There, a changelog is generated from a finished history and the unreleased section is the
70
+ * unusual thing to want. Here it is the *ordinary* one: `rman changelog` exists to answer what is
71
+ * not released yet, down to the message it prints when there is nothing ("No unreleased
72
+ * changes."), and `version --changelog` writes the entry for the release it is about to cut -
73
+ * which is that segment. Defaulting it off would make the common case need a flag, and make
74
+ * `version --changelog` silently write nothing.
75
+ *
76
+ * What it *is* for is the other direction, which only became possible once `--write` started
77
+ * backfilling: a changelog of released history, with the work in progress left out.
78
+ */
79
+ unreleased: {
80
+ target: "both";
81
+ describe: string;
82
+ type: "boolean";
83
+ };
84
+ startingAt: {
85
+ target: "both";
86
+ cliName: string;
87
+ describe: string;
88
+ type: "string";
89
+ };
90
+ fromRoot: {
91
+ target: "cli";
92
+ cliName: string;
93
+ alias: string;
94
+ describe: string;
95
+ type: "boolean";
96
+ };
97
+ scope: {
98
+ target: "cli";
99
+ describe: string;
100
+ type: "string";
101
+ };
102
+ ignore: {
103
+ target: "cli";
104
+ describe: string;
105
+ type: "string";
106
+ };
107
+ platform: {
108
+ target: "cli";
109
+ describe: string;
110
+ type: "string";
111
+ };
112
+ deps: {
113
+ target: "cli";
114
+ describe: string;
115
+ type: "boolean";
116
+ };
117
+ dependents: {
118
+ target: "cli";
119
+ describe: string;
120
+ type: "boolean";
121
+ };
122
+ };
123
+ /**
124
+ * **What a `CommandOption` cannot say**, which is the only thing `Extra` is for: `titles` is a map
125
+ * from commit type to section heading, and an option says `type: 'string'`.
126
+ */
127
+ export interface ChangelogExtraKeys {
128
+ /**
129
+ * The heading each Conventional Commits type is listed under - `{ feat: 'New Features', dev:
130
+ * 'Development Changes' }`. Per-package cascaded.
131
+ *
132
+ * **Merged over the defaults per key, not replacing them**, the way `vars` merges: naming `dev`
133
+ * adds a section without silently costing you `feat` and `fix`, and renaming `feat` leaves it
134
+ * where it was in the order. The cost, stated rather than hidden - you cannot *remove* a default
135
+ * section by leaving it out; `changelog.ignoreTypes` is the key that drops a type entirely.
136
+ *
137
+ * Two types sharing a heading share one section. `'*'` is the heading for every type that is not
138
+ * named here, and is always rendered last; a subject that is not Conventional Commits at all has
139
+ * no type to key off and lands there too.
140
+ *
141
+ * Sections come out in the order the types were declared, defaults first - so a repository
142
+ * chooses both the wording and the running order.
143
+ */
144
+ titles?: ConfigValue<Record<string, string>>;
145
+ /**
146
+ * The order the sections come out in, as a list of commit **types** - `['fix', 'feat', 'docs']`.
147
+ * Per-package cascaded.
148
+ *
149
+ * Separate from `titles` because they are separate decisions, and letting one key do both was
150
+ * the wrong shape: `titles` patches a heading's *wording*, so a repository renaming `feat` would
151
+ * otherwise also be silently re-deciding where it sits. A type left out keeps its place after the
152
+ * listed ones; `'*'` is always last whatever this says, since a catch-all in the middle swallows
153
+ * the sections after it.
154
+ */
155
+ sortTitles?: ConfigValue<string[]>;
156
+ }
157
+ type Args = RmanConfig.ArgsOf<typeof config, typeof COMMAND>;
158
+ declare const changelogCommand: (app: import("../index.js").RmanApplication) => {
159
+ command: "changelog";
160
+ describe: string;
161
+ /** Read, not owned: `publish.skip` is `publish`'s key, reused here on purpose - a package that is
162
+ * never distributed gets no release notes either. */
163
+ configKeys: string[];
164
+ config: {
165
+ from: {
166
+ target: "cli";
167
+ describe: string;
168
+ type: "string";
169
+ };
170
+ write: {
171
+ target: "cli";
172
+ describe: string;
173
+ type: "boolean";
174
+ };
175
+ /** The one option here that is also a config key - hence `'both'`, and hence this command
176
+ * contributing `changelog.filePath` to `RmanConfig`. */
177
+ filePath: {
178
+ target: "both";
179
+ cliName: string;
180
+ describe: string;
181
+ type: "string";
182
+ };
183
+ includeSkipped: {
184
+ target: "cli";
185
+ cliName: string;
186
+ describe: string;
187
+ type: "boolean";
188
+ };
189
+ releaseVersion: {
190
+ target: "cli";
191
+ cliName: string;
192
+ describe: string;
193
+ type: "string";
194
+ };
195
+ /**
196
+ * Config-only, from here down - `.rmanrc "changelog.*"` keys with no reason to be a flag. All
197
+ * three are plain strings or a string list, so this command needs no `Extra` at all: its whole
198
+ * config block is derived from what is declared here.
199
+ */
200
+ ignoreTypes: {
201
+ target: "config";
202
+ describe: string;
203
+ type: "string";
204
+ array: true;
205
+ };
206
+ template: {
207
+ target: "config";
208
+ describe: string;
209
+ type: "string";
210
+ };
211
+ tagPattern: {
212
+ target: "config";
213
+ describe: string;
214
+ type: "string";
215
+ };
216
+ /**
217
+ * **Where a package's history starts being worth documenting**, as one key taking whichever form
218
+ * the answer naturally has - a version or tag, a date, or a commit.
219
+ *
220
+ * `'both'`, because it is a lasting fact about the package ("we do not publish what happened
221
+ * before 2.0"), not a decision per run. That is also what separates it from `--from`, which those
222
+ * three forms would otherwise duplicate: `--from` is this run's boundary and applies identically
223
+ * to every package, while this lives in `.rmanrc`, is cascaded per package, and still holds on
224
+ * the run after next.
225
+ */
226
+ /**
227
+ * **Default `true`, so the flag that does something is `--no-unreleased`** - and that is the one
228
+ * place this deliberately differs from `auto-changelog`, which defaults it off.
229
+ *
230
+ * There, a changelog is generated from a finished history and the unreleased section is the
231
+ * unusual thing to want. Here it is the *ordinary* one: `rman changelog` exists to answer what is
232
+ * not released yet, down to the message it prints when there is nothing ("No unreleased
233
+ * changes."), and `version --changelog` writes the entry for the release it is about to cut -
234
+ * which is that segment. Defaulting it off would make the common case need a flag, and make
235
+ * `version --changelog` silently write nothing.
236
+ *
237
+ * What it *is* for is the other direction, which only became possible once `--write` started
238
+ * backfilling: a changelog of released history, with the work in progress left out.
239
+ */
240
+ unreleased: {
241
+ target: "both";
242
+ describe: string;
243
+ type: "boolean";
244
+ };
245
+ startingAt: {
246
+ target: "both";
247
+ cliName: string;
248
+ describe: string;
249
+ type: "string";
250
+ };
251
+ fromRoot: {
252
+ target: "cli";
253
+ cliName: string;
254
+ alias: string;
255
+ describe: string;
256
+ type: "boolean";
257
+ };
258
+ scope: {
259
+ target: "cli";
260
+ describe: string;
261
+ type: "string";
262
+ };
263
+ ignore: {
264
+ target: "cli";
265
+ describe: string;
266
+ type: "string";
267
+ };
268
+ platform: {
269
+ target: "cli";
270
+ describe: string;
271
+ type: "string";
272
+ };
273
+ deps: {
274
+ target: "cli";
275
+ describe: string;
276
+ type: "boolean";
277
+ };
278
+ dependents: {
279
+ target: "cli";
280
+ describe: string;
281
+ type: "boolean";
282
+ };
283
+ };
284
+ examples: {
285
+ command: string;
286
+ description: string;
287
+ }[];
288
+ handler: (args: Args) => Promise<void>;
289
+ };
290
+ export default changelogCommand;
291
+ declare module '../interfaces/rman-config.interface.js' {
292
+ namespace RmanConfig {
293
+ interface CommandConfigs extends RmanConfig.CommandContribution<ReturnType<typeof changelogCommand>, ChangelogExtraKeys> {
294
+ }
295
+ }
296
+ }
@@ -1,44 +1,126 @@
1
1
  import colors from 'ansi-colors';
2
+ import { registerCommand } from '../interfaces/rman-config.interface.js';
2
3
  import { ChangeHashService } from '../services/change-hash.service.js';
3
- import { ChangelogService } from '../services/changelog.service.js';
4
4
  import { Logger, resolveRootLogLevel } from '../utils/logger.js';
5
- import { applyPackageFilterOptions, applyRootOption, readPackageFilterOptions } from '../utils/package-filter.js';
6
- export function initCli(repository, program) {
7
- program.command({
8
- command: 'changelog',
9
- configKeys: ['changelog', 'publish.skip'],
5
+ import { fromRootOption, packageFilterOptions, readPackageFilterOptions } from '../utils/package-filter.js';
6
+ const COMMAND = 'changelog';
7
+ const config = {
8
+ ...packageFilterOptions,
9
+ ...fromRootOption('Generate'),
10
+ from: {
11
+ target: 'cli',
12
+ describe: 'Generate the changelog since this commit/hash, applied the same way to every package. ' +
13
+ 'Default (also "auto" explicitly): auto-detect per package from its own most recent release ' +
14
+ 'tag - same as "version"/"changed" - falling back to the version its own ecosystem\'s ' +
15
+ "registry reports (no tag yet), then to its whole history for a package that's never been " +
16
+ 'released at all',
17
+ type: 'string',
18
+ },
19
+ write: {
20
+ target: 'cli',
21
+ describe: "Prepend the entry into each package's own changelog file instead of printing it",
22
+ type: 'boolean',
23
+ },
24
+ /** The one option here that is also a config key - hence `'both'`, and hence this command
25
+ * contributing `changelog.filePath` to `RmanConfig`. */
26
+ filePath: {
27
+ target: 'both',
28
+ cliName: 'file-path',
29
+ describe: "With --write, the file to prepend into, relative to each package's own directory " +
30
+ '(default: "CHANGELOG.md", or .rmanrc "changelog.filePath")',
31
+ type: 'string',
32
+ },
33
+ includeSkipped: {
34
+ target: 'cli',
35
+ cliName: 'include-skipped',
36
+ describe: 'Also generate for a package with .rmanrc "publish.skip" - excluded by default',
37
+ type: 'boolean',
38
+ },
39
+ releaseVersion: {
40
+ target: 'cli',
41
+ cliName: 'release-version',
42
+ describe: 'The version these notes are for - what the entry heading shows. Default: read back from ' +
43
+ "each package's own latest release tag, which is only right once that release is tagged. " +
44
+ 'Pass it when generating notes ahead of the bump (e.g. from "changed --json" in CI), ' +
45
+ 'otherwise the heading shows the previous release.',
46
+ type: 'string',
47
+ },
48
+ /**
49
+ * Config-only, from here down - `.rmanrc "changelog.*"` keys with no reason to be a flag. All
50
+ * three are plain strings or a string list, so this command needs no `Extra` at all: its whole
51
+ * config block is derived from what is declared here.
52
+ */
53
+ ignoreTypes: {
54
+ target: 'config',
55
+ describe: 'Conventional-commit types to leave out of the notes entirely (e.g. ["chore", "ci"])',
56
+ type: 'string',
57
+ array: true,
58
+ },
59
+ template: {
60
+ target: 'config',
61
+ describe: "Path to a template file for one package's entry, relative to the repository root. Its own " +
62
+ "{{package}}/{{version}} placeholders are that file's content, not config expressions.",
63
+ type: 'string',
64
+ },
65
+ tagPattern: {
66
+ target: 'config',
67
+ describe: "The release tag naming scheme each package's changelog boundary is detected from - " +
68
+ '"{name}" is replaced with the package name (e.g. "{name}@*" for independent versioning). ' +
69
+ 'Default "v*", one repo-wide tag resolved through git describe.',
70
+ type: 'string',
71
+ },
72
+ /**
73
+ * **Where a package's history starts being worth documenting**, as one key taking whichever form
74
+ * the answer naturally has - a version or tag, a date, or a commit.
75
+ *
76
+ * `'both'`, because it is a lasting fact about the package ("we do not publish what happened
77
+ * before 2.0"), not a decision per run. That is also what separates it from `--from`, which those
78
+ * three forms would otherwise duplicate: `--from` is this run's boundary and applies identically
79
+ * to every package, while this lives in `.rmanrc`, is cascaded per package, and still holds on
80
+ * the run after next.
81
+ */
82
+ /**
83
+ * **Default `true`, so the flag that does something is `--no-unreleased`** - and that is the one
84
+ * place this deliberately differs from `auto-changelog`, which defaults it off.
85
+ *
86
+ * There, a changelog is generated from a finished history and the unreleased section is the
87
+ * unusual thing to want. Here it is the *ordinary* one: `rman changelog` exists to answer what is
88
+ * not released yet, down to the message it prints when there is nothing ("No unreleased
89
+ * changes."), and `version --changelog` writes the entry for the release it is about to cut -
90
+ * which is that segment. Defaulting it off would make the common case need a flag, and make
91
+ * `version --changelog` silently write nothing.
92
+ *
93
+ * What it *is* for is the other direction, which only became possible once `--write` started
94
+ * backfilling: a changelog of released history, with the work in progress left out.
95
+ */
96
+ unreleased: {
97
+ target: 'both',
98
+ describe: 'Include the entry for commits that are not released yet (default true) - pass ' +
99
+ '--no-unreleased for a changelog of released history only',
100
+ type: 'boolean',
101
+ },
102
+ startingAt: {
103
+ target: 'both',
104
+ cliName: 'starting-at',
105
+ describe: "Where this package's changelog begins: a version or release tag (inclusive), a YYYY-MM-DD " +
106
+ 'date, or a commit. Releases older than it are left out - for a package whose early ' +
107
+ 'development does not belong in its changelog',
108
+ type: 'string',
109
+ },
110
+ };
111
+ const changelogCommand = registerCommand(app => {
112
+ const repository = app.repository;
113
+ return {
114
+ command: COMMAND,
10
115
  describe: 'Generates a changelog per package from unreleased commits',
11
- builder: cmd => applyRootOption(applyPackageFilterOptions(cmd), 'Generate')
12
- .example('$0 changelog', "# Auto-detects each package's own last release tag (or npm version)")
13
- .example('$0 changelog --from <hash> --write', '# Since a specific commit, written to file')
14
- .option('from', {
15
- describe: 'Generate the changelog since this commit/hash, applied the same way to every package. ' +
16
- 'Default (also "auto" explicitly): auto-detect per package from its own most recent release ' +
17
- 'tag - same as "version"/"changed" - falling back to the version its own ecosystem\'s ' +
18
- "registry reports (no tag yet), then to its whole history for a package that's never been " +
19
- 'released at all',
20
- type: 'string',
21
- })
22
- .option('write', {
23
- describe: "Prepend the entry into each package's own changelog file instead of printing it",
24
- type: 'boolean',
25
- })
26
- .option('file-path', {
27
- describe: "With --write, the file to prepend into, relative to each package's own directory " +
28
- '(default: "CHANGELOG.md", or .rmanrc "changelog.filePath")',
29
- type: 'string',
30
- })
31
- .option('include-skipped', {
32
- describe: 'Also generate for a package with .rmanrc "publish.skip" - excluded by default',
33
- type: 'boolean',
34
- })
35
- .option('release-version', {
36
- describe: 'The version these notes are for - what the entry heading shows. Default: read back from ' +
37
- "each package's own latest release tag, which is only right once that release is tagged. " +
38
- 'Pass it when generating notes ahead of the bump (e.g. from "changed --json" in CI), ' +
39
- 'otherwise the heading shows the previous release.',
40
- type: 'string',
41
- }),
116
+ /** Read, not owned: `publish.skip` is `publish`'s key, reused here on purpose - a package that is
117
+ * never distributed gets no release notes either. */
118
+ configKeys: ['publish.skip'],
119
+ config,
120
+ examples: [
121
+ { command: '$0 changelog', description: "# Auto-detects each package's own last release tag (or npm version)" },
122
+ { command: '$0 changelog --from <hash> --write', description: '# Since a specific commit, written to file' },
123
+ ],
42
124
  handler: async (args) => {
43
125
  const from = args.from;
44
126
  const write = args.write;
@@ -54,13 +136,14 @@ export function initCli(repository, program) {
54
136
  ...readPackageFilterOptions(args),
55
137
  from,
56
138
  filePath: args.filePath,
57
- root: args.root,
139
+ fromRoot: args.fromRoot,
58
140
  includeSkipped: args.includeSkipped,
59
141
  version: args.releaseVersion,
142
+ startingAt: args.startingAt,
143
+ unreleased: args.unreleased,
60
144
  };
61
- const entries = args.write
62
- ? await ChangelogService.generateToFile(repository, options)
63
- : await ChangelogService.getEntries(repository, options);
145
+ const changelog = app.getService('changelog');
146
+ const entries = write ? await changelog.generateToFile(options) : await changelog.getEntries(options);
64
147
  if (!entries.length) {
65
148
  logger.info(colors.gray('No unreleased changes.'));
66
149
  return;
@@ -72,5 +155,6 @@ export function initCli(repository, program) {
72
155
  console.log(entry.content);
73
156
  }
74
157
  },
75
- });
76
- }
158
+ };
159
+ });
160
+ export default changelogCommand;
@@ -1,3 +1,44 @@
1
- import type { Argv } from 'yargs';
2
- import type { Repository } from '../core/repository.js';
3
- export declare function initCli(repository: Repository, program: Argv): void;
1
+ import { type RmanConfig } from '../interfaces/rman-config.interface.js';
2
+ declare const COMMAND: "config";
3
+ declare const config: {
4
+ json: {
5
+ target: "cli";
6
+ describe: string;
7
+ type: "boolean";
8
+ default: boolean;
9
+ };
10
+ fromRoot: {
11
+ target: "cli";
12
+ cliName: string;
13
+ alias: string;
14
+ describe: string;
15
+ type: "boolean";
16
+ };
17
+ };
18
+ type Args = RmanConfig.ArgsOf<typeof config, typeof COMMAND>;
19
+ /** Prints config; declares none of its own, so it contributes nothing to `RmanConfig`. */
20
+ declare const configCommand: (app: import("../index.js").RmanApplication) => {
21
+ command: "config";
22
+ describe: string;
23
+ config: {
24
+ json: {
25
+ target: "cli";
26
+ describe: string;
27
+ type: "boolean";
28
+ default: boolean;
29
+ };
30
+ fromRoot: {
31
+ target: "cli";
32
+ cliName: string;
33
+ alias: string;
34
+ describe: string;
35
+ type: "boolean";
36
+ };
37
+ };
38
+ examples: {
39
+ command: string;
40
+ description: string;
41
+ }[];
42
+ handler: (args: Args) => void;
43
+ };
44
+ export default configCommand;