rman 2.0.0-beta.5 → 2.0.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.
|
@@ -156,7 +156,13 @@ export var PublishService;
|
|
|
156
156
|
const packages = filterPackages(repository.getPackages({ toposort: true }), options);
|
|
157
157
|
const dirtyFiles = await git.listDirtyFiles({ absolute: true });
|
|
158
158
|
const isDirty = (pkg) => dirtyFiles.some(f => !path.relative(pkg.dirname, f).startsWith('..'));
|
|
159
|
-
|
|
159
|
+
/** Per package, not per run: `resolveRegistry` reads the package's own `publishConfig.registry`
|
|
160
|
+
* when `--registry` was not given, so the question is asked where the answer lives. The test
|
|
161
|
+
* seam keeps its `(name, cwd)` shape - a stub answers from a map and has no registry to
|
|
162
|
+
* respect. */
|
|
163
|
+
const viewPackage = (pkg) => deps.npmViewPackage
|
|
164
|
+
? deps.npmViewPackage(pkg.name, pkg.dirname)
|
|
165
|
+
: npmViewPackage(pkg.name, pkg.dirname, { ...options, registry: resolveRegistry(pkg, options.registry) });
|
|
160
166
|
const entries = new Map();
|
|
161
167
|
const toCheck = [];
|
|
162
168
|
for (const pkg of packages) {
|
|
@@ -200,7 +206,7 @@ export var PublishService;
|
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
await Promise.all(toCheck.map(async (pkg) => {
|
|
203
|
-
const view = await viewPackage(pkg
|
|
209
|
+
const view = await viewPackage(pkg);
|
|
204
210
|
const registryVersion = view?.latest;
|
|
205
211
|
/** **This version**, not `latest` - the two part company the moment a prerelease is
|
|
206
212
|
* published under its own dist-tag, and `latest` then never moves however many betas go
|
|
@@ -304,6 +310,40 @@ function resolvePublishDir(pkg, contentsOverride) {
|
|
|
304
310
|
const rel = (typeof native === 'string' && native) || configured || contentsOverride;
|
|
305
311
|
return rel ? path.resolve(pkg.dirname, rel) : pkg.dirname;
|
|
306
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Which registry a package's own version is asked about, and published to.
|
|
315
|
+
*
|
|
316
|
+
* npm's own precedence, measured rather than assumed: `--registry` on the command line wins over
|
|
317
|
+
* `package.json`'s `publishConfig.registry`, and with neither given npm resolves it itself from
|
|
318
|
+
* `.npmrc` - including a scoped `@owner:registry=`, which is how a GitHub Packages repository is
|
|
319
|
+
* normally set up.
|
|
320
|
+
*
|
|
321
|
+
* @returns the registry to pass, or `undefined` to let npm decide.
|
|
322
|
+
*/
|
|
323
|
+
/* **The check has to ask the registry the publish will use, and it did not.** `npm publish` honours
|
|
324
|
+
* `publishConfig.registry` - it survives into the generated manifest, since `derivePublishManifest`
|
|
325
|
+
* deletes only `publishConfig.directory` - but **`npm view` ignores it**: measured, a package whose
|
|
326
|
+
* `publishConfig.registry` pointed at a dead local address was still answered from
|
|
327
|
+
* registry.npmjs.org.
|
|
328
|
+
*
|
|
329
|
+
* So question B was asked of the wrong registry for exactly one of the three ways a registry can be
|
|
330
|
+
* stated, and `npmViewPackage` swallows a failed lookup as `undefined`, which reads as "never
|
|
331
|
+
* published". Two consequences, and the second is the one to fear:
|
|
332
|
+
*
|
|
333
|
+
* - the plan proposes a publish on **every** run, so the first succeeds and the second is rejected
|
|
334
|
+
* by the registry for republishing a version - a release job that fails for no reason of its own;
|
|
335
|
+
* - if some *other* package holds that name on npmjs.org, rman reads a stranger's version list, and
|
|
336
|
+
* can report `up-to-date` for a publish that never happened.
|
|
337
|
+
*
|
|
338
|
+
* A scoped name in an `.npmrc` was always fine - measured, `npm view @foo/bar` with
|
|
339
|
+
* `@foo:registry=http://127.0.0.1:1/` tries that address - which is why this went unnoticed.
|
|
340
|
+
*
|
|
341
|
+
* Returning `undefined` rather than a default is the half that keeps it working: passing an explicit
|
|
342
|
+
* `--registry` would override whatever `.npmrc` says and break the case that already worked. */
|
|
343
|
+
function resolveRegistry(pkg, override) {
|
|
344
|
+
const native = pkg.manifest.raw.publishConfig?.registry;
|
|
345
|
+
return override || (typeof native === 'string' && native ? native : undefined);
|
|
346
|
+
}
|
|
307
347
|
/**
|
|
308
348
|
* The retired `publish.directory` spelling, if a config still carries it.
|
|
309
349
|
*
|
|
@@ -59,7 +59,8 @@ export class NpmPublishTarget {
|
|
|
59
59
|
},
|
|
60
60
|
registry: {
|
|
61
61
|
target: 'cli',
|
|
62
|
-
describe: 'Registry to check against and publish to
|
|
62
|
+
describe: 'Registry to check against and publish to, for every package in this run. Overrides each ' +
|
|
63
|
+
'package\'s own "publishConfig.registry"; with neither, npm resolves .npmrc itself',
|
|
63
64
|
type: 'string',
|
|
64
65
|
},
|
|
65
66
|
userconfig: {
|
package/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.0.
|
|
1
|
+
export const version = '2.0.1';
|
package/package.json
CHANGED
package/utils/progress-panel.js
CHANGED
|
@@ -128,8 +128,22 @@ export class ProgressPanel {
|
|
|
128
128
|
failedCount++;
|
|
129
129
|
if (this.live.enabled) {
|
|
130
130
|
console.log(colors.red.bold('X'), item.name, duration);
|
|
131
|
+
/* **The replayed log is printed as it was captured, never painted.** It holds the output
|
|
132
|
+
* of every step this item ran, and only the last one failed - so colouring the block red
|
|
133
|
+
* reports the ones that succeeded as failures. Measured on a real build whose `before`
|
|
134
|
+
* ran `rman check` and then `rman lint`: check passed and printed
|
|
135
|
+
* `✅ no circular dependency was found` and `1 succeeded, 0 failed`, and both came back
|
|
136
|
+
* red under the failing package.
|
|
137
|
+
*
|
|
138
|
+
* It also corrupts what the steps themselves coloured. `colors.red()` wraps the whole
|
|
139
|
+
* string, so a line with its own colour keeps it up to its reset and then falls into red
|
|
140
|
+
* for the remainder: `1 succeeded, 0 failed` rendered with `1 succeeded` still green and
|
|
141
|
+
* the comma after it red.
|
|
142
|
+
*
|
|
143
|
+
* The `X` above already says the item failed, and the step that failed printed its own
|
|
144
|
+
* error. */
|
|
131
145
|
if (item.log.length)
|
|
132
|
-
console.log(
|
|
146
|
+
console.log(item.log.join('\n'));
|
|
133
147
|
}
|
|
134
148
|
}
|
|
135
149
|
else {
|