semantic-release-lerna 2.14.0 → 2.14.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.
package/README.md CHANGED
@@ -48,6 +48,12 @@ $ npm install semantic-release-lerna -D
48
48
  When publishing to the [official registry](https://registry.npmjs.org/), it is recommended to use [trusted publishing](https://docs.npmjs.com/trusted-publishers) for authentication.
49
49
  See the [npm registry authentication](https://github.com/semantic-release/npm?tab=readme-ov-file#npm-registry-authentication) section for `@semantic-release/npm` for details.
50
50
 
51
+ > [!IMPORTANT]
52
+ > Trusted publishing requires Lerna v9 or later.
53
+ > If you still use an older version you need to either use `NPM_TOKEN` or update your Lerna version.
54
+
55
+ Each non-private package will need trusted publishing to be enabled.
56
+
51
57
  For alternative registries or when trusted publishing cannot be used the `NPM_TOKEN` environment variable must be set.
52
58
 
53
59
  ### semantic release configuration
package/dist/index.js CHANGED
@@ -32073,7 +32073,7 @@ async function exchangeIdToken(idToken, packageName, logger) {
32073
32073
  }
32074
32074
  async function exchangeGithubActionsToken(packageName, logger) {
32075
32075
  let idToken;
32076
- logger.log("Verifying OIDC context for publishing from GitHub Actions");
32076
+ logger.log(`Verifying OIDC context for publishing "${packageName}" from GitHub Actions`);
32077
32077
  try {
32078
32078
  idToken = await getIDToken("npm:registry.npmjs.org");
32079
32079
  } catch (e) {
@@ -32085,8 +32085,10 @@ async function exchangeGithubActionsToken(packageName, logger) {
32085
32085
  }
32086
32086
  async function exchangeGitlabPipelinesToken(packageName, logger) {
32087
32087
  const idToken = process.env.NPM_ID_TOKEN;
32088
- logger.log("Verifying OIDC context for publishing from GitLab Pipelines");
32088
+ logger.log(`Verifying OIDC context for publishing "${packageName}" from GitLab Pipelines`);
32089
32089
  if (!idToken) {
32090
+ logger.log(`Retrieval of GitLab Pipelines OIDC token failed`);
32091
+ logger.log("Have you set the `id_tokens.NPM_ID_TOKEN` property to this pipeline job?");
32090
32092
  return void 0;
32091
32093
  }
32092
32094
  return exchangeIdToken(idToken, packageName, logger);
@@ -32103,8 +32105,20 @@ function exchangeToken(pkg, { logger }) {
32103
32105
  }
32104
32106
 
32105
32107
  // src/trusted-publishing/oidc-context.js
32106
- async function oidcContextEstablished(registry, pkg, context) {
32107
- return OFFICIAL_REGISTRY === registry && Boolean(await exchangeToken(pkg, context));
32108
+ async function oidcContextEstablished(registry, packages, context) {
32109
+ if (OFFICIAL_REGISTRY !== registry) {
32110
+ return false;
32111
+ }
32112
+ if (packages.length === 0) {
32113
+ return false;
32114
+ }
32115
+ for (const pkg of packages) {
32116
+ const ok = await exchangeToken(pkg, context);
32117
+ if (!ok) {
32118
+ return false;
32119
+ }
32120
+ }
32121
+ return true;
32108
32122
  }
32109
32123
 
32110
32124
  // src/verify-auth.js
@@ -32135,8 +32149,11 @@ async function verifyTokenAuth(registry, npmrc2, context) {
32135
32149
  }
32136
32150
  }
32137
32151
  async function verify_auth_default(npmrc2, pkg, context) {
32152
+ const { cwd, logger } = context;
32138
32153
  const registry = get_registry_default(pkg, context);
32139
- if (await oidcContextEstablished(registry, pkg, context)) {
32154
+ const project = new Project(cwd, logger);
32155
+ const packages = (await project.getPackages()).filter((pkg2) => !pkg2.private);
32156
+ if (await oidcContextEstablished(registry, packages, context)) {
32140
32157
  return;
32141
32158
  }
32142
32159
  await set_npmrc_auth_default(npmrc2, registry, context);
@@ -34479,7 +34496,11 @@ async function verifyConditions(pluginConfig, context) {
34479
34496
  await verify_auth_default(npmrc, pkg, context);
34480
34497
  }
34481
34498
  } catch (error) {
34482
- errors.push(...error.errors);
34499
+ if (Array.isArray(error.errors)) {
34500
+ errors.push(...error.errors);
34501
+ } else {
34502
+ errors.push(error);
34503
+ }
34483
34504
  }
34484
34505
  if (errors.length > 0) {
34485
34506
  throw new AggregateError2(errors);
@@ -34495,7 +34516,11 @@ async function prepare(pluginConfig, context) {
34495
34516
  await verify_auth_default(npmrc, pkg, context);
34496
34517
  }
34497
34518
  } catch (error) {
34498
- errors.push(...error);
34519
+ if (Array.isArray(error.errors)) {
34520
+ errors.push(...error.errors);
34521
+ } else {
34522
+ errors.push(error);
34523
+ }
34499
34524
  }
34500
34525
  if (errors.length > 0) {
34501
34526
  throw new AggregateError2(errors);
@@ -34511,7 +34536,11 @@ async function publish(pluginConfig, context) {
34511
34536
  await verify_auth_default(npmrc, pkg, context);
34512
34537
  }
34513
34538
  } catch (error) {
34514
- errors.push(...error);
34539
+ if (Array.isArray(error.errors)) {
34540
+ errors.push(...error.errors);
34541
+ } else {
34542
+ errors.push(error);
34543
+ }
34515
34544
  }
34516
34545
  if (errors.length > 0) {
34517
34546
  throw new AggregateError2(errors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-lerna",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "semantic-release plugin to publish lerna monorepo packages to npm",
5
5
  "keywords": [
6
6
  "npm",
@@ -18,6 +18,12 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/ext/semantic-release-lerna.git"
20
20
  },
21
+ "funding": [
22
+ {
23
+ "type": "github",
24
+ "url": "https://github.com/sponsors/ext"
25
+ }
26
+ ],
21
27
  "license": "MIT",
22
28
  "author": "David Sveningsson <ext@sidvind.com>",
23
29
  "contributors": [