auklet 0.0.27 → 0.0.28
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/dist/publish/api/pnpmApi.d.ts +1 -0
- package/dist/publish/api/pnpmApi.js +9 -5
- package/dist/publish/cli.js +1 -1
- package/dist/publish/publishRunner.js +1 -1
- package/dist/publish/runner/packagePublisher.js +1 -1
- package/dist/publish/runner/publishFailureReporter.d.ts +1 -2
- package/dist/publish/runner/publishFailureReporter.js +15 -13
- package/dist/publish/runner/publishTargetError.js +1 -1
- package/dist/publish/runner/versionWriter.js +14 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WorkspacePackage } from '#auklet/publish/types';
|
|
2
2
|
export declare class NpmPublishAuthenticationError extends Error {
|
|
3
|
+
readonly packageRoot: string;
|
|
3
4
|
constructor(packageRoot: string);
|
|
4
5
|
}
|
|
5
6
|
export declare class NpmPackageVersionExistsError extends Error {
|
|
@@ -4,9 +4,10 @@ import semver from 'semver';
|
|
|
4
4
|
import { readPnpmWorkspacePackageInfo } from '#auklet/workspace/packages';
|
|
5
5
|
const supportedPnpmRange = '>=10.0.0';
|
|
6
6
|
export class NpmPublishAuthenticationError extends Error {
|
|
7
|
+
packageRoot;
|
|
7
8
|
constructor(packageRoot) {
|
|
8
|
-
super(
|
|
9
|
-
|
|
9
|
+
super('npm publish requires additional authentication.');
|
|
10
|
+
this.packageRoot = packageRoot;
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
export class NpmPackageVersionExistsError extends Error {
|
|
@@ -70,7 +71,7 @@ export async function runPnpmPublish(packageRoot, args) {
|
|
|
70
71
|
if (hasNpmAuthChallenge(result)) {
|
|
71
72
|
throw new NpmPublishAuthenticationError(packageRoot);
|
|
72
73
|
}
|
|
73
|
-
throw new Error(
|
|
74
|
+
throw new Error('pnpm publish failed.');
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
export async function runPnpmWhoami(packageRoot, options = {}) {
|
|
@@ -139,9 +140,12 @@ const writeProcessOutput = (result) => {
|
|
|
139
140
|
const stdout = String(result.stdout ?? '');
|
|
140
141
|
const stderr = String(result.stderr ?? '');
|
|
141
142
|
if (stdout)
|
|
142
|
-
process.stdout.write(stdout);
|
|
143
|
+
process.stdout.write(withTrailingLineBreak(stdout));
|
|
143
144
|
if (stderr)
|
|
144
|
-
process.stderr.write(stderr);
|
|
145
|
+
process.stderr.write(withTrailingLineBreak(stderr));
|
|
146
|
+
};
|
|
147
|
+
const withTrailingLineBreak = (value) => {
|
|
148
|
+
return value.endsWith('\n') ? value : `${value}\n`;
|
|
145
149
|
};
|
|
146
150
|
const isNpmAuthChallenge = (output) => {
|
|
147
151
|
return [
|
package/dist/publish/cli.js
CHANGED
|
@@ -36,8 +36,8 @@ export async function runPublishCli(args) {
|
|
|
36
36
|
dryRun: argv['dry-run'] === true,
|
|
37
37
|
format: argv.format !== false,
|
|
38
38
|
otp: stringOption(argv.otp),
|
|
39
|
-
ignoreScripts: argv['ignore-scripts'] === true,
|
|
40
39
|
allowDirty: argv['allow-dirty'] === true,
|
|
40
|
+
ignoreScripts: argv['ignore-scripts'] === true,
|
|
41
41
|
}).run();
|
|
42
42
|
}
|
|
43
43
|
export async function runOwnerCli(args) {
|
|
@@ -27,6 +27,6 @@ export function logAuthenticationError(logger, error) {
|
|
|
27
27
|
if (!(error instanceof NpmPublishAuthenticationError))
|
|
28
28
|
return;
|
|
29
29
|
logger.error('npm publish requires additional authentication.');
|
|
30
|
-
logger.error('If publish 2FA is enabled, retry with
|
|
30
|
+
logger.error('If publish 2FA is enabled, retry with `--otp <code>`.');
|
|
31
31
|
logger.error('For CI, use an npm automation token.');
|
|
32
32
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { PublishTargetError } from '#auklet/publish/runner/publishTargetError';
|
|
2
|
-
|
|
3
|
-
export declare function reportPublishFailure(error: PublishTargetError, version: string, logger: AukletLogger): void;
|
|
2
|
+
export declare function reportPublishFailure(error: PublishTargetError, version: string): void;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { createAukletLogger } from '#auklet/logger';
|
|
2
|
+
export function reportPublishFailure(error, version) {
|
|
3
|
+
const logger = createAukletLogger();
|
|
4
|
+
const noteBody = logger.colors.rgb(184, 140, 40);
|
|
5
|
+
const body = [
|
|
6
|
+
noteBody(' Some packages were already published before the failure.'),
|
|
7
|
+
'',
|
|
8
|
+
...error.publishedTargets.map((target) => noteBody(` published ${target.packageName}@${version}`)),
|
|
9
|
+
noteBody(` failed ${error.target.packageName}@${version}`),
|
|
10
|
+
];
|
|
11
|
+
logger.newline();
|
|
12
|
+
logger.note({
|
|
13
|
+
title: logger.colors.yellow(logger.colors.bold('Partial publish detected')),
|
|
14
|
+
body,
|
|
15
|
+
});
|
|
11
16
|
}
|
|
12
|
-
const formatPublishedTarget = (logger, packageName, version) => {
|
|
13
|
-
return ['- ', logger.package(packageName), '@', logger.version(version)];
|
|
14
|
-
};
|
|
@@ -5,7 +5,7 @@ export class PublishTargetError extends Error {
|
|
|
5
5
|
originalError;
|
|
6
6
|
publishedTargets;
|
|
7
7
|
constructor(target, phase, originalError, publishedTargets) {
|
|
8
|
-
super(
|
|
8
|
+
super(`${phase} failed for ${target.packageName} at ${path.relative(process.cwd(), target.packageRoot) || target.packageRoot}.`);
|
|
9
9
|
this.target = target;
|
|
10
10
|
this.phase = phase;
|
|
11
11
|
this.originalError = originalError;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readPackageJson, writePackageJson, } from '#auklet/publish/api/packageJsonApi';
|
|
2
|
+
import { createAukletLogger } from '#auklet/logger';
|
|
2
3
|
export class VersionWriter {
|
|
3
4
|
options;
|
|
4
5
|
logger;
|
|
@@ -48,7 +49,19 @@ export class VersionWriter {
|
|
|
48
49
|
}
|
|
49
50
|
logWrittenVersionFailure(plan) {
|
|
50
51
|
if (!plan.dryRun && this.options.version) {
|
|
51
|
-
|
|
52
|
+
const logger = createAukletLogger();
|
|
53
|
+
const noteBody = logger.colors.rgb(184, 140, 40);
|
|
54
|
+
logger.newline();
|
|
55
|
+
logger.note({
|
|
56
|
+
title: logger.colors.yellow(logger.colors.bold('Version files may have changed')),
|
|
57
|
+
body: [
|
|
58
|
+
[noteBody(' package.json versions may have been written.')],
|
|
59
|
+
[
|
|
60
|
+
noteBody(' Auklet will not roll them back; check publish output before retrying.'),
|
|
61
|
+
],
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
logger.newline();
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
writeVersions(plan) {
|