@anolilab/semantic-release-pnpm 6.0.0 → 8.0.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/CHANGELOG.md +15 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.js +34 -34
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [8.0.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@7.0.0...@anolilab/semantic-release-pnpm@8.0.0) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **semantic-release-pnpm:** false EINVALIDNPMAUTH on successful dry-run publish ([ccb0475](https://github.com/anolilab/semantic-release/commit/ccb04758a6b3cf7176f5ea6a5081a0ec239c3e0e)), closes [anolilab/semantic-release#278](https://github.com/anolilab/semantic-release/issues/278)
|
|
6
|
+
* **semantic-release-pnpm:** fix type errors and resolve all ESLint violations ([943e416](https://github.com/anolilab/semantic-release/commit/943e41694917a5a94c3d7f629acd198d7e37b592))
|
|
7
|
+
* **semantic-release-pnpm:** fix verify-auth test and resolve ESLint violations ([9f38380](https://github.com/anolilab/semantic-release/commit/9f383802f58df3ceb13c46b570853c309ee95357))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Dependencies
|
|
11
|
+
|
|
12
|
+
* **@anolilab/rc:** upgraded to 4.0.1
|
|
13
|
+
|
|
14
|
+
## @anolilab/semantic-release-pnpm [7.0.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@6.0.0...@anolilab/semantic-release-pnpm@7.0.0) (2026-04-07)
|
|
15
|
+
|
|
1
16
|
## @anolilab/semantic-release-pnpm [6.0.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@5.0.0...@anolilab/semantic-release-pnpm@6.0.0) (2026-04-07)
|
|
2
17
|
|
|
3
18
|
## @anolilab/semantic-release-pnpm [5.0.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@4.1.0...@anolilab/semantic-release-pnpm@5.0.0) (2026-02-02)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import stream from 'node:stream';
|
|
2
2
|
|
|
3
3
|
interface BranchObject {
|
|
4
|
-
channel?: string | false
|
|
4
|
+
channel?: string | false;
|
|
5
5
|
name: string;
|
|
6
|
-
prerelease?: boolean | string
|
|
7
|
-
range?: string
|
|
6
|
+
prerelease?: boolean | string;
|
|
7
|
+
range?: string;
|
|
8
8
|
}
|
|
9
9
|
type BranchSpec$1 = BranchObject | string;
|
|
10
10
|
type PluginSpec<T = any> = string | [string, T];
|
|
11
11
|
interface Options {
|
|
12
12
|
[name: string]: any;
|
|
13
|
-
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1
|
|
14
|
-
ci?: boolean
|
|
15
|
-
dryRun?: boolean
|
|
16
|
-
extends?: ReadonlyArray<string> | string
|
|
17
|
-
plugins?: ReadonlyArray<PluginSpec
|
|
18
|
-
repositoryUrl?: string
|
|
19
|
-
tagFormat?: string
|
|
13
|
+
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1>;
|
|
14
|
+
ci?: boolean;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
extends?: ReadonlyArray<string> | string;
|
|
17
|
+
plugins?: ReadonlyArray<PluginSpec>;
|
|
18
|
+
repositoryUrl?: string;
|
|
19
|
+
tagFormat?: string;
|
|
20
20
|
}
|
|
21
21
|
interface Commit {
|
|
22
22
|
author: {
|
|
@@ -93,7 +93,7 @@ interface Release {
|
|
|
93
93
|
gitHead?: string;
|
|
94
94
|
gitTag?: string;
|
|
95
95
|
name?: string;
|
|
96
|
-
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease"
|
|
96
|
+
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease";
|
|
97
97
|
version: string;
|
|
98
98
|
}
|
|
99
99
|
|
package/dist/index.js
CHANGED
|
@@ -135,7 +135,7 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
135
135
|
const distributionTag = getChannel(channel);
|
|
136
136
|
logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);
|
|
137
137
|
const npmrc = getNpmrcPath(cwd, env);
|
|
138
|
-
const distTagArguments = ["dist-tag", "add", `${packageJson.name}@${version}`, distributionTag, "--registry", registry];
|
|
138
|
+
const distTagArguments = ["dist-tag", "add", `${packageJson.name ?? ""}@${version}`, distributionTag, "--registry", registry];
|
|
139
139
|
debug$8(`Executing: pnpm ${distTagArguments.join(" ")}`);
|
|
140
140
|
const result = execa("pnpm", distTagArguments, {
|
|
141
141
|
cwd,
|
|
@@ -148,10 +148,10 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
148
148
|
result.stdout.pipe(stdout, { end: false });
|
|
149
149
|
result.stderr.pipe(stderr, { end: false });
|
|
150
150
|
await result;
|
|
151
|
-
logger.log(`Added ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
151
|
+
logger.log(`Added ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
152
152
|
return getReleaseInfo(packageJson, context, distributionTag, registry);
|
|
153
153
|
}
|
|
154
|
-
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
154
|
+
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson) ?? ""}`);
|
|
155
155
|
return false;
|
|
156
156
|
};
|
|
157
157
|
|
|
@@ -224,13 +224,14 @@ const publish$1 = async (pluginConfig, packageJson, context) => {
|
|
|
224
224
|
try {
|
|
225
225
|
await result;
|
|
226
226
|
} catch (error) {
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
228
|
+
logger.log(`Failed to publish ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}: ${errorMessage}`);
|
|
229
|
+
throw new AggregateError([error], errorMessage, { cause: error });
|
|
229
230
|
}
|
|
230
|
-
logger.log(`Published ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
231
|
+
logger.log(`Published ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
231
232
|
return getReleaseInfo(packageJson, context, distributionTag, registry);
|
|
232
233
|
}
|
|
233
|
-
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
234
|
+
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson) ?? ""}`);
|
|
234
235
|
return false;
|
|
235
236
|
};
|
|
236
237
|
|
|
@@ -308,7 +309,7 @@ Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
|
308
309
|
details: `When not publishing through [trusted publishing](https://docs.npmjs.com/trusted-publishers), an [npm token](${linkify(
|
|
309
310
|
"README.md#npm-registry-authentication"
|
|
310
311
|
)}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
|
|
311
|
-
Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow publishing to the registry \`${registry}\`.`,
|
|
312
|
+
Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow publishing to the registry \`${registry ?? ""}\`.`,
|
|
312
313
|
message: "No npm token specified."
|
|
313
314
|
};
|
|
314
315
|
},
|
|
@@ -356,7 +357,7 @@ const getPackage = async ({ pkgRoot }, { cwd }) => {
|
|
|
356
357
|
} catch (error) {
|
|
357
358
|
if (error.code === "ENOENT") {
|
|
358
359
|
const semanticError = getError("ENOPKG");
|
|
359
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
360
|
+
throw new AggregateError([semanticError], semanticError.message, { cause: error });
|
|
360
361
|
}
|
|
361
362
|
throw error;
|
|
362
363
|
}
|
|
@@ -373,10 +374,10 @@ const exchangeIdToken = async (idToken, packageName, context) => {
|
|
|
373
374
|
debug$5("OIDC token exchange with the npm registry succeeded");
|
|
374
375
|
return responseBody.token;
|
|
375
376
|
}
|
|
376
|
-
debug$5(`OIDC token exchange with the npm registry failed: ${response.status} ${responseBody.message}`);
|
|
377
|
-
if (response.status === 404 || responseBody.message
|
|
377
|
+
debug$5(`OIDC token exchange with the npm registry failed: ${String(response.status)} ${responseBody.message}`);
|
|
378
|
+
if (response.status === 404 || responseBody.message.toLowerCase().includes("not found")) {
|
|
378
379
|
const warningMessage = `Package "${packageName}" does not exist on npm. npm requires a package to exist before you can configure OIDC trusted publishing. You can either publish a dummy version manually first (e.g., \`pnpm publish --tag dummy\`) or use the \`setup-npm-trusted-publish\` tool (https://github.com/azu/setup-npm-trusted-publish) to create a placeholder package. After the package exists, configure OIDC trusted publishing at https://www.npmjs.com/package/${encodeURIComponent(packageName)}/access`;
|
|
379
|
-
context?.logger
|
|
380
|
+
context?.logger.error(warningMessage);
|
|
380
381
|
debug$5(warningMessage);
|
|
381
382
|
}
|
|
382
383
|
return void 0;
|
|
@@ -414,7 +415,7 @@ const tokenExchange = (pkg, context) => {
|
|
|
414
415
|
return Promise.resolve(void 0);
|
|
415
416
|
}
|
|
416
417
|
const ciEnv = envCi();
|
|
417
|
-
const ciProviderName = typeof ciEnv
|
|
418
|
+
const ciProviderName = typeof ciEnv.name === "string" ? ciEnv.name : void 0;
|
|
418
419
|
if (!ciProviderName) {
|
|
419
420
|
debug$5("Unable to detect CI provider for OIDC token exchange");
|
|
420
421
|
debug$5("Supported CI providers for OIDC trusted publishing: GitHub Actions, GitLab CI/CD");
|
|
@@ -523,7 +524,8 @@ const getCacheKey = (registry, context) => {
|
|
|
523
524
|
});
|
|
524
525
|
const token = getAuthToken(registry, { npmrc: config });
|
|
525
526
|
if (token) {
|
|
526
|
-
const
|
|
527
|
+
const tokenValue = token.token;
|
|
528
|
+
const tokenId = tokenValue.length > 12 ? `${tokenValue.slice(0, 8)}...${tokenValue.slice(-4)}` : tokenValue.slice(0, 8);
|
|
527
529
|
return `${normalizedRegistry}:token:${tokenId}`;
|
|
528
530
|
}
|
|
529
531
|
} catch {
|
|
@@ -532,8 +534,8 @@ const getCacheKey = (registry, context) => {
|
|
|
532
534
|
};
|
|
533
535
|
const isConnectionError = (error) => {
|
|
534
536
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
535
|
-
const errorCode = error
|
|
536
|
-
const isTimedOut = error
|
|
537
|
+
const errorCode = error.code ?? "";
|
|
538
|
+
const isTimedOut = error.timedOut === true;
|
|
537
539
|
return isTimedOut || errorCode === "ECONNREFUSED" || errorCode === "ETIMEDOUT" || errorMessage.includes("ECONNREFUSED") || errorMessage.includes("ETIMEDOUT") || errorMessage.includes("getaddrinfo ENOTFOUND") || errorMessage.includes("timed out");
|
|
538
540
|
};
|
|
539
541
|
const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
@@ -572,10 +574,10 @@ const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
|
572
574
|
} catch (error) {
|
|
573
575
|
if (isConnectionError(error)) {
|
|
574
576
|
const semanticError2 = getError("EINVALIDNPMAUTH", { registry });
|
|
575
|
-
throw new AggregateError([semanticError2], semanticError2.message);
|
|
577
|
+
throw new AggregateError([semanticError2], semanticError2.message, { cause: error });
|
|
576
578
|
}
|
|
577
579
|
const semanticError = getError("EINVALIDNPMTOKEN", { registry });
|
|
578
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
580
|
+
throw new AggregateError([semanticError], semanticError.message, { cause: error });
|
|
579
581
|
}
|
|
580
582
|
})();
|
|
581
583
|
whoamiCache.set(cacheKey, verificationPromise);
|
|
@@ -588,13 +590,15 @@ const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
|
588
590
|
throw error;
|
|
589
591
|
}
|
|
590
592
|
};
|
|
591
|
-
const
|
|
593
|
+
const AUTH_STATUS_401 = /\b401\b/;
|
|
594
|
+
const AUTH_STATUS_403 = /\b403\b/;
|
|
595
|
+
const isAuthErrorMessage = (message) => message.includes("requires you to be logged in") || message.includes("authentication") || message.includes("Unauthorized") || AUTH_STATUS_401.test(message) || AUTH_STATUS_403.test(message);
|
|
592
596
|
const handlePublishError = (error, registry) => {
|
|
593
597
|
if (error instanceof AggregateError) {
|
|
594
598
|
throw error;
|
|
595
599
|
}
|
|
596
|
-
const errorStderrRaw = error
|
|
597
|
-
const errorStderr = Array.isArray(errorStderrRaw) ? errorStderrRaw.join("\n") : errorStderrRaw
|
|
600
|
+
const errorStderrRaw = error.stderr;
|
|
601
|
+
const errorStderr = Array.isArray(errorStderrRaw) ? errorStderrRaw.join("\n") : errorStderrRaw ?? "";
|
|
598
602
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
599
603
|
const combinedMessage = `${errorStderr} ${errorMessage}`;
|
|
600
604
|
if (isConnectionError(error)) {
|
|
@@ -630,10 +634,6 @@ const verifyAuthContextAgainstCustomRegistry = async (npmrc, registry, context,
|
|
|
630
634
|
}
|
|
631
635
|
if (stderrString) {
|
|
632
636
|
stderr.write(stderrString);
|
|
633
|
-
if (isAuthErrorMessage(stderrString)) {
|
|
634
|
-
const semanticError = getError("EINVALIDNPMAUTH", { registry });
|
|
635
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
636
|
-
}
|
|
637
637
|
}
|
|
638
638
|
} catch (error) {
|
|
639
639
|
handlePublishError(error, registry);
|
|
@@ -705,27 +705,27 @@ const verifyConfig = (config) => (
|
|
|
705
705
|
|
|
706
706
|
const debug$1 = dbg("semantic-release-pnpm:verify-pnpm");
|
|
707
707
|
const MIN_PNPM_VERSION = "8.0.0";
|
|
708
|
-
const verifyPnpm =
|
|
708
|
+
const verifyPnpm = ({ logger }) => {
|
|
709
709
|
logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
|
|
710
710
|
const version = getPackageManagerVersion("pnpm");
|
|
711
|
-
debug$1(`Detected pnpm version: ${
|
|
711
|
+
debug$1(`Detected pnpm version: ${version}`);
|
|
712
712
|
if (gte(MIN_PNPM_VERSION, version)) {
|
|
713
|
-
debug$1(`pnpm version ${
|
|
714
|
-
const semanticError = getError("EINVALIDPNPM", { version
|
|
713
|
+
debug$1(`pnpm version ${version} is below minimum required version ${MIN_PNPM_VERSION}`);
|
|
714
|
+
const semanticError = getError("EINVALIDPNPM", { version });
|
|
715
715
|
throw new AggregateError([semanticError], semanticError.message);
|
|
716
716
|
}
|
|
717
|
-
debug$1(`pnpm version ${
|
|
717
|
+
debug$1(`pnpm version ${version} meets minimum requirement (>= ${MIN_PNPM_VERSION})`);
|
|
718
718
|
};
|
|
719
719
|
|
|
720
720
|
const verify = async (pluginConfig, context) => {
|
|
721
721
|
let errors = verifyConfig(pluginConfig);
|
|
722
722
|
let errorsMessage = "";
|
|
723
723
|
try {
|
|
724
|
-
|
|
724
|
+
verifyPnpm(context);
|
|
725
725
|
} catch (error) {
|
|
726
726
|
const typedError = error;
|
|
727
727
|
errorsMessage += typedError.message;
|
|
728
|
-
errors = [...errors, ...typedError.errors
|
|
728
|
+
errors = [...errors, ...typedError.errors];
|
|
729
729
|
}
|
|
730
730
|
try {
|
|
731
731
|
const packageJson = await getPackage(pluginConfig, context);
|
|
@@ -739,7 +739,7 @@ const verify = async (pluginConfig, context) => {
|
|
|
739
739
|
} catch (error) {
|
|
740
740
|
const typedError = error;
|
|
741
741
|
errorsMessage += typedError.message;
|
|
742
|
-
errors = [...errors, ...typedError.errors
|
|
742
|
+
errors = [...errors, ...typedError.errors];
|
|
743
743
|
}
|
|
744
744
|
if (errors.length > 0) {
|
|
745
745
|
throw new AggregateError(errors, errorsMessage);
|
|
@@ -753,7 +753,7 @@ let prepared;
|
|
|
753
753
|
const verifyConditions = async (pluginConfig, context) => {
|
|
754
754
|
if (context.options.publish) {
|
|
755
755
|
const publish2 = Array.isArray(context.options.publish) ? context.options.publish : [context.options.publish];
|
|
756
|
-
const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME)
|
|
756
|
+
const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME) ?? {};
|
|
757
757
|
pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;
|
|
758
758
|
pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;
|
|
759
759
|
pluginConfig.pkgRoot = pluginConfig.pkgRoot ?? publishPlugin.pkgRoot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/semantic-release-pnpm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Semantic-release plugin to publish a npm package with pnpm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@actions/core": "3.0.0",
|
|
64
|
-
"@anolilab/rc": "4.0.
|
|
64
|
+
"@anolilab/rc": "4.0.1",
|
|
65
65
|
"@semantic-release/error": "^4.0.0",
|
|
66
66
|
"@visulima/fs": "^4.1.0",
|
|
67
67
|
"@visulima/package": "^4.1.7",
|