@anolilab/semantic-release-pnpm 7.0.0 → 8.1.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 +23 -0
- package/README.md +26 -3
- package/dist/index.d.ts +12 -12
- package/dist/index.js +43 -53
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [8.1.0](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@8.0.0...@anolilab/semantic-release-pnpm@8.1.0) (2026-04-08)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **semantic-release-pnpm:** add generic and CircleCI trusted publishing via NPM_ID_TOKEN ([c2aafd3](https://github.com/anolilab/semantic-release/commit/c2aafd301b45cdf5f92eef78ff0d461f7e0df0fb))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* **semantic-release-pnpm:** allow tarballDir option to be set to false ([a31e1d6](https://github.com/anolilab/semantic-release/commit/a31e1d64b2e8481a73700a3dff64233e14aab91d)), closes [#302](https://github.com/anolilab/semantic-release/issues/302)
|
|
10
|
+
|
|
11
|
+
## @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)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **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)
|
|
16
|
+
* **semantic-release-pnpm:** fix type errors and resolve all ESLint violations ([943e416](https://github.com/anolilab/semantic-release/commit/943e41694917a5a94c3d7f629acd198d7e37b592))
|
|
17
|
+
* **semantic-release-pnpm:** fix verify-auth test and resolve ESLint violations ([9f38380](https://github.com/anolilab/semantic-release/commit/9f383802f58df3ceb13c46b570853c309ee95357))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* **@anolilab/rc:** upgraded to 4.0.1
|
|
23
|
+
|
|
1
24
|
## @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)
|
|
2
25
|
|
|
3
26
|
## @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)
|
package/README.md
CHANGED
|
@@ -128,6 +128,28 @@ id_tokens:
|
|
|
128
128
|
|
|
129
129
|
See the [npm documentation for more details about configuring pipeline details](https://docs.npmjs.com/trusted-publishers#gitlab-cicd-configuration)
|
|
130
130
|
|
|
131
|
+
##### Trusted publishing for CircleCI
|
|
132
|
+
|
|
133
|
+
To use trusted publishing in [CircleCI](https://docs.npmjs.com/trusted-publishers#circleci-configuration) you need to set the environment variable `NPM_ID_TOKEN` to an NPM Identity Token:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
jobs:
|
|
137
|
+
semantic-release:
|
|
138
|
+
steps:
|
|
139
|
+
# ...
|
|
140
|
+
- run:
|
|
141
|
+
name: Semantic Release with Trusted Publishing via OIDC
|
|
142
|
+
command: |
|
|
143
|
+
# Fetch the OIDC token with the correct audience for npm
|
|
144
|
+
export NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud": "npm:registry.npmjs.org"}')
|
|
145
|
+
# Run semantic release
|
|
146
|
+
npx semantic-release
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
##### Generic Trusted Publishing
|
|
150
|
+
|
|
151
|
+
The generic mechanism for trusted publishing is to set the `NPM_ID_TOKEN` environment variable to an OIDC identity token. This approach works with any CI platform that has implemented trusted publishing support with npm but does not have specific built-in support in this plugin. If token exchange fails, it will fall back to using token authentication.
|
|
152
|
+
|
|
131
153
|
##### Unsupported CI providers
|
|
132
154
|
|
|
133
155
|
Token authentication is **required** and can be set via [environment variables](#environment-variables).
|
|
@@ -158,9 +180,10 @@ Provenance applies specifically to publishing, so configure it under `publishCon
|
|
|
158
180
|
|
|
159
181
|
### Environment variables
|
|
160
182
|
|
|
161
|
-
| Variable
|
|
162
|
-
|
|
|
163
|
-
| `NPM_TOKEN`
|
|
183
|
+
| Variable | Description |
|
|
184
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
185
|
+
| `NPM_TOKEN` | Npm token created via [npm token create](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) |
|
|
186
|
+
| `NPM_ID_TOKEN` | OIDC identity token for [trusted publishing](https://docs.npmjs.com/trusted-publishers). Must be configured in your CI job (see [GitLab](#trusted-publishing-for-gitlab-pipelines), [CircleCI](#trusted-publishing-for-circleci)). Takes priority over CI-specific token retrieval when set. |
|
|
164
187
|
|
|
165
188
|
### Options
|
|
166
189
|
|
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
|
|
|
@@ -106,7 +106,7 @@ interface PluginConfig {
|
|
|
106
106
|
npmPublish?: boolean;
|
|
107
107
|
pkgRoot?: string;
|
|
108
108
|
publishBranch?: string;
|
|
109
|
-
tarballDir?: string;
|
|
109
|
+
tarballDir?: false | string;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
interface ReleaseInfo {
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,6 @@ const getNpmrcPath = (cwd, environment) => {
|
|
|
58
58
|
|
|
59
59
|
const OFFICIAL_REGISTRY = "https://registry.npmjs.org/";
|
|
60
60
|
const GITHUB_ACTIONS_PROVIDER_NAME = "GitHub Actions";
|
|
61
|
-
const GITLAB_PIPELINES_PROVIDER_NAME = "GitLab CI/CD";
|
|
62
61
|
|
|
63
62
|
const debug$9 = dbg("semantic-release-pnpm:registry");
|
|
64
63
|
const getRegistryUrl = (scope, npmrc) => {
|
|
@@ -135,7 +134,7 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
135
134
|
const distributionTag = getChannel(channel);
|
|
136
135
|
logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);
|
|
137
136
|
const npmrc = getNpmrcPath(cwd, env);
|
|
138
|
-
const distTagArguments = ["dist-tag", "add", `${packageJson.name}@${version}`, distributionTag, "--registry", registry];
|
|
137
|
+
const distTagArguments = ["dist-tag", "add", `${packageJson.name ?? ""}@${version}`, distributionTag, "--registry", registry];
|
|
139
138
|
debug$8(`Executing: pnpm ${distTagArguments.join(" ")}`);
|
|
140
139
|
const result = execa("pnpm", distTagArguments, {
|
|
141
140
|
cwd,
|
|
@@ -148,10 +147,10 @@ const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
|
148
147
|
result.stdout.pipe(stdout, { end: false });
|
|
149
148
|
result.stderr.pipe(stderr, { end: false });
|
|
150
149
|
await result;
|
|
151
|
-
logger.log(`Added ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
150
|
+
logger.log(`Added ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
152
151
|
return getReleaseInfo(packageJson, context, distributionTag, registry);
|
|
153
152
|
}
|
|
154
|
-
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
153
|
+
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson) ?? ""}`);
|
|
155
154
|
return false;
|
|
156
155
|
};
|
|
157
156
|
|
|
@@ -224,13 +223,14 @@ const publish$1 = async (pluginConfig, packageJson, context) => {
|
|
|
224
223
|
try {
|
|
225
224
|
await result;
|
|
226
225
|
} catch (error) {
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
227
|
+
logger.log(`Failed to publish ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}: ${errorMessage}`);
|
|
228
|
+
throw new AggregateError([error], errorMessage, { cause: error });
|
|
229
229
|
}
|
|
230
|
-
logger.log(`Published ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
230
|
+
logger.log(`Published ${packageJson.name ?? ""}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
231
231
|
return getReleaseInfo(packageJson, context, distributionTag, registry);
|
|
232
232
|
}
|
|
233
|
-
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
233
|
+
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson) ?? ""}`);
|
|
234
234
|
return false;
|
|
235
235
|
};
|
|
236
236
|
|
|
@@ -298,7 +298,7 @@ Your configuration for the \`publishBranch\` option is \`${String(publishBranch)
|
|
|
298
298
|
},
|
|
299
299
|
EINVALIDTARBALLDIR: ({ tarballDir }) => {
|
|
300
300
|
return {
|
|
301
|
-
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
|
|
301
|
+
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\` or \`false\`.
|
|
302
302
|
Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
303
303
|
message: "Invalid `tarballDir` option."
|
|
304
304
|
};
|
|
@@ -308,7 +308,7 @@ Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
|
308
308
|
details: `When not publishing through [trusted publishing](https://docs.npmjs.com/trusted-publishers), an [npm token](${linkify(
|
|
309
309
|
"README.md#npm-registry-authentication"
|
|
310
310
|
)}) 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}\`.`,
|
|
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
312
|
message: "No npm token specified."
|
|
313
313
|
};
|
|
314
314
|
},
|
|
@@ -356,7 +356,7 @@ const getPackage = async ({ pkgRoot }, { cwd }) => {
|
|
|
356
356
|
} catch (error) {
|
|
357
357
|
if (error.code === "ENOENT") {
|
|
358
358
|
const semanticError = getError("ENOPKG");
|
|
359
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
359
|
+
throw new AggregateError([semanticError], semanticError.message, { cause: error });
|
|
360
360
|
}
|
|
361
361
|
throw error;
|
|
362
362
|
}
|
|
@@ -373,10 +373,10 @@ const exchangeIdToken = async (idToken, packageName, context) => {
|
|
|
373
373
|
debug$5("OIDC token exchange with the npm registry succeeded");
|
|
374
374
|
return responseBody.token;
|
|
375
375
|
}
|
|
376
|
-
debug$5(`OIDC token exchange with the npm registry failed: ${response.status} ${responseBody.message}`);
|
|
377
|
-
if (response.status === 404 || responseBody.message
|
|
376
|
+
debug$5(`OIDC token exchange with the npm registry failed: ${String(response.status)} ${responseBody.message}`);
|
|
377
|
+
if (response.status === 404 || responseBody.message.toLowerCase().includes("not found")) {
|
|
378
378
|
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
|
|
379
|
+
context?.logger.error(warningMessage);
|
|
380
380
|
debug$5(warningMessage);
|
|
381
381
|
}
|
|
382
382
|
return void 0;
|
|
@@ -398,37 +398,27 @@ const exchangeGithubActionsToken = async (packageName, context) => {
|
|
|
398
398
|
}
|
|
399
399
|
return exchangeIdToken(idToken, packageName, context);
|
|
400
400
|
};
|
|
401
|
-
const exchangeGitlabPipelinesToken = async (packageName, context) => {
|
|
402
|
-
const idToken = process.env.NPM_ID_TOKEN;
|
|
403
|
-
debug$5("Verifying OIDC context for publishing from GitLab Pipelines");
|
|
404
|
-
if (!idToken) {
|
|
405
|
-
debug$5("NPM_ID_TOKEN environment variable is not set");
|
|
406
|
-
debug$5("Configure trusted publishing in your GitLab project settings and set the NPM_ID_TOKEN variable");
|
|
407
|
-
return void 0;
|
|
408
|
-
}
|
|
409
|
-
return exchangeIdToken(idToken, packageName, context);
|
|
410
|
-
};
|
|
411
401
|
const tokenExchange = (pkg, context) => {
|
|
412
402
|
if (!pkg.name || typeof pkg.name !== "string" || pkg.name.trim() === "") {
|
|
413
403
|
context.logger.error("Invalid package name provided for OIDC token exchange");
|
|
414
404
|
return Promise.resolve(void 0);
|
|
415
405
|
}
|
|
406
|
+
const idToken = process.env.NPM_ID_TOKEN;
|
|
407
|
+
if (idToken) {
|
|
408
|
+
debug$5("NPM_ID_TOKEN environment variable detected, using it for OIDC token exchange");
|
|
409
|
+
return exchangeIdToken(idToken, pkg.name, context);
|
|
410
|
+
}
|
|
416
411
|
const ciEnv = envCi();
|
|
417
|
-
const ciProviderName = typeof ciEnv
|
|
412
|
+
const ciProviderName = typeof ciEnv.name === "string" ? ciEnv.name : void 0;
|
|
418
413
|
if (!ciProviderName) {
|
|
419
414
|
debug$5("Unable to detect CI provider for OIDC token exchange");
|
|
420
|
-
debug$5("Supported CI providers for OIDC trusted publishing: GitHub Actions, GitLab CI/CD");
|
|
421
415
|
return Promise.resolve(void 0);
|
|
422
416
|
}
|
|
423
417
|
debug$5(`Detected CI provider: ${ciProviderName}`);
|
|
424
418
|
if (GITHUB_ACTIONS_PROVIDER_NAME === ciProviderName) {
|
|
425
419
|
return exchangeGithubActionsToken(pkg.name, context);
|
|
426
420
|
}
|
|
427
|
-
|
|
428
|
-
return exchangeGitlabPipelinesToken(pkg.name, context);
|
|
429
|
-
}
|
|
430
|
-
debug$5(`CI provider "${ciProviderName}" is not supported for OIDC trusted publishing`);
|
|
431
|
-
debug$5("Supported CI providers: GitHub Actions, GitLab CI/CD");
|
|
421
|
+
debug$5(`CI provider "${ciProviderName}" does not have built-in OIDC support; set NPM_ID_TOKEN to use trusted publishing`);
|
|
432
422
|
return Promise.resolve(void 0);
|
|
433
423
|
};
|
|
434
424
|
|
|
@@ -523,7 +513,8 @@ const getCacheKey = (registry, context) => {
|
|
|
523
513
|
});
|
|
524
514
|
const token = getAuthToken(registry, { npmrc: config });
|
|
525
515
|
if (token) {
|
|
526
|
-
const
|
|
516
|
+
const tokenValue = token.token;
|
|
517
|
+
const tokenId = tokenValue.length > 12 ? `${tokenValue.slice(0, 8)}...${tokenValue.slice(-4)}` : tokenValue.slice(0, 8);
|
|
527
518
|
return `${normalizedRegistry}:token:${tokenId}`;
|
|
528
519
|
}
|
|
529
520
|
} catch {
|
|
@@ -532,8 +523,8 @@ const getCacheKey = (registry, context) => {
|
|
|
532
523
|
};
|
|
533
524
|
const isConnectionError = (error) => {
|
|
534
525
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
535
|
-
const errorCode = error
|
|
536
|
-
const isTimedOut = error
|
|
526
|
+
const errorCode = error.code ?? "";
|
|
527
|
+
const isTimedOut = error.timedOut === true;
|
|
537
528
|
return isTimedOut || errorCode === "ECONNREFUSED" || errorCode === "ETIMEDOUT" || errorMessage.includes("ECONNREFUSED") || errorMessage.includes("ETIMEDOUT") || errorMessage.includes("getaddrinfo ENOTFOUND") || errorMessage.includes("timed out");
|
|
538
529
|
};
|
|
539
530
|
const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
@@ -572,10 +563,10 @@ const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
|
572
563
|
} catch (error) {
|
|
573
564
|
if (isConnectionError(error)) {
|
|
574
565
|
const semanticError2 = getError("EINVALIDNPMAUTH", { registry });
|
|
575
|
-
throw new AggregateError([semanticError2], semanticError2.message);
|
|
566
|
+
throw new AggregateError([semanticError2], semanticError2.message, { cause: error });
|
|
576
567
|
}
|
|
577
568
|
const semanticError = getError("EINVALIDNPMTOKEN", { registry });
|
|
578
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
569
|
+
throw new AggregateError([semanticError], semanticError.message, { cause: error });
|
|
579
570
|
}
|
|
580
571
|
})();
|
|
581
572
|
whoamiCache.set(cacheKey, verificationPromise);
|
|
@@ -588,13 +579,15 @@ const verifyAuthContextAgainstRegistry = async (npmrc, registry, context) => {
|
|
|
588
579
|
throw error;
|
|
589
580
|
}
|
|
590
581
|
};
|
|
591
|
-
const
|
|
582
|
+
const AUTH_STATUS_401 = /\b401\b/;
|
|
583
|
+
const AUTH_STATUS_403 = /\b403\b/;
|
|
584
|
+
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
585
|
const handlePublishError = (error, registry) => {
|
|
593
586
|
if (error instanceof AggregateError) {
|
|
594
587
|
throw error;
|
|
595
588
|
}
|
|
596
|
-
const errorStderrRaw = error
|
|
597
|
-
const errorStderr = Array.isArray(errorStderrRaw) ? errorStderrRaw.join("\n") : errorStderrRaw
|
|
589
|
+
const errorStderrRaw = error.stderr;
|
|
590
|
+
const errorStderr = Array.isArray(errorStderrRaw) ? errorStderrRaw.join("\n") : errorStderrRaw ?? "";
|
|
598
591
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
599
592
|
const combinedMessage = `${errorStderr} ${errorMessage}`;
|
|
600
593
|
if (isConnectionError(error)) {
|
|
@@ -630,10 +623,6 @@ const verifyAuthContextAgainstCustomRegistry = async (npmrc, registry, context,
|
|
|
630
623
|
}
|
|
631
624
|
if (stderrString) {
|
|
632
625
|
stderr.write(stderrString);
|
|
633
|
-
if (isAuthErrorMessage(stderrString)) {
|
|
634
|
-
const semanticError = getError("EINVALIDNPMAUTH", { registry });
|
|
635
|
-
throw new AggregateError([semanticError], semanticError.message);
|
|
636
|
-
}
|
|
637
626
|
}
|
|
638
627
|
} catch (error) {
|
|
639
628
|
handlePublishError(error, registry);
|
|
@@ -685,7 +674,8 @@ const VALIDATORS = {
|
|
|
685
674
|
npmPublish: (value) => typeof value === "boolean",
|
|
686
675
|
pkgRoot: isNonEmptyString,
|
|
687
676
|
publishBranch: isNonEmptyString,
|
|
688
|
-
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
678
|
+
tarballDir: (value) => value === false || isNonEmptyString(value)
|
|
689
679
|
};
|
|
690
680
|
const verifyConfig = (config) => (
|
|
691
681
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
@@ -705,27 +695,27 @@ const verifyConfig = (config) => (
|
|
|
705
695
|
|
|
706
696
|
const debug$1 = dbg("semantic-release-pnpm:verify-pnpm");
|
|
707
697
|
const MIN_PNPM_VERSION = "8.0.0";
|
|
708
|
-
const verifyPnpm =
|
|
698
|
+
const verifyPnpm = ({ logger }) => {
|
|
709
699
|
logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
|
|
710
700
|
const version = getPackageManagerVersion("pnpm");
|
|
711
|
-
debug$1(`Detected pnpm version: ${
|
|
701
|
+
debug$1(`Detected pnpm version: ${version}`);
|
|
712
702
|
if (gte(MIN_PNPM_VERSION, version)) {
|
|
713
|
-
debug$1(`pnpm version ${
|
|
714
|
-
const semanticError = getError("EINVALIDPNPM", { version
|
|
703
|
+
debug$1(`pnpm version ${version} is below minimum required version ${MIN_PNPM_VERSION}`);
|
|
704
|
+
const semanticError = getError("EINVALIDPNPM", { version });
|
|
715
705
|
throw new AggregateError([semanticError], semanticError.message);
|
|
716
706
|
}
|
|
717
|
-
debug$1(`pnpm version ${
|
|
707
|
+
debug$1(`pnpm version ${version} meets minimum requirement (>= ${MIN_PNPM_VERSION})`);
|
|
718
708
|
};
|
|
719
709
|
|
|
720
710
|
const verify = async (pluginConfig, context) => {
|
|
721
711
|
let errors = verifyConfig(pluginConfig);
|
|
722
712
|
let errorsMessage = "";
|
|
723
713
|
try {
|
|
724
|
-
|
|
714
|
+
verifyPnpm(context);
|
|
725
715
|
} catch (error) {
|
|
726
716
|
const typedError = error;
|
|
727
717
|
errorsMessage += typedError.message;
|
|
728
|
-
errors = [...errors, ...typedError.errors
|
|
718
|
+
errors = [...errors, ...typedError.errors];
|
|
729
719
|
}
|
|
730
720
|
try {
|
|
731
721
|
const packageJson = await getPackage(pluginConfig, context);
|
|
@@ -739,7 +729,7 @@ const verify = async (pluginConfig, context) => {
|
|
|
739
729
|
} catch (error) {
|
|
740
730
|
const typedError = error;
|
|
741
731
|
errorsMessage += typedError.message;
|
|
742
|
-
errors = [...errors, ...typedError.errors
|
|
732
|
+
errors = [...errors, ...typedError.errors];
|
|
743
733
|
}
|
|
744
734
|
if (errors.length > 0) {
|
|
745
735
|
throw new AggregateError(errors, errorsMessage);
|
|
@@ -753,7 +743,7 @@ let prepared;
|
|
|
753
743
|
const verifyConditions = async (pluginConfig, context) => {
|
|
754
744
|
if (context.options.publish) {
|
|
755
745
|
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)
|
|
746
|
+
const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME) ?? {};
|
|
757
747
|
pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;
|
|
758
748
|
pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;
|
|
759
749
|
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.1.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",
|