rman 2.19.0 → 2.19.1

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.
@@ -13,6 +13,8 @@ export declare namespace PublishService {
13
13
  /** A package with uncommitted local changes is excluded (status `'skip'`) instead of aborting
14
14
  * the whole plan (status `'error'`) - same as `version`'s own option. Default false. */
15
15
  ignoreDirty?: boolean;
16
+ /** Which packages are the npm target's (`shipsTo`) - every one the filters keep when omitted. */
17
+ shipsHere?: (pkg: Package) => boolean;
16
18
  /** Registry to check against (and, in `applyPlan`, publish to) - `.npmrc`'s own configured
17
19
  * registry is used when omitted. */
18
20
  registry?: string;
@@ -195,7 +195,7 @@ export var PublishService;
195
195
  PublishService.registryLabel = registryLabel;
196
196
  async function getPlan(repository, options = {}, deps = {}) {
197
197
  const git = new GitHelper({ cwd: repository.dirname });
198
- const packages = filterPackages(repository.getPackages({ toposort: true }), options);
198
+ const packages = filterPackages(repository.getPackages({ toposort: true }), options).filter(pkg => options.shipsHere?.(pkg) ?? true);
199
199
  const dirtyFiles = await git.listDirtyFiles({ absolute: true });
200
200
  const isDirty = (pkg) => dirtyFiles.some(f => !path.relative(pkg.dirname, f).startsWith('..'));
201
201
  /** Per package, not per run: `resolveRegistry` reads the package's own `publishConfig.registry`
@@ -1,5 +1,5 @@
1
1
  import type { Package } from '../../../core/classes/package.js';
2
- import type { PublishTarget } from '../../../core/interfaces/publish-target.js';
2
+ import { type PublishTarget } from '../../../core/interfaces/publish-target.js';
3
3
  import { PublishService } from '../../platforms/node/services/publish.service.js';
4
4
  /** The name this target answers to in `publish.target` and `--target`. */
5
5
  export declare const NPM_TARGET = "npm";
@@ -1,3 +1,4 @@
1
+ import { shipsTo } from '../../../core/interfaces/publish-target.js';
1
2
  import { CiService } from '../../platforms/node/services/ci.service.js';
2
3
  import { PublishService } from '../../platforms/node/services/publish.service.js';
3
4
  /** The name this target answers to in `publish.target` and `--target`. */
@@ -105,6 +106,9 @@ export class NpmPublishTarget {
105
106
  planOptions(ctx) {
106
107
  return {
107
108
  ...ctx.options,
109
+ /** `publish` drops the rest from the plan anyway; asked here too so a docker-only package
110
+ * costs no `npm view`. */
111
+ shipsHere: pkg => shipsTo(pkg, this),
108
112
  registry: ctx.args.registry,
109
113
  userconfig: ctx.args.userconfig,
110
114
  /** Read at *plan* time too, not only where the publish command is built: the plan is what
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import readline from 'node:readline/promises';
3
3
  import colors from 'ansi-colors';
4
- import { unknownTargets } from '../core/interfaces/publish-target.js';
4
+ import { shipsTo, unknownTargets } from '../core/interfaces/publish-target.js';
5
5
  import { registerCommand } from '../interfaces/rman-config.interface.js';
6
6
  import { assertAllowedBranch, branchGuardOptions, readBranchGuardOptions } from '../utils/branch-guard.js';
7
7
  import { packageFilterOptions, readPackageFilterOptions } from '../utils/package-filter.js';
@@ -121,8 +121,14 @@ const publishCommand = registerCommand(app => {
121
121
  };
122
122
  assertDeclaredTargetsExist(app, repository.getPackages());
123
123
  const plans = new Map();
124
- for (const target of selected)
125
- plans.set(target, await target.getPlan(ctx));
124
+ /** A target's plan keeps only the packages that ship to it, whatever the target itself
125
+ * filtered - see `shipsTo`. Asked here, once for every target, because leaving it to each
126
+ * one let them disagree: the npm target never asked, so a package declaring
127
+ * `publish.target: ['docker']` was planned for npm too while `rman list` and the docker
128
+ * target called it docker-only (panates/rman#40). */
129
+ for (const target of selected) {
130
+ plans.set(target, (await target.getPlan(ctx)).filter(entry => shipsTo(entry.package, target)));
131
+ }
126
132
  if (args.json) {
127
133
  console.log(JSON.stringify(jsonPlan(plans), undefined, 2));
128
134
  }
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.19.0';
1
+ export const version = '2.19.1';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.19.0",
4
+ "version": "2.19.1",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {