rman 2.36.0 → 2.38.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/README.md CHANGED
@@ -267,13 +267,13 @@ they still install.
267
267
  ```bash
268
268
  rman deps # what could move, and what holds it back
269
269
  rman deps -u # write the new ranges, then check that they install
270
- rman deps --target major # across a major too
270
+ rman deps --target minor # stay inside each major
271
271
  rman deps '@types/*' # only the dependencies matching this glob
272
272
  ```
273
273
 
274
- **A dependency stays inside its major by default** (`deps.target: minor`). Taking a major is a
275
- decision a person makes: `--target major` for one run, `.rmanrc "deps.target"` for a standing
276
- answer, or `deps.targets` for one dependency. Only a caret or tilde range is rewritten; a version is
274
+ **A dependency may cross a major by default** (`deps.target: major`), as long as every other rule
275
+ allows it. To keep majors a decision: `--target minor` for one run, `.rmanrc "deps.target": minor`
276
+ for a standing answer, or `deps.targets` for one dependency. Only a caret or tilde range is rewritten; a version is
277
277
  offered only when every rule rman can see allows it. See
278
278
  [docs/cli/deps.md](https://github.com/panates/rman/blob/main/docs/cli/deps.md).
279
279
 
@@ -84,7 +84,7 @@ const depsCommand = registerCommand(app => {
84
84
  examples: [
85
85
  { command: '$0 deps', description: '# What could move, and what holds it back' },
86
86
  { command: '$0 deps -u', description: '# Write the new ranges, then check that they install' },
87
- { command: '$0 deps --target major', description: '# Across a major too' },
87
+ { command: '$0 deps --target minor', description: '# Stay inside each major' },
88
88
  { command: '$0 deps "@types/*"', description: '# Only the dependencies matching this glob' },
89
89
  ],
90
90
  handler: async (args) => {
@@ -193,7 +193,7 @@ function defaultConcurrency() {
193
193
  return 16;
194
194
  }
195
195
  /**
196
- * `--target`: one of the version schemes' sizes, and by default every size but the largest.
196
+ * `--target`: one of the version schemes' sizes, and by default the largest.
197
197
  *
198
198
  * Read off the technologies this repository loaded rather than written down, because the sizes are
199
199
  * a scheme's - semver's three are the only ones today.
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.36.0';
1
+ export const version = '2.38.0';
@@ -122,6 +122,11 @@ export declare class Repository extends Package {
122
122
  configScope(pkg: Package, options?: {
123
123
  targetVersion?: string;
124
124
  }): ConfigScope;
125
+ /**
126
+ * The package a config entry names - its name, else a directory relative to the repository root
127
+ * - or `undefined`. How `dependencies` and `carries` entries are read.
128
+ */
129
+ resolveDeclaredPackage(entry: string): Package | undefined;
125
130
  /** `${{ git.* }}`, read at most once per repository per process. */
126
131
  protected _gitScope(): GitScope;
127
132
  /**
@@ -202,6 +202,13 @@ export class Repository extends Package {
202
202
  },
203
203
  };
204
204
  }
205
+ /**
206
+ * The package a config entry names - its name, else a directory relative to the repository root
207
+ * - or `undefined`. How `dependencies` and `carries` entries are read.
208
+ */
209
+ resolveDeclaredPackage(entry) {
210
+ return this._resolveDeclaredPackage(entry);
211
+ }
205
212
  /** `${{ git.* }}`, read at most once per repository per process. */
206
213
  _gitScope() {
207
214
  if (this._git)
@@ -116,8 +116,7 @@ export declare namespace DependencyUpdater {
116
116
  restore(): void;
117
117
  }
118
118
  /**
119
- * Every move but the largest - `minor` under semver. The largest is the one a scheme reserves for a
120
- * break, and taking a break is a decision a person makes, not a default.
119
+ * The largest move the scheme has - `major` under semver. `deps.target` or `--target` narrows it.
121
120
  */
122
121
  function defaultTarget(bumps: readonly string[]): string;
123
122
  /**
@@ -2,15 +2,22 @@ import micromatch from 'micromatch';
2
2
  export var DependencyUpdater;
3
3
  (function (DependencyUpdater) {
4
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.
5
+ * The largest move the scheme has - `major` under semver. `deps.target` or `--target` narrows it.
7
6
  */
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. */
7
+ /* **It has been both, and this is the user's call.** It was every move from the start, then every
8
+ * move but the largest after a `^5.3.0` came back as `^7.0.2` the first time it ran - "taking a
9
+ * break is a decision a person makes". It is the largest again on the user's request, after
10
+ * `--target major` had to be typed to get one (`panates/peacox-ui`'s jsdom 30). What made the old
11
+ * reasoning weaker than it was: the rules that matter for a major are checked whatever the target
12
+ * - a dependency's peer ranges, the running Node and the package's `engines.node`, and under `-u`
13
+ * the package manager's own resolver. A repository that wants majors as a decision writes
14
+ * `deps.target: minor`.
15
+ *
16
+ * The values are the scheme's own `bumpNames` rather than a list written here, for the reason
17
+ * `version` gives: `patch`/`minor`/`major` are semver's words, and a four-part scheme would offer
18
+ * four. */
12
19
  function defaultTarget(bumps) {
13
- return bumps[Math.max(0, bumps.length - 2)];
20
+ return bumps[bumps.length - 1];
14
21
  }
15
22
  DependencyUpdater.defaultTarget = defaultTarget;
16
23
  /**
@@ -367,6 +367,19 @@ export interface RmanConfigKeys {
367
367
  * would take that away from exactly the repositories that need it.
368
368
  */
369
369
  dependencies?: string[];
370
+ /**
371
+ * In-repo packages that go **inside this package's artifact** without being a run-time
372
+ * dependency of it - a web UI a Docker image copies in through a build context, a directory a
373
+ * build script bundles. Their changes count as this package's own: `version` bumps it for their
374
+ * commits, its changelog lists them, and a publish target refuses to ship it while they have
375
+ * uncommitted changes.
376
+ *
377
+ * Each entry is a package **name, or a repository-relative directory**, as in `dependencies`. An
378
+ * entry naming no package is an error.
379
+ *
380
+ * @example { "carries": ["@acme/web-ui"] }
381
+ */
382
+ carries?: string[];
370
383
  /**
371
384
  * Config for a **narrower audience**, keyed by a `"[selector]"` naming it - `"[/]"` for the root
372
385
  * package alone, `"[*]"` for the packages below this directory, `"[*-dialect]"` for a glob over
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.36.0",
4
+ "version": "2.38.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
@@ -6,10 +6,11 @@ import type { Package } from '../core/classes/package.js';
6
6
  */
7
7
  export declare function unversionedReason(pkg: Package): string | undefined;
8
8
  /**
9
- * The in-repo packages whose commits count as `pkg`'s own: those it needs at run time that take no
10
- * version themselves, and theirs in turn - a versioned one stops the walk, since it releases on its
11
- * own and reaches `pkg` through the ordinary cascade. Empty for a package that is itself not
12
- * versioned.
9
+ * The in-repo packages whose commits count as `pkg`'s own: every one its `.rmanrc "carries"` names,
10
+ * and those it needs at run time that take no version themselves - and theirs in turn. A versioned
11
+ * run-time dependency stops the walk, since it releases on its own and reaches `pkg` through the
12
+ * ordinary cascade. Empty for a package that is itself not versioned. Throws for a `carries` entry
13
+ * naming no package.
13
14
  *
14
15
  * `isUnversioned` is the planner's answer when one is asking; `unversionedReason` otherwise.
15
16
  */
@@ -46,10 +46,11 @@ export function unversionedReason(pkg) {
46
46
  return undefined;
47
47
  }
48
48
  /**
49
- * The in-repo packages whose commits count as `pkg`'s own: those it needs at run time that take no
50
- * version themselves, and theirs in turn - a versioned one stops the walk, since it releases on its
51
- * own and reaches `pkg` through the ordinary cascade. Empty for a package that is itself not
52
- * versioned.
49
+ * The in-repo packages whose commits count as `pkg`'s own: every one its `.rmanrc "carries"` names,
50
+ * and those it needs at run time that take no version themselves - and theirs in turn. A versioned
51
+ * run-time dependency stops the walk, since it releases on its own and reaches `pkg` through the
52
+ * ordinary cascade. Empty for a package that is itself not versioned. Throws for a `carries` entry
53
+ * naming no package.
53
54
  *
54
55
  * `isUnversioned` is the planner's answer when one is asking; `unversionedReason` otherwise.
55
56
  */
@@ -77,6 +78,15 @@ export function bundledPackages(pkg, isUnversioned = p => !!unversionedReason(p)
77
78
  visit(dep);
78
79
  }
79
80
  };
81
+ /** Declared first and taken whatever their versioning - see `carries` for why a versioned one
82
+ * counts here and not in the walk. What a carried package needs at run time is inside the
83
+ * artifact as well, so the walk goes on from it. */
84
+ for (const carried of declaredCarries(pkg)) {
85
+ if (carried === pkg || result.includes(carried))
86
+ continue;
87
+ result.push(carried);
88
+ visit(carried);
89
+ }
80
90
  visit(pkg);
81
91
  return result;
82
92
  }
@@ -89,3 +99,18 @@ export function filesOwnedBy(files, pkg) {
89
99
  const dirs = [pkg, ...bundledPackages(pkg)].map(p => p.dirname);
90
100
  return [...new Set(dirs.flatMap(dir => filesUnder(files, dir)))];
91
101
  }
102
+ /** `pkg`'s `.rmanrc "carries"`, as packages - throwing for an entry that names none. */
103
+ /* **An unknown entry is an error**, where `dependencies` ignores one. That key states edges for a
104
+ * graph and a missing end changes no answer; this one exists because a change went unreleased in
105
+ * silence, and a typo here would be that same silence again. */
106
+ function declaredCarries(pkg) {
107
+ const entries = pkg.config.carries ?? [];
108
+ return entries.map(entry => {
109
+ const found = pkg.repository.resolveDeclaredPackage(entry);
110
+ if (!found) {
111
+ throw new Error(`.rmanrc "carries" of ${pkg.name} names "${entry}", which is no package in this repository ` +
112
+ `- write a package name, or a directory relative to the repository root.`);
113
+ }
114
+ return found;
115
+ });
116
+ }