rman 2.0.0-beta.2 → 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.
- 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 +5 -5
- 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/lint.command.d.ts +176 -0
- package/commands/lint.command.js +34 -0
- 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 +1 -1
- package/commands.js +1 -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 +275 -0
- package/core/classes/workspace.js +537 -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 +192 -0
- package/core/config/config-reader.js +727 -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 +2 -1
- 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
package/core/plugin-loader.js
CHANGED
|
@@ -1,102 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import fastGlob from 'fast-glob';
|
|
4
|
-
import { COMMANDS_KEY } from './merge-config.js';
|
|
5
|
-
import { isDeclared, isPlatform } from './plugin.js';
|
|
1
|
+
import { isPlatform } from './interfaces/plugin.js';
|
|
6
2
|
/** The `.rmanrc` key naming plugin packages to load. */
|
|
7
3
|
export const PLUGINS_KEY = 'plugins';
|
|
8
4
|
/**
|
|
9
|
-
*
|
|
5
|
+
* **Puts one contribution onto an application** - a technology, or a plugin - and the only place
|
|
6
|
+
* that knows how.
|
|
10
7
|
*
|
|
11
|
-
* **
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
8
|
+
* **Exported because a spec must not reimplement it.** A fixture writing the registrations out by
|
|
9
|
+
* hand is a second implementation that drifts, which is exactly how a fixture ends up proving the
|
|
10
|
+
* core works when it does not. A spec brings its own technology through this, the same door a
|
|
11
|
+
* config's does.
|
|
15
12
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `.rmanrc` is never seen, which has always been true and is now true for the same reason.
|
|
20
|
-
* - **`commands` is read at any level**, after the packages exist, which is why `cli.ts` owns it:
|
|
21
|
-
* it already holds the whole command pipeline - the `.rman/` default, de-duplication by name,
|
|
22
|
-
* and the built-in shadow check. Reading it here as well would register every config-declared
|
|
23
|
-
* command twice, and yargs does not survive that.
|
|
24
|
-
*
|
|
25
|
-
* **Order within this function is load-bearing**: plugins first, then targets. rman's own
|
|
26
|
-
* `publish` builds its `--target` choices from `app.publishTargets` when its factory runs, and a
|
|
27
|
-
* target contributed by a plugin's `init` has to be there before the list is read.
|
|
28
|
-
*
|
|
29
|
-
* **A contribution that cannot be loaded throws**, unlike a broken `.rman/*.mjs`, which is warned
|
|
30
|
-
* about and skipped. The consequence differs: a skipped local command affects only itself, while a
|
|
31
|
-
* missing plugin silently removes commands the repository is built around - `rman publish` would
|
|
32
|
-
* simply not exist, and "not a known command" sends the reader looking in the wrong place.
|
|
33
|
-
*/
|
|
34
|
-
export async function loadPlugins(app, rootConfig) {
|
|
35
|
-
const seen = new Set();
|
|
36
|
-
for (const { value, from } of await resolveEntries(rootConfig.plugins, PLUGINS_KEY)) {
|
|
37
|
-
const plugin = value;
|
|
38
|
-
if (!isPlainObject(plugin) || typeof plugin.name !== 'string' || !plugin.name) {
|
|
39
|
-
throw new Error(`"${PLUGINS_KEY}" takes a plugin or a glob naming modules that export one - ${from} gave ` +
|
|
40
|
-
`${describeExport(plugin)}. Every message about a plugin is keyed by its \`name\`.`);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* **Declared through `definePlatform`/`definePlugin`, and checked for it.**
|
|
44
|
-
*
|
|
45
|
-
* The guard used to be `manifestProvider` being required, which worked only while one type was
|
|
46
|
-
* both halves. A 2.x plugin that contributes nothing but an `init` is `{ name, init }` - and so
|
|
47
|
-
* was an rman **1.x plugin**, exactly. They are indistinguishable by shape, so a shape test
|
|
48
|
-
* cannot tell them apart and the declaration has to be explicit.
|
|
49
|
-
*
|
|
50
|
-
* Measured on the real case before there was any guard: `@panates/rman-node`'s 1.x plugin
|
|
51
|
-
* loaded, registered, and died inside its own `init` with
|
|
52
|
-
* `TypeError: ctx.addCommand is not a function`, fifteen times over, naming neither the plugin
|
|
53
|
-
* nor the version it was written against.
|
|
54
|
-
*/
|
|
55
|
-
if (!isDeclared(plugin)) {
|
|
56
|
-
throw new Error(`Plugin "${plugin.name}" (${from}) was not declared with definePlatform() or ` +
|
|
57
|
-
`definePlugin(). A plain object is how an rman 1.x plugin looks, and a 1.x plugin has ` +
|
|
58
|
-
`nothing left to do: commands, publish targets and other plugins are "${COMMANDS_KEY}", ` +
|
|
59
|
-
`"publishTargets" and "${PLUGINS_KEY}" keys of a config now. Wrap a technology in ` +
|
|
60
|
-
`definePlatform({ name, manifestProvider, ... }), anything else in definePlugin({ ... }).`);
|
|
61
|
-
}
|
|
62
|
-
/** One registration per name. Twice would define the same commands twice, which yargs does not
|
|
63
|
-
* survive - and two layers naming one plugin is ordinary rather than a mistake. */
|
|
64
|
-
if (seen.has(plugin.name))
|
|
65
|
-
continue;
|
|
66
|
-
seen.add(plugin.name);
|
|
67
|
-
await registerPlugin(app, plugin).init?.({ app });
|
|
68
|
-
}
|
|
69
|
-
for (const { value, from } of await resolveEntries(rootConfig.publishTargets, 'publishTargets')) {
|
|
70
|
-
const target = value;
|
|
71
|
-
if (!isPlainObject(value) || typeof target.name !== 'string' || !target.name) {
|
|
72
|
-
throw new Error(`"publishTargets" takes a target or a glob naming modules that export one - ${from} gave ` +
|
|
73
|
-
`${describeExport(target)}.`);
|
|
74
|
-
}
|
|
75
|
-
app.publishTargets.add(target);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* **Puts one plugin onto an application** - what `plugins` does with an entry once it has been
|
|
80
|
-
* found and vetted, and the only place that knows how.
|
|
81
|
-
*
|
|
82
|
-
* **A bare `Platform` is sugar**, which is what almost every entry is - a plugin that provides one
|
|
83
|
-
* technology and nothing else. Normalized here, so nothing downstream deals in two shapes.
|
|
84
|
-
*
|
|
85
|
-
* **Exported because a spec must not reimplement it.** The registration is two registries plus a
|
|
86
|
-
* planner assignment, and a fixture writing that out by hand is a second implementation that
|
|
87
|
-
* drifts - which is exactly how a fixture ends up proving the core works when it does not. A spec
|
|
88
|
-
* brings its own technology through this, the same door a config's does.
|
|
89
|
-
*
|
|
90
|
-
* **`init` is not called here, and that is why this returns the normalized plugin.** An `init` runs
|
|
91
|
-
* once, when a *config* brought the plugin in, and it may be asynchronous - so it belongs to the
|
|
92
|
-
* loader above rather than to a function a fixture calls synchronously while building an
|
|
93
|
-
* application.
|
|
13
|
+
* **Neither hook is called here, and that is deliberate.** `afterInitApplication` and
|
|
14
|
+
* `afterInitRepository` belong to `Repository.create`, which knows when each stage is reached and
|
|
15
|
+
* can await them; this is a synchronous call a fixture makes while building an application.
|
|
94
16
|
*/
|
|
17
|
+
/* **Two registries and no normalization, which is what the split bought.** A bare `Platform` used
|
|
18
|
+
* to be wrapped in `{ name, platforms: [entry] }` so that everything downstream dealt in one shape
|
|
19
|
+
* - and that shape was `Plugin.platforms`, which is gone: `platforms` is a config key now, so a
|
|
20
|
+
* package shipping a technology declares it there and nothing has to invent a plugin around it.
|
|
21
|
+
* What is left is a question with two honest answers, asked once. */
|
|
95
22
|
export function registerPlugin(app, entry) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
for (const platform of declared.platforms ?? []) {
|
|
99
|
-
app.platforms.add(platform);
|
|
23
|
+
if (isPlatform(entry)) {
|
|
24
|
+
app.platforms.add(entry);
|
|
100
25
|
/**
|
|
101
26
|
* **The orchestrator, and only that.** A plan is computed for the whole repository at once -
|
|
102
27
|
* groups span packages, the ripple crosses them - so one planner drives the traversal and the
|
|
@@ -106,118 +31,12 @@ export function registerPlugin(app, entry) {
|
|
|
106
31
|
* and `cascade` are asked of `pkg.platform.versionPlanner` per package, which is why a platform
|
|
107
32
|
* still declares one even when it is not the last to register.
|
|
108
33
|
*/
|
|
109
|
-
if (
|
|
110
|
-
app.versionPlanner =
|
|
34
|
+
if (entry.versionPlanner)
|
|
35
|
+
app.versionPlanner = entry.versionPlanner;
|
|
36
|
+
return;
|
|
111
37
|
}
|
|
112
|
-
|
|
38
|
+
app.plugins.add(entry);
|
|
113
39
|
}
|
|
114
|
-
/**
|
|
115
|
-
* The shared half of the three keys: an instance is itself, a string is a glob whose matches are
|
|
116
|
-
* imported and unwrapped.
|
|
117
|
-
*
|
|
118
|
-
* **A glob is already absolute** by the time it gets here - `mergeConfig` anchors it to the file
|
|
119
|
-
* that declared it as the config is read, which is the last moment that is knowable (see
|
|
120
|
-
* `anchorContributions`). Nothing here resolves a path.
|
|
121
|
-
*
|
|
122
|
-
* **`.js` only.** rman imports these in its own process with no loader registered, so a `.ts`
|
|
123
|
-
* module cannot be one; a TypeScript repository compiles first or writes `.mjs`. Stated rather
|
|
124
|
-
* than attempted, because a `.ts` that happens to load under a test runner's loader and not under
|
|
125
|
-
* the CLI is the worst of both.
|
|
126
|
-
*/
|
|
127
|
-
async function resolveEntries(declared, key) {
|
|
128
|
-
if (declared === undefined)
|
|
129
|
-
return [];
|
|
130
|
-
const out = [];
|
|
131
|
-
for (const entry of (Array.isArray(declared) ? declared : [declared])) {
|
|
132
|
-
if (typeof entry !== 'string') {
|
|
133
|
-
out.push({ value: entry, from: `"${key}"` });
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
if (!entry.trim())
|
|
137
|
-
throw new Error(`"${key}" has an empty glob.`);
|
|
138
|
-
const files = await fastGlob(entry.split(path.sep).join('/'), { absolute: true, onlyFiles: true });
|
|
139
|
-
/**
|
|
140
|
-
* **A glob matching nothing is an error here**, unlike in `commands`, and the asymmetry is the
|
|
141
|
-
* point. Losing a plugin silently removes commands and seams the repository is built around -
|
|
142
|
-
* `rman publish` would simply not exist, and "not a known command" sends the reader looking in
|
|
143
|
-
* the wrong place. `commands` can match nothing legitimately: `.rman/*.js` is its default, and
|
|
144
|
-
* most repositories have no such directory.
|
|
145
|
-
*/
|
|
146
|
-
if (!files.length) {
|
|
147
|
-
/**
|
|
148
|
-
* **A package name gets the answer it is actually asking for.** A bare `rman-node` here is a
|
|
149
|
-
* glob that matches nothing, and "matched no file" sends the reader to check their paths -
|
|
150
|
-
* when what they wrote is a *package*, whose config reaches a repository through `extends`.
|
|
151
|
-
* Two documents promised this message named the fix (`docs/rman.md`, `docs/cli-rman.md`) and
|
|
152
|
-
* it did not; measured, `plugins: ['rman-node']` exited 1 saying only that a glob matched
|
|
153
|
-
* nothing.
|
|
154
|
-
*
|
|
155
|
-
* Reaching this intact takes `mergeConfig`'s help: it anchors a contribution glob to the file
|
|
156
|
-
* that declared it, which used to turn `rman-node` into `<dir>/rman-node` and erase the
|
|
157
|
-
* evidence. `looksLikePackageName` there leaves this shape alone; the same predicate is
|
|
158
|
-
* spelled again here rather than shared, because the two modules answer different questions
|
|
159
|
-
* with it and a merge concern importing a loader concern (or the reverse) is the coupling
|
|
160
|
-
* neither wants.
|
|
161
|
-
*/
|
|
162
|
-
const isPackageName = /^(?:@[a-z0-9-~][\w.-]*\/)?[a-z0-9-~][\w.-]*$/i.test(entry) && !/\.[cm]?js$/i.test(entry);
|
|
163
|
-
if (isPackageName) {
|
|
164
|
-
throw new Error(`"${key}" entry "${entry}" looks like a package name, and this key does not take one - ` +
|
|
165
|
-
`it takes a plugin, or a glob naming modules that export one. A plugin package exports ` +
|
|
166
|
-
`an rman config, so write \`extends: "${entry}"\` instead, which merges everything that ` +
|
|
167
|
-
`package declares underneath your own config.`);
|
|
168
|
-
}
|
|
169
|
-
throw new Error(`"${key}" glob "${entry}" matched no file. A plugin that does not load is not a plugin.`);
|
|
170
|
-
}
|
|
171
|
-
for (const file of [...new Set(files.map(f => path.resolve(f)))].sort()) {
|
|
172
|
-
const mod = await import(pathToFileURL(file).href);
|
|
173
|
-
const exported = mod?.default;
|
|
174
|
-
if (exported === undefined) {
|
|
175
|
-
throw new Error(`"${key}" matched "${file}", which has no default export. ${describeExport(mod)}`);
|
|
176
|
-
}
|
|
177
|
-
out.push({ value: exported, from: file });
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return out;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* The second half of the error above - what the module *did* export, so the author can see how far
|
|
184
|
-
* off it was.
|
|
185
|
-
*
|
|
186
|
-
* It recognizes a plugin object only to **say so in a message**. That is the one safe use for this
|
|
187
|
-
* shape test: it decides nothing, so a wrong guess costs a slightly less helpful sentence rather
|
|
188
|
-
* than a plugin that silently does not load.
|
|
189
|
-
*/
|
|
190
|
-
function describeExport(exported) {
|
|
191
|
-
if (exported === undefined)
|
|
192
|
-
return 'It has no default export.';
|
|
193
|
-
if (!isPlainObject(exported))
|
|
194
|
-
return `Its default export is a ${typeof exported}.`;
|
|
195
|
-
const looksLikePlugin = PLUGIN_SEAMS.some(seam => exported[seam] !== undefined);
|
|
196
|
-
return looksLikePlugin
|
|
197
|
-
? `Its default export looks like the plugin itself - put it in a config's "${PLUGINS_KEY}".`
|
|
198
|
-
: `Its default export has no "${PLUGINS_KEY}".`;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* The members only a plugin has, for that sentence alone.
|
|
202
|
-
*
|
|
203
|
-
* **`name` is deliberately not one of them**, and it used to be: a config may carry a `name` too,
|
|
204
|
-
* so anything with one "looked like a plugin" - which sent the author of a perfectly ordinary
|
|
205
|
-
* config to go and wrap it in `plugins`. Each of these belongs to a technology and to nothing
|
|
206
|
-
* else, `manifestProvider` first because it is the one a plugin cannot be without.
|
|
207
|
-
*/
|
|
208
|
-
const PLUGIN_SEAMS = ['manifestProvider', 'getWorkspace', 'getBinPaths', 'getRunSteps', 'versionPlanner'];
|
|
209
|
-
/** A config object, as opposed to an array or anything with its own prototype. */
|
|
210
|
-
function isPlainObject(value) {
|
|
211
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* A plugin's `CustomCommand`, checked the same way a `.rman/*.mjs` one is - the name it answers to
|
|
215
|
-
* comes from its own `command` string, since a plugin has no file name to fall back on.
|
|
216
|
-
*
|
|
217
|
-
* Exported because `cli.ts` runs the identical checks on what a *declarative* command's factory
|
|
218
|
-
* returns, and they must not drift: a plugin written in JavaScript reaches both forms with no type
|
|
219
|
-
* checker in the way.
|
|
220
|
-
*/
|
|
221
40
|
export function checkCustomCommand(command, pluginName) {
|
|
222
41
|
const declared = command?.command?.trim();
|
|
223
42
|
if (!declared) {
|
package/index.d.ts
CHANGED
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
* Type-only, so the emitted module is empty - imported for what it declares, not for what it does.
|
|
30
30
|
* Pinned in `docs-api.spec.ts`, which imports only from this file.
|
|
31
31
|
*/
|
|
32
|
-
import './
|
|
32
|
+
import './builtins/platforms/node/augmentation/rmanrc.augmentation.js';
|
|
33
33
|
import type { RmanConfig as CommandDeclaration } from './interfaces/rman-config.interface.js';
|
|
34
|
-
export { defineConfig } from './
|
|
34
|
+
export { defineConfig } from './interfaces/rman-config.interface.js';
|
|
35
35
|
/**
|
|
36
36
|
* **A config value written as a function**, and the scope it is handed. Exported because a config
|
|
37
37
|
* author could not name either: `interpolateConfig` calls a function wherever a `${{ }}` could
|
|
@@ -42,25 +42,26 @@ export { defineConfig } from './core/config.js';
|
|
|
42
42
|
* `value`, i.e. what an expression sees. Not to be confused with `RunStepContext`, which is what a
|
|
43
43
|
* step gets, later, with a working directory and a `runBin`.
|
|
44
44
|
*/
|
|
45
|
-
export type {
|
|
46
|
-
export
|
|
47
|
-
export {
|
|
45
|
+
export type { CommandContext, CustomCommand } from './core/interfaces/custom-command.js';
|
|
46
|
+
export { defineCommand } from './core/interfaces/custom-command.js';
|
|
47
|
+
export type { ConfigScope, ConfigValueContext, FileScope, PackageScope } from './interfaces/config-scope.interface.js';
|
|
48
|
+
export type { ConfigValue, Resolved, ResolvedConfig } from './interfaces/rman-config.interface.js';
|
|
48
49
|
/** Both the shape and the registry: `const m: Manifest` and `Manifest.read(dir)` - merged onto one
|
|
49
50
|
* name so a plugin can augment it the way it augments `SystemInfo`. */
|
|
50
51
|
export { RmanApplication } from './core/application.js';
|
|
51
52
|
/** The manifest seam, grouped on a plugin as `Plugin.manifestProvider`: where a package's name and
|
|
52
53
|
* version are written, what it declares, and how it is numbered and stamped. The core has none -
|
|
53
54
|
* `package.json` is npm's answer, and belongs to the `node` built-in. */
|
|
54
|
-
export
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
55
|
+
export { Package } from './core/classes/package.js';
|
|
56
|
+
export type { ManifestProvider } from './core/interfaces/manifest.js';
|
|
57
|
+
export { Manifest } from './core/interfaces/manifest.js';
|
|
57
58
|
/** The publish seam: where a package's artifact ships. The core brings `docker` (nobody's
|
|
58
59
|
* ecosystem); npm's target is the `node` built-in's, and any other technology's is its own plugin's. */
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export {
|
|
62
|
-
export type
|
|
63
|
-
export {
|
|
60
|
+
export { Registry } from './core/classes/registry.js';
|
|
61
|
+
export { Repository } from './core/classes/repository.js';
|
|
62
|
+
export { Service, type ServiceFactory, type ServiceMap } from './core/classes/service.js';
|
|
63
|
+
export { declaredTargets, type PublishTarget, shipsTo, targetsOf, unknownTargets, } from './core/interfaces/publish-target.js';
|
|
64
|
+
export type { RunConditionFn, RunStepContext, RunStepFn, RunStepValue } from './core/interfaces/run-step.js';
|
|
64
65
|
/**
|
|
65
66
|
* **`Platform` is one technology, whole**; **`Plugin` is whatever a package contributes**, platforms
|
|
66
67
|
* among them.
|
|
@@ -74,18 +75,18 @@ export { Service, type ServiceFactory, type ServiceMap } from './core/service.js
|
|
|
74
75
|
* rman 1.x plugin was `{ name, init }` and so is a 2.x plugin contributing nothing but an `init` -
|
|
75
76
|
* no shape test can tell them apart.
|
|
76
77
|
*/
|
|
77
|
-
export
|
|
78
|
-
export type
|
|
78
|
+
export type { ChangeKind } from './core/classes/version-scheme.js';
|
|
79
|
+
export { basePlatform, definePlatform, definePlugin, isPlatform, type Platform, type Plugin, type PluginContext, } from './core/interfaces/plugin.js';
|
|
79
80
|
/** The numbering seam. `VersionScheme` is abstract - `highestVersion`/`highestBump`/`smallestBump`
|
|
80
81
|
* are implemented from the members around them, so a scheme states only what it must and still
|
|
81
82
|
* overrides any of the three. `SemverScheme` is exported to subclass rather than restate. */
|
|
82
|
-
export { assertOneScheme, SemverScheme, semverScheme, VersionScheme } from './core/version-scheme.js';
|
|
83
|
+
export { assertOneScheme, SemverScheme, semverScheme, VersionScheme } from './core/classes/version-scheme.js';
|
|
83
84
|
/** The workspace seam: how a repository's packages are found. A plugin contributes a provider
|
|
84
85
|
* (see `Plugin.workspace`); the core has none, so `workspaces` is npm's idea and belongs to the
|
|
85
86
|
* `node` built-in. */
|
|
86
87
|
/** `Workspace.Layout`, `Workspace.Provider`, `Workspace.addProvider`, `Workspace.resolve`,
|
|
87
88
|
* `Workspace.findRoot` - one namespace, so a plugin can augment it. */
|
|
88
|
-
export { Workspace } from './core/workspace.js';
|
|
89
|
+
export { Workspace } from './core/classes/workspace.js';
|
|
89
90
|
/**
|
|
90
91
|
* **How a command is declared** - the same API the built-ins use, so a plugin's command is declared
|
|
91
92
|
* rather than built: options as data (checked for typos), positionals named against the command
|
|
@@ -142,21 +143,21 @@ export { formatDuration, type ProgressItem, ProgressPanel, type ProgressStatus,
|
|
|
142
143
|
* does, and so must a publish target deciding whether a version needs its own dist-tag. Exported
|
|
143
144
|
* because that second caller lives in a plugin. */
|
|
144
145
|
/**
|
|
145
|
-
* **The `node`
|
|
146
|
-
* services and target are named from here - a repository
|
|
147
|
-
* `
|
|
146
|
+
* **The `node` preset's own surface.** It ships inside rman rather than as `rman-node`, so its
|
|
147
|
+
* services and target are named from here - a repository gets the technology from
|
|
148
|
+
* `DEFAULT_PRESETS`, or names it with `extends: "rman:node"`, and never constructs any of this by
|
|
149
|
+
* hand.
|
|
148
150
|
*
|
|
149
151
|
* Its `.rmanrc` *keys* arrive separately, through the bare import at the top of this file - see
|
|
150
152
|
* there for why that import is not tidiness.
|
|
151
153
|
*/
|
|
152
|
-
export {
|
|
153
|
-
export
|
|
154
|
-
export {
|
|
155
|
-
export {
|
|
156
|
-
export {
|
|
157
|
-
export {
|
|
158
|
-
export {
|
|
159
|
-
export type { ParsedWorkspaceRange } from './plugins/node/utils/workspace-range.js';
|
|
154
|
+
export type { NodeConfigKeys, RmanNodeConfig } from './builtins/platforms/node/node-config.interface.js';
|
|
155
|
+
export { CiService } from './builtins/platforms/node/services/ci.service.js';
|
|
156
|
+
export { CleanService } from './builtins/platforms/node/services/clean.service.js';
|
|
157
|
+
export { PublishService } from './builtins/platforms/node/services/publish.service.js';
|
|
158
|
+
export { NodeVersionPlanService } from './builtins/platforms/node/services/version-plan.service.js';
|
|
159
|
+
export type { ParsedWorkspaceRange } from './builtins/platforms/node/utils/workspace-range.js';
|
|
160
|
+
export { NPM_TARGET, NpmPublishTarget } from './builtins/publish-targets/npm/npm-publish-target.js';
|
|
160
161
|
export { isCalendarVersion } from './utils/release-version.js';
|
|
161
162
|
export type { RunBinOptions, RunBinResult } from './utils/run-bin.js';
|
|
162
163
|
export { runBin } from './utils/run-bin.js';
|
package/index.js
CHANGED
|
@@ -29,44 +29,34 @@
|
|
|
29
29
|
* Type-only, so the emitted module is empty - imported for what it declares, not for what it does.
|
|
30
30
|
* Pinned in `docs-api.spec.ts`, which imports only from this file.
|
|
31
31
|
*/
|
|
32
|
-
import './
|
|
33
|
-
export { defineConfig } from './
|
|
34
|
-
export { defineCommand } from './core/custom-command.js';
|
|
32
|
+
import './builtins/platforms/node/augmentation/rmanrc.augmentation.js';
|
|
33
|
+
export { defineConfig } from './interfaces/rman-config.interface.js';
|
|
34
|
+
export { defineCommand } from './core/interfaces/custom-command.js';
|
|
35
35
|
/** Both the shape and the registry: `const m: Manifest` and `Manifest.read(dir)` - merged onto one
|
|
36
36
|
* name so a plugin can augment it the way it augments `SystemInfo`. */
|
|
37
37
|
export { RmanApplication } from './core/application.js';
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/** The manifest seam, grouped on a plugin as `Plugin.manifestProvider`: where a package's name and
|
|
39
|
+
* version are written, what it declares, and how it is numbered and stamped. The core has none -
|
|
40
|
+
* `package.json` is npm's answer, and belongs to the `node` built-in. */
|
|
41
|
+
export { Package } from './core/classes/package.js';
|
|
42
|
+
export { Manifest } from './core/interfaces/manifest.js';
|
|
40
43
|
/** The publish seam: where a package's artifact ships. The core brings `docker` (nobody's
|
|
41
44
|
* ecosystem); npm's target is the `node` built-in's, and any other technology's is its own plugin's. */
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
|
|
47
|
-
* **`Platform` is one technology, whole**; **`Plugin` is whatever a package contributes**, platforms
|
|
48
|
-
* among them.
|
|
49
|
-
*
|
|
50
|
-
* A platform says how its packages are recognized and written, where they live, what goes on a
|
|
51
|
-
* child's PATH and how its releases are planned - `manifestProvider` is what makes one, and it is
|
|
52
|
-
* required. A plugin carries `platforms` and an `init` for anything the seams do not name yet; a
|
|
53
|
-
* bare `Platform` is accepted wherever a `Plugin` is, as sugar for the plugin that provides only it.
|
|
54
|
-
*
|
|
55
|
-
* **Both must be declared through their factory.** `loadPlugins` checks for the mark, because an
|
|
56
|
-
* rman 1.x plugin was `{ name, init }` and so is a 2.x plugin contributing nothing but an `init` -
|
|
57
|
-
* no shape test can tell them apart.
|
|
58
|
-
*/
|
|
59
|
-
export { basePlatform, definePlatform, definePlugin, isPlatform, } from './core/plugin.js';
|
|
45
|
+
export { Registry } from './core/classes/registry.js';
|
|
46
|
+
export { Repository } from './core/classes/repository.js';
|
|
47
|
+
export { Service } from './core/classes/service.js';
|
|
48
|
+
export { declaredTargets, shipsTo, targetsOf, unknownTargets, } from './core/interfaces/publish-target.js';
|
|
49
|
+
export { basePlatform, definePlatform, definePlugin, isPlatform, } from './core/interfaces/plugin.js';
|
|
60
50
|
/** The numbering seam. `VersionScheme` is abstract - `highestVersion`/`highestBump`/`smallestBump`
|
|
61
51
|
* are implemented from the members around them, so a scheme states only what it must and still
|
|
62
52
|
* overrides any of the three. `SemverScheme` is exported to subclass rather than restate. */
|
|
63
|
-
export { assertOneScheme, SemverScheme, semverScheme, VersionScheme } from './core/version-scheme.js';
|
|
53
|
+
export { assertOneScheme, SemverScheme, semverScheme, VersionScheme } from './core/classes/version-scheme.js';
|
|
64
54
|
/** The workspace seam: how a repository's packages are found. A plugin contributes a provider
|
|
65
55
|
* (see `Plugin.workspace`); the core has none, so `workspaces` is npm's idea and belongs to the
|
|
66
56
|
* `node` built-in. */
|
|
67
57
|
/** `Workspace.Layout`, `Workspace.Provider`, `Workspace.addProvider`, `Workspace.resolve`,
|
|
68
58
|
* `Workspace.findRoot` - one namespace, so a plugin can augment it. */
|
|
69
|
-
export { Workspace } from './core/workspace.js';
|
|
59
|
+
export { Workspace } from './core/classes/workspace.js';
|
|
70
60
|
/**
|
|
71
61
|
* **How a command is declared** - the same API the built-ins use, so a plugin's command is declared
|
|
72
62
|
* rather than built: options as data (checked for typos), positionals named against the command
|
|
@@ -102,27 +92,11 @@ export { applyFromRootOption, applyPackageFilterOptions, filterPackages, fromRoo
|
|
|
102
92
|
/** The live panel `run`/`build`/`clean` print - a plugin's per-package command looks like the rest
|
|
103
93
|
* of rman instead of like a script someone bolted on. */
|
|
104
94
|
export { formatDuration, ProgressPanel, } from './utils/progress-panel.js';
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* does, and so must a publish target deciding whether a version needs its own dist-tag. Exported
|
|
111
|
-
* because that second caller lives in a plugin. */
|
|
112
|
-
/**
|
|
113
|
-
* **The `node` built-in's own surface.** It ships inside rman rather than as `rman-node`, so its
|
|
114
|
-
* services and target are named from here - a repository asks for the technology with
|
|
115
|
-
* `plugins: ['node']` (or lets detection find it) and never constructs any of this by hand.
|
|
116
|
-
*
|
|
117
|
-
* Its `.rmanrc` *keys* arrive separately, through the bare import at the top of this file - see
|
|
118
|
-
* there for why that import is not tidiness.
|
|
119
|
-
*/
|
|
120
|
-
export { BUILTIN_PLUGINS, builtinPluginNames, isBuiltinPlugin } from './plugins/builtins.js';
|
|
121
|
-
export { NPM_TARGET, NpmPublishTarget } from './plugins/node/npm-publish-target.js';
|
|
122
|
-
export { CiService } from './plugins/node/services/ci.service.js';
|
|
123
|
-
export { CleanService } from './plugins/node/services/clean.service.js';
|
|
124
|
-
export { PublishService } from './plugins/node/services/publish.service.js';
|
|
125
|
-
export { NodeVersionPlanService } from './plugins/node/services/version-plan.service.js';
|
|
95
|
+
export { CiService } from './builtins/platforms/node/services/ci.service.js';
|
|
96
|
+
export { CleanService } from './builtins/platforms/node/services/clean.service.js';
|
|
97
|
+
export { PublishService } from './builtins/platforms/node/services/publish.service.js';
|
|
98
|
+
export { NodeVersionPlanService } from './builtins/platforms/node/services/version-plan.service.js';
|
|
99
|
+
export { NPM_TARGET, NpmPublishTarget } from './builtins/publish-targets/npm/npm-publish-target.js';
|
|
126
100
|
export { isCalendarVersion } from './utils/release-version.js';
|
|
127
101
|
export { runBin } from './utils/run-bin.js';
|
|
128
102
|
export { OCI_VERSION_LABEL, stampVersionConstant, stampVersionLabel } from './utils/version-stamp.js';
|