rman 2.0.0-beta.2 → 2.0.0-beta.4
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 +2 -12
- package/{plugins/node/augmentation/rman.augmentation.d.ts → builtins/platforms/node/augmentation/rmanrc.augmentation.d.ts} +4 -5
- package/{plugins → builtins/platforms}/node/augmentation/system-info.augmentation.js +1 -1
- package/{plugins → builtins/platforms}/node/commands/ci.command.d.ts +5 -3
- package/{plugins → builtins/platforms}/node/commands/ci.command.js +6 -5
- package/{plugins → builtins/platforms}/node/commands/clean.command.d.ts +6 -4
- package/{plugins → builtins/platforms}/node/commands/clean.command.js +6 -5
- package/builtins/platforms/node/index.d.ts +8 -0
- package/builtins/platforms/node/index.js +8 -0
- package/{plugins → builtins/platforms}/node/node-config.interface.d.ts +1 -2
- package/{plugins → builtins/platforms}/node/node-manifest.provider.d.ts +3 -3
- package/{plugins → builtins/platforms}/node/node-manifest.provider.js +3 -3
- package/{plugins → builtins/platforms}/node/node.platform.d.ts +3 -3
- package/{plugins → builtins/platforms}/node/services/ci.service.d.ts +3 -3
- package/{plugins → builtins/platforms}/node/services/ci.service.js +4 -4
- package/{plugins → builtins/platforms}/node/services/clean.service.d.ts +3 -3
- package/{plugins → builtins/platforms}/node/services/clean.service.js +3 -3
- package/{plugins → builtins/platforms}/node/services/publish.service.d.ts +4 -4
- package/{plugins → builtins/platforms}/node/services/publish.service.js +13 -7
- package/{plugins → builtins/platforms}/node/services/version-plan.service.d.ts +3 -3
- package/{plugins → builtins/platforms}/node/services/version-plan.service.js +2 -2
- package/builtins/presets/index.d.ts +15 -0
- package/builtins/presets/index.js +57 -0
- package/builtins/presets/node.d.ts +16 -0
- package/builtins/presets/node.js +57 -0
- package/{services → builtins/publish-targets/docker}/docker-publish.service.d.ts +6 -6
- package/{services → builtins/publish-targets/docker}/docker-publish.service.js +9 -9
- package/{targets → builtins/publish-targets/docker}/docker.target.d.ts +6 -5
- package/{targets → builtins/publish-targets/docker}/docker.target.js +1 -1
- package/builtins/publish-targets/docker/index.d.ts +2 -0
- package/builtins/publish-targets/docker/index.js +2 -0
- package/builtins/publish-targets/npm/index.d.ts +2 -0
- package/builtins/publish-targets/npm/index.js +2 -0
- package/{plugins/node → builtins/publish-targets/npm}/npm-publish-target.d.ts +4 -4
- package/{plugins/node → builtins/publish-targets/npm}/npm-publish-target.js +4 -5
- package/cli.d.ts +3 -0
- package/cli.js +16 -7
- package/commands/changelog.command.d.ts +106 -2
- package/commands/changelog.command.js +40 -0
- package/commands/config.command.js +23 -5
- package/commands/list.command.js +1 -1
- package/commands/publish.command.d.ts +1 -1
- package/commands/publish.command.js +1 -1
- package/commands/run.command.js +1 -1
- package/commands/version.command.d.ts +16 -3
- package/commands/version.command.js +143 -9
- package/commands.d.ts +0 -1
- package/commands.js +0 -1
- package/constants.js +1 -1
- package/core/application.d.ts +10 -10
- package/core/application.js +28 -11
- package/core/{package.d.ts → classes/package.d.ts} +12 -4
- package/core/{package.js → classes/package.js} +17 -1
- package/core/{repository.d.ts → classes/repository.d.ts} +22 -36
- package/core/{repository.js → classes/repository.js} +112 -241
- package/core/{service.d.ts → classes/service.d.ts} +2 -2
- package/core/classes/workspace.d.ts +277 -0
- package/core/classes/workspace.js +585 -0
- package/core/command-builder.js +17 -1
- package/core/config/config-file-scope.d.ts +107 -0
- package/core/config/config-file-scope.js +226 -0
- package/core/config/config-interpolator.d.ts +164 -0
- package/core/config/config-interpolator.js +577 -0
- package/core/config/config-paths.d.ts +65 -0
- package/core/config/config-paths.js +78 -0
- package/core/config/config-reader.d.ts +215 -0
- package/core/config/config-reader.js +851 -0
- package/core/{merge-config.js → config/merge-config.js} +4 -8
- package/core/{custom-command.d.ts → interfaces/custom-command.d.ts} +5 -5
- package/core/{manifest.d.ts → interfaces/manifest.d.ts} +3 -3
- package/core/{manifest.js → interfaces/manifest.js} +2 -2
- package/core/{plugin.d.ts → interfaces/plugin.d.ts} +44 -27
- package/core/{plugin.js → interfaces/plugin.js} +48 -10
- package/core/{publish-target.d.ts → interfaces/publish-target.d.ts} +24 -12
- package/core/{publish-target.js → interfaces/publish-target.js} +16 -3
- package/core/{run-step.d.ts → interfaces/run-step.d.ts} +4 -4
- package/core/plugin-loader.d.ts +11 -51
- package/core/plugin-loader.js +21 -202
- package/index.d.ts +29 -28
- package/index.js +20 -46
- package/interfaces/config-scope.interface.d.ts +223 -0
- package/interfaces/config-scope.interface.js +1 -0
- package/interfaces/rman-config.interface.d.ts +100 -5
- package/interfaces/rman-config.interface.js +17 -0
- package/package.json +3 -2
- package/services/change-hash.service.d.ts +40 -6
- package/services/change-hash.service.js +90 -11
- package/services/changelog.service.d.ts +31 -3
- package/services/changelog.service.js +448 -65
- package/services/config-service.d.ts +8 -0
- package/services/config-service.js +3 -0
- package/services/exec.service.d.ts +2 -2
- package/services/exec.service.js +1 -1
- package/services/github-release.service.d.ts +3 -3
- package/services/github-release.service.js +3 -3
- package/services/import.service.d.ts +2 -2
- package/services/import.service.js +1 -1
- package/services/list.service.d.ts +9 -7
- package/services/list.service.js +2 -2
- package/services/run.service.d.ts +15 -11
- package/services/run.service.js +62 -18
- package/services/system-info.d.ts +1 -1
- package/services/version-plan.service.d.ts +8 -4
- package/services/version-plan.service.js +54 -21
- package/services/version.service.d.ts +5 -5
- package/services/version.service.js +7 -4
- package/services.d.ts +1 -1
- package/services.js +1 -1
- package/utils/branch-guard.d.ts +1 -1
- package/utils/color-yaml.d.ts +8 -0
- package/utils/color-yaml.js +86 -0
- package/utils/git.d.ts +26 -0
- package/utils/git.js +65 -0
- package/utils/logger.d.ts +1 -1
- package/utils/package-filter.d.ts +8 -1
- package/utils/package-filter.js +7 -0
- package/utils/printable-config.d.ts +8 -0
- package/utils/printable-config.js +45 -0
- package/utils/progress-panel.d.ts +9 -0
- package/utils/progress-panel.js +23 -1
- package/utils/release-version.d.ts +1 -1
- package/utils/run-options.js +1 -1
- package/utils/version-group.d.ts +31 -0
- package/utils/version-group.js +43 -0
- package/commands/changed.command.d.ts +0 -80
- package/commands/changed.command.js +0 -36
- package/core/config.d.ts +0 -530
- package/core/config.js +0 -1123
- package/core/core-services.d.ts +0 -14
- package/core/core-services.js +0 -30
- package/core/core-targets.d.ts +0 -14
- package/core/core-targets.js +0 -16
- package/core/extends-config.d.ts +0 -35
- package/core/extends-config.js +0 -129
- package/core/load-config-module.d.ts +0 -28
- package/core/load-config-module.js +0 -42
- package/core/workspace.d.ts +0 -119
- package/core/workspace.js +0 -124
- package/plugins/builtins.d.ts +0 -44
- package/plugins/builtins.js +0 -33
- package/plugins/detect.d.ts +0 -78
- package/plugins/detect.js +0 -70
- package/plugins/node/index.d.ts +0 -29
- package/plugins/node/index.js +0 -40
- /package/{core/run-step.js → builtins/platforms/node/augmentation/rmanrc.augmentation.js} +0 -0
- /package/{plugins → builtins/platforms}/node/augmentation/system-info.augmentation.d.ts +0 -0
- /package/{plugins → builtins/platforms}/node/node-config.interface.js +0 -0
- /package/{plugins → builtins/platforms}/node/node.platform.js +0 -0
- /package/{plugins → builtins/platforms}/node/utils/workspace-range.d.ts +0 -0
- /package/{plugins → builtins/platforms}/node/utils/workspace-range.js +0 -0
- /package/{plugins/node/utils → builtins/publish-targets/npm}/npm-view.d.ts +0 -0
- /package/{plugins/node/utils → builtins/publish-targets/npm}/npm-view.js +0 -0
- /package/core/{registry.d.ts → classes/registry.d.ts} +0 -0
- /package/core/{registry.js → classes/registry.js} +0 -0
- /package/core/{service.js → classes/service.js} +0 -0
- /package/core/{version-scheme.d.ts → classes/version-scheme.d.ts} +0 -0
- /package/core/{version-scheme.js → classes/version-scheme.js} +0 -0
- /package/core/{merge-config.d.ts → config/merge-config.d.ts} +0 -0
- /package/core/{resolve-target.d.ts → config/resolve-config-target.d.ts} +0 -0
- /package/core/{resolve-target.js → config/resolve-config-target.js} +0 -0
- /package/core/{custom-command.js → interfaces/custom-command.js} +0 -0
- /package/{plugins/node/augmentation/rman.augmentation.js → core/interfaces/run-step.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { ScopedVars } from '../interfaces/rman-config.interface.js';
|
|
1
|
+
import type { PublishTarget } from '../../../core/interfaces/publish-target.js';
|
|
2
|
+
import type { ConfigValue, ScopedVars } from '../../../interfaces/rman-config.interface.js';
|
|
4
3
|
/**
|
|
5
4
|
* **`publish.docker.*`** - this target's own config block, declared here rather than centrally.
|
|
6
5
|
*
|
|
@@ -23,8 +22,10 @@ export interface DockerPublishOptionsKeys {
|
|
|
23
22
|
image: ConfigValue<string>;
|
|
24
23
|
/** Relative to the package's own directory. Default `"Dockerfile"`. */
|
|
25
24
|
dockerfile?: ConfigValue<string>;
|
|
26
|
-
/**
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The architectures to build for - `docker buildx build --platform`. Default `["linux/amd64"]`.
|
|
27
|
+
*/
|
|
28
|
+
architectures?: ConfigValue<string[]>;
|
|
28
29
|
/** Build `cwd` override, relative to the repository root - only needed when the Dockerfile's
|
|
29
30
|
* own `COPY`/`ADD` paths expect something other than the package's own directory (rare). */
|
|
30
31
|
cwd?: ConfigValue<string>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import { PublishService } from './services/publish.service.js';
|
|
1
|
+
import type { PublishTarget } from '../../../core/interfaces/publish-target.js';
|
|
2
|
+
import { PublishService } from '../../platforms/node/services/publish.service.js';
|
|
4
3
|
/** The name this target answers to in `publish.target` and `--target`. */
|
|
5
4
|
export declare const NPM_TARGET = "npm";
|
|
6
5
|
/**
|
|
@@ -26,7 +25,8 @@ export declare const NPM_TARGET = "npm";
|
|
|
26
25
|
export declare class NpmPublishTarget implements PublishTarget {
|
|
27
26
|
name: string;
|
|
28
27
|
describe: string;
|
|
29
|
-
|
|
28
|
+
/** npm's alone: a package rman read through the `node` platform. */
|
|
29
|
+
platforms: string[];
|
|
30
30
|
options: {
|
|
31
31
|
packageManager: {
|
|
32
32
|
target: "cli";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CiService } from '
|
|
2
|
-
import { PublishService } from '
|
|
1
|
+
import { CiService } from '../../platforms/node/services/ci.service.js';
|
|
2
|
+
import { PublishService } from '../../platforms/node/services/publish.service.js';
|
|
3
3
|
/** The name this target answers to in `publish.target` and `--target`. */
|
|
4
4
|
export const NPM_TARGET = 'npm';
|
|
5
5
|
/**
|
|
@@ -25,9 +25,8 @@ export const NPM_TARGET = 'npm';
|
|
|
25
25
|
export class NpmPublishTarget {
|
|
26
26
|
name = NPM_TARGET;
|
|
27
27
|
describe = 'Publish to an npm registry (npm/yarn/pnpm/bun publish)';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
/** npm's alone: a package rman read through the `node` platform. */
|
|
29
|
+
platforms = ['node'];
|
|
31
30
|
options = {
|
|
32
31
|
packageManager: {
|
|
33
32
|
target: 'cli',
|
package/cli.d.ts
CHANGED
|
@@ -7,4 +7,7 @@ export declare function runCli(options?: {
|
|
|
7
7
|
argv?: string[];
|
|
8
8
|
cwd?: string;
|
|
9
9
|
app?: RmanApplication;
|
|
10
|
+
/** Forwarded to {@link Repository.create} - see its `presets`. `[]` is a caller with an
|
|
11
|
+
* ecosystem of its own, which is what the core's own fixture is. */
|
|
12
|
+
presets?: readonly string[];
|
|
10
13
|
}): Promise<void>;
|
package/cli.js
CHANGED
|
@@ -11,14 +11,15 @@ import yargs, {} from 'yargs';
|
|
|
11
11
|
import { hideBin } from 'yargs/helpers';
|
|
12
12
|
import { version } from './constants.js';
|
|
13
13
|
import { RmanApplication } from './core/application.js';
|
|
14
|
+
import { Repository } from './core/classes/repository.js';
|
|
14
15
|
import { commandName, toYargsCommand } from './core/command-builder.js';
|
|
15
|
-
import { assertNoBuiltinShadowing, defaultCommandGlobs, loadCustomCommands, } from './core/custom-command.js';
|
|
16
|
+
import { assertNoBuiltinShadowing, defaultCommandGlobs, loadCustomCommands, } from './core/interfaces/custom-command.js';
|
|
16
17
|
import { checkCustomCommand } from './core/plugin-loader.js';
|
|
17
|
-
import { Repository } from './core/repository.js';
|
|
18
18
|
import { commandRegistry } from './interfaces/rman-config.interface.js';
|
|
19
|
+
import { colorYaml } from './utils/color-yaml.js';
|
|
19
20
|
import { LOG_LEVELS, Logger, resolveRootLogLevel } from './utils/logger.js';
|
|
20
21
|
import { filterPackages, readFromRootOption, readPackageFilterOptions } from './utils/package-filter.js';
|
|
21
|
-
import { printableConfig } from './utils/printable-config.js';
|
|
22
|
+
import { printableConfig, withoutContributions } from './utils/printable-config.js';
|
|
22
23
|
import { runBin } from './utils/run-bin.js';
|
|
23
24
|
export async function runCli(options) {
|
|
24
25
|
const _argv = options?.argv || hideBin(process.argv);
|
|
@@ -38,7 +39,7 @@ export async function runCli(options) {
|
|
|
38
39
|
/** One application per run, made here so `--log-level` reaches its logger, and handed to
|
|
39
40
|
* `Repository.create` rather than found through a global. */
|
|
40
41
|
const app = options?.app ?? new RmanApplication();
|
|
41
|
-
const repository = await Repository.create(options?.cwd, { app });
|
|
42
|
+
const repository = await Repository.create(options?.cwd, { app, presets: options?.presets });
|
|
42
43
|
const program = yargs(_argv)
|
|
43
44
|
.scriptName('rman')
|
|
44
45
|
.version(version)
|
|
@@ -338,9 +339,17 @@ function printCommandConfig(repository, spec, args) {
|
|
|
338
339
|
if (!shown.some(p => p === repository.rootPackage))
|
|
339
340
|
shown.push(repository.rootPackage);
|
|
340
341
|
const config = {};
|
|
341
|
-
for
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
/** `withoutContributions` for the same reason `rman config` uses it: `plugins`, `platforms`,
|
|
343
|
+
* `commands` and `publishTargets` are code, and a command's config section is about settings.
|
|
344
|
+
* Only the "in full" branch needs it - `pick` already narrows to the keys the command reads. */
|
|
345
|
+
for (const pkg of shown) {
|
|
346
|
+
config[pkg.name] = keys?.length ? pick(pkg.config, keys) : withoutContributions(pkg.config);
|
|
347
|
+
}
|
|
348
|
+
/** Coloured after indenting, not before: `indent` prefixes each line, and an escape sequence
|
|
349
|
+
* already sitting at the start of one is what it would be measuring. Gated on a terminal for the
|
|
350
|
+
* reason `rman config` documents - the section is YAML and has to survive being redirected. */
|
|
351
|
+
const body = indent(yaml.dump(printableConfig(config), { noRefs: true, lineWidth: 100 }).trimEnd());
|
|
352
|
+
console.log(process.stdout.isTTY ? colorYaml(body) : body);
|
|
344
353
|
if (!targets.includes(repository.rootPackage)) {
|
|
345
354
|
console.log(comment(`# "${repository.rootPackage.name}" is the root - listed because repo-wide keys are read there.`));
|
|
346
355
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConfigValue, RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
2
2
|
declare const COMMAND: "changelog";
|
|
3
3
|
declare const config: {
|
|
4
4
|
from: {
|
|
@@ -52,6 +52,41 @@ declare const config: {
|
|
|
52
52
|
describe: string;
|
|
53
53
|
type: "string";
|
|
54
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
|
+
};
|
|
55
90
|
fromRoot: {
|
|
56
91
|
target: "cli";
|
|
57
92
|
cliName: string;
|
|
@@ -85,6 +120,40 @@ declare const config: {
|
|
|
85
120
|
type: "boolean";
|
|
86
121
|
};
|
|
87
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
|
+
}
|
|
88
157
|
type Args = RmanConfig.ArgsOf<typeof config, typeof COMMAND>;
|
|
89
158
|
declare const changelogCommand: (app: import("../index.js").RmanApplication) => {
|
|
90
159
|
command: "changelog";
|
|
@@ -144,6 +213,41 @@ declare const changelogCommand: (app: import("../index.js").RmanApplication) =>
|
|
|
144
213
|
describe: string;
|
|
145
214
|
type: "string";
|
|
146
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
|
+
};
|
|
147
251
|
fromRoot: {
|
|
148
252
|
target: "cli";
|
|
149
253
|
cliName: string;
|
|
@@ -186,7 +290,7 @@ declare const changelogCommand: (app: import("../index.js").RmanApplication) =>
|
|
|
186
290
|
export default changelogCommand;
|
|
187
291
|
declare module '../interfaces/rman-config.interface.js' {
|
|
188
292
|
namespace RmanConfig {
|
|
189
|
-
interface CommandConfigs extends RmanConfig.CommandContribution<ReturnType<typeof changelogCommand
|
|
293
|
+
interface CommandConfigs extends RmanConfig.CommandContribution<ReturnType<typeof changelogCommand>, ChangelogExtraKeys> {
|
|
190
294
|
}
|
|
191
295
|
}
|
|
192
296
|
}
|
|
@@ -69,6 +69,44 @@ const config = {
|
|
|
69
69
|
'Default "v*", one repo-wide tag resolved through git describe.',
|
|
70
70
|
type: 'string',
|
|
71
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
|
+
},
|
|
72
110
|
};
|
|
73
111
|
const changelogCommand = registerCommand(app => {
|
|
74
112
|
const repository = app.repository;
|
|
@@ -101,6 +139,8 @@ const changelogCommand = registerCommand(app => {
|
|
|
101
139
|
fromRoot: args.fromRoot,
|
|
102
140
|
includeSkipped: args.includeSkipped,
|
|
103
141
|
version: args.releaseVersion,
|
|
142
|
+
startingAt: args.startingAt,
|
|
143
|
+
unreleased: args.unreleased,
|
|
104
144
|
};
|
|
105
145
|
const changelog = app.getService('changelog');
|
|
106
146
|
const entries = write ? await changelog.generateToFile(options) : await changelog.getEntries(options);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import colors from 'ansi-colors';
|
|
3
3
|
import * as yaml from 'js-yaml';
|
|
4
|
-
import { DEFERRED_PATHS } from '../core/config.js';
|
|
4
|
+
import { DEFERRED_PATHS } from '../core/config/config-paths.js';
|
|
5
|
+
import { ConfigReader } from '../core/config/config-reader.js';
|
|
5
6
|
import { registerCommand } from '../interfaces/rman-config.interface.js';
|
|
7
|
+
import { colorYaml } from '../utils/color-yaml.js';
|
|
6
8
|
import { fromRootOption, readFromRootOption } from '../utils/package-filter.js';
|
|
7
|
-
import { printableConfig } from '../utils/printable-config.js';
|
|
9
|
+
import { printableConfig, withoutContributions } from '../utils/printable-config.js';
|
|
8
10
|
const COMMAND = 'config';
|
|
9
11
|
const config = {
|
|
10
12
|
...fromRootOption('Print the config for'),
|
|
@@ -29,8 +31,9 @@ const configCommand = registerCommand(app => {
|
|
|
29
31
|
],
|
|
30
32
|
handler: (args) => {
|
|
31
33
|
const target = (!readFromRootOption(args) && repository.currentPackage) || repository.rootPackage;
|
|
34
|
+
const settings = withoutContributions(target.config);
|
|
32
35
|
if (args.json) {
|
|
33
|
-
console.log(JSON.stringify(printableConfig(
|
|
36
|
+
console.log(JSON.stringify(printableConfig(settings), undefined, 2));
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
@@ -41,15 +44,30 @@ const configCommand = registerCommand(app => {
|
|
|
41
44
|
* itself off for a pipe here). The repository's own convention for this is
|
|
42
45
|
* `process.stdout.isTTY`, as `run`/`exec`'s progress panel uses.
|
|
43
46
|
*/
|
|
44
|
-
const
|
|
47
|
+
const tty = !!process.stdout.isTTY;
|
|
48
|
+
const comment = (text) => (tty ? colors.gray(text) : text);
|
|
45
49
|
const relativeDir = path.relative(repository.dirname, target.dirname) || '.';
|
|
50
|
+
/**
|
|
51
|
+
* **The file you would open to change this**, headed first because that is the next thing a
|
|
52
|
+
* reader wants. Omitted for a directory that declares none - naming a file that is not there
|
|
53
|
+
* would send them to create one when the answer is a level above.
|
|
54
|
+
*
|
|
55
|
+
* It is the package's **own** file and the printed config is more than it: the directory
|
|
56
|
+
* chain above, every `extends` base and each `"[selector]"` block are all in there. The
|
|
57
|
+
* per-key answer is `ORIGINS`, which is what a failing expression's message already names -
|
|
58
|
+
* this line is the starting point, not the whole provenance.
|
|
59
|
+
*/
|
|
60
|
+
const source = new ConfigReader().findConfigSource(target.dirname);
|
|
61
|
+
if (source)
|
|
62
|
+
console.log(comment(`# ${path.basename(source)}`));
|
|
46
63
|
console.log(comment(`# ${target.name} (${relativeDir})`));
|
|
47
64
|
for (const note of deferredNotes(target))
|
|
48
65
|
console.log(comment(`# ${note}`));
|
|
49
66
|
/** `noRefs`: a value appearing twice in the config is the *same object* after merging, and
|
|
50
67
|
* js-yaml would otherwise emit the second as an `*anchor` reference - valid YAML that reads
|
|
51
68
|
* as a mistake in something meant to be looked at. */
|
|
52
|
-
|
|
69
|
+
const body = yaml.dump(printableConfig(settings), { noRefs: true, lineWidth: 100 }).trimEnd();
|
|
70
|
+
console.log(tty ? colorYaml(body) : body);
|
|
53
71
|
},
|
|
54
72
|
};
|
|
55
73
|
});
|
package/commands/list.command.js
CHANGED
|
@@ -29,7 +29,7 @@ const config = {
|
|
|
29
29
|
changed: {
|
|
30
30
|
target: 'cli',
|
|
31
31
|
alias: 'c',
|
|
32
|
-
describe: 'Only list packages
|
|
32
|
+
describe: 'Only list packages you have touched but not pushed - uncommitted, or committed and not yet on the upstream branch. Not a release question; see "version --json" for that',
|
|
33
33
|
type: 'boolean',
|
|
34
34
|
},
|
|
35
35
|
changedSince: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { DockerPublishOptions } from '../builtins/publish-targets/docker/docker.target.js';
|
|
1
2
|
import type { RmanApplication } from '../core/application.js';
|
|
2
3
|
import { type RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
3
|
-
import type { DockerPublishOptions } from '../targets/docker.target.js';
|
|
4
4
|
/** Hoisted for `ArgsOf` - see `version.command.ts` and `RmanConfig.ArgsOf` for why. */
|
|
5
5
|
declare const COMMAND: "publish";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import readline from 'node:readline/promises';
|
|
2
2
|
import colors from 'ansi-colors';
|
|
3
|
-
import { unknownTargets } from '../core/publish-target.js';
|
|
3
|
+
import { unknownTargets } from '../core/interfaces/publish-target.js';
|
|
4
4
|
import { registerCommand } from '../interfaces/rman-config.interface.js';
|
|
5
5
|
import { assertAllowedBranch, branchGuardOptions, readBranchGuardOptions } from '../utils/branch-guard.js';
|
|
6
6
|
import { packageFilterOptions, readPackageFilterOptions } from '../utils/package-filter.js';
|
package/commands/run.command.js
CHANGED
|
@@ -20,7 +20,7 @@ const runCommand = registerCommand(app => {
|
|
|
20
20
|
},
|
|
21
21
|
examples: [
|
|
22
22
|
{ command: '$0 run build' },
|
|
23
|
-
{ command: '$0 run build --changed', description: '# Only in packages
|
|
23
|
+
{ command: '$0 run build --changed', description: '# Only in packages you have touched but not pushed' },
|
|
24
24
|
],
|
|
25
25
|
handler: async (args) => {
|
|
26
26
|
await assertAllowedBranch(repository, readBranchGuardOptions(args));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { type RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
1
|
+
import type { RunStepValue } from '../core/interfaces/run-step.js';
|
|
2
|
+
import type { ConfigValue, RmanConfig } from '../interfaces/rman-config.interface.js';
|
|
4
3
|
/**
|
|
5
4
|
* Hoisted out of the metadata literal so the handler can be annotated against them - see
|
|
6
5
|
* `RmanConfig.ArgsOf` for why an inferred `argv` and the metadata's own typo checking cannot both
|
|
@@ -30,6 +29,13 @@ declare const config: {
|
|
|
30
29
|
type: "boolean";
|
|
31
30
|
conflicts: string;
|
|
32
31
|
};
|
|
32
|
+
json: {
|
|
33
|
+
target: "cli";
|
|
34
|
+
alias: string;
|
|
35
|
+
describe: string;
|
|
36
|
+
type: "boolean";
|
|
37
|
+
conflicts: string[];
|
|
38
|
+
};
|
|
33
39
|
ignoreDirty: {
|
|
34
40
|
target: "cli";
|
|
35
41
|
cliName: string;
|
|
@@ -203,6 +209,13 @@ declare const versionCommand: (app: import("../index.js").RmanApplication) => {
|
|
|
203
209
|
type: "boolean";
|
|
204
210
|
conflicts: string;
|
|
205
211
|
};
|
|
212
|
+
json: {
|
|
213
|
+
target: "cli";
|
|
214
|
+
alias: string;
|
|
215
|
+
describe: string;
|
|
216
|
+
type: "boolean";
|
|
217
|
+
conflicts: string[];
|
|
218
|
+
};
|
|
206
219
|
ignoreDirty: {
|
|
207
220
|
target: "cli";
|
|
208
221
|
cliName: string;
|