rman 2.13.0 → 2.14.0
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/builtins/platforms/node/node-dependency-updater.d.ts +116 -0
- package/builtins/platforms/node/node-dependency-updater.js +452 -0
- package/builtins/platforms/node/node.platform.d.ts +2 -0
- package/builtins/platforms/node/node.platform.js +2 -0
- package/builtins/publish-targets/npm/npm-view.d.ts +31 -0
- package/builtins/publish-targets/npm/npm-view.js +47 -0
- package/commands/deps.command.d.ts +175 -0
- package/commands/deps.command.js +252 -0
- package/commands.d.ts +2 -0
- package/commands.js +1 -0
- package/constants.js +1 -1
- package/core/interfaces/dependency-updater.d.ts +114 -0
- package/core/interfaces/dependency-updater.js +61 -0
- package/core/interfaces/plugin.d.ts +4 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import micromatch from 'micromatch';
|
|
2
|
+
export var DependencyUpdater;
|
|
3
|
+
(function (DependencyUpdater) {
|
|
4
|
+
/**
|
|
5
|
+
* Every move but the largest - `minor` under semver. The largest is the one a scheme reserves for a
|
|
6
|
+
* break, and taking a break is a decision a person makes, not a default.
|
|
7
|
+
*/
|
|
8
|
+
/* **It was `latest` - every move - and that was the wrong default**, measured the moment it ran:
|
|
9
|
+
* a `^5.3.0` came back as `^7.0.2`. The values are the scheme's own `bumpNames` rather than a list
|
|
10
|
+
* written here, for the reason `version` gives: `patch`/`minor`/`major` are semver's words, and a
|
|
11
|
+
* four-part scheme would offer four. */
|
|
12
|
+
function defaultTarget(bumps) {
|
|
13
|
+
return bumps[Math.max(0, bumps.length - 2)];
|
|
14
|
+
}
|
|
15
|
+
DependencyUpdater.defaultTarget = defaultTarget;
|
|
16
|
+
/**
|
|
17
|
+
* The largest move `settings` allow for the dependency `name`, and the key that said so - the
|
|
18
|
+
* **last** `deps.targets` glob matching it, else `deps.target`.
|
|
19
|
+
*/
|
|
20
|
+
/* Last rather than first, because that is how two `"[selector]"` blocks layer: what is written
|
|
21
|
+
* later wins. */
|
|
22
|
+
function targetFor(settings, name) {
|
|
23
|
+
let found;
|
|
24
|
+
for (const [glob, size] of Object.entries(settings.targets)) {
|
|
25
|
+
if (micromatch.isMatch(name, glob))
|
|
26
|
+
found = { size, from: `deps.targets["${glob}"]` };
|
|
27
|
+
}
|
|
28
|
+
return found ?? { size: settings.target, from: 'deps.target' };
|
|
29
|
+
}
|
|
30
|
+
DependencyUpdater.targetFor = targetFor;
|
|
31
|
+
/** The settings `pkg` is planned with: `options` from the command line over its `.rmanrc "deps"`,
|
|
32
|
+
* and the defaults under both. */
|
|
33
|
+
function settingsFor(pkg, options) {
|
|
34
|
+
const config = pkg.config.deps ?? {};
|
|
35
|
+
const bumps = pkg.versionScheme.bumpNames;
|
|
36
|
+
const target = options.target ?? config.target ?? defaultTarget(bumps);
|
|
37
|
+
if (!bumps.includes(target)) {
|
|
38
|
+
throw new Error(`Invalid "deps.target" for "${pkg.name}": "${target}" (expected one of: ${bumps.join(', ')}, ` +
|
|
39
|
+
`the "${pkg.versionScheme.name}" scheme's own sizes)`);
|
|
40
|
+
}
|
|
41
|
+
const targets = options.target ? {} : { ...(config.targets ?? {}) };
|
|
42
|
+
for (const [glob, size] of Object.entries(targets)) {
|
|
43
|
+
if (!bumps.includes(size)) {
|
|
44
|
+
throw new Error(`Invalid "deps.targets" entry "${glob}" for "${pkg.name}": "${size}" (expected one of: ${bumps.join(', ')})`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
target,
|
|
49
|
+
targets,
|
|
50
|
+
reject: [...toList(config.reject), ...(options.reject ?? [])],
|
|
51
|
+
minAge: options.minAge ?? config.minAge ?? 0,
|
|
52
|
+
types: config.types?.length ? [...config.types] : undefined,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
DependencyUpdater.settingsFor = settingsFor;
|
|
56
|
+
})(DependencyUpdater || (DependencyUpdater = {}));
|
|
57
|
+
function toList(value) {
|
|
58
|
+
if (value === undefined)
|
|
59
|
+
return [];
|
|
60
|
+
return Array.isArray(value) ? [...value] : [value];
|
|
61
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { BinPath } from '../../utils/bin-path.js';
|
|
|
4
4
|
import type { RmanApplication } from '../application.js';
|
|
5
5
|
import type { Repository } from '../classes/repository.js';
|
|
6
6
|
import type { Workspace } from '../classes/workspace.js';
|
|
7
|
+
import type { DependencyUpdater } from './dependency-updater.js';
|
|
7
8
|
import type { ManifestProvider } from './manifest.js';
|
|
8
9
|
/**
|
|
9
10
|
* **One technology, as a whole** - Node, Cargo, Maven. Everything rman needs in order to treat a
|
|
@@ -75,6 +76,9 @@ export interface Platform {
|
|
|
75
76
|
/** How this technology's releases are planned - where a package's change boundary comes from
|
|
76
77
|
* when it has no release tag, and how far into its group a bump reaches. */
|
|
77
78
|
versionPlanner?: VersionPlanService;
|
|
79
|
+
/** How this technology's dependencies are checked against their registry and moved forward -
|
|
80
|
+
* what `rman deps` asks. Absent, `deps` leaves this technology's packages alone. */
|
|
81
|
+
dependencyUpdater?: DependencyUpdater;
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* **A plugin is whatever a package contributes; a platform is one of the things it can contribute.**
|
package/index.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export { Manifest } from './core/interfaces/manifest.js';
|
|
|
65
65
|
export { Registry } from './core/classes/registry.js';
|
|
66
66
|
export { Repository } from './core/classes/repository.js';
|
|
67
67
|
export { Service, type ServiceFactory, type ServiceMap } from './core/classes/service.js';
|
|
68
|
+
/** The `deps` seam: how a technology checks its dependencies against a registry and moves them. */
|
|
69
|
+
export { DependencyUpdater } from './core/interfaces/dependency-updater.js';
|
|
68
70
|
export { declaredTargets, type PublishTarget, shipsTo, skipReasonFor, targetsOf, unknownTargets, } from './core/interfaces/publish-target.js';
|
|
69
71
|
export type { RunConditionFn, RunStepContext, RunStepFn, RunStepObject, RunStepValue, } from './core/interfaces/run-step.js';
|
|
70
72
|
/**
|
package/index.js
CHANGED
|
@@ -71,6 +71,8 @@ export { Manifest } from './core/interfaces/manifest.js';
|
|
|
71
71
|
export { Registry } from './core/classes/registry.js';
|
|
72
72
|
export { Repository } from './core/classes/repository.js';
|
|
73
73
|
export { Service } from './core/classes/service.js';
|
|
74
|
+
/** The `deps` seam: how a technology checks its dependencies against a registry and moves them. */
|
|
75
|
+
export { DependencyUpdater } from './core/interfaces/dependency-updater.js';
|
|
74
76
|
export { declaredTargets, shipsTo, skipReasonFor, targetsOf, unknownTargets, } from './core/interfaces/publish-target.js';
|
|
75
77
|
export { basePlatform, definePlatform, definePlugin, isPlatform, } from './core/interfaces/plugin.js';
|
|
76
78
|
/** The numbering seam. `VersionScheme` is abstract - `highestVersion`/`highestBump`/`smallestBump`
|