@reelout/yarn 0.2.1 → 0.2.3

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/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { filterPackages, formatError, normalizeWorkspace, sortPackages } from "@reelout/core";
2
- import { bumpPackageDependencies, hasPackageManifest, inspectVersionedPackageManager, isCompleteReleasePlan, loadPackages, probeReleasePlan, publishPlans, resolveGitRepositoryFromPackage, resolveProvenance, resolveWorkspaceMembers, verifyAuth, verifyPublishAccess, verifyTrustedPublishing } from "@reelout/npm";
2
+ import { bumpPackageDependencies, describeYarnOidcVersionBlocker, hasPackageManifest, inspectVersionedPackageManager, isCompleteReleasePlan, loadPackages, probeReleasePlan, publishPlans, resolveGitRepositoryFromPackage, resolveProvenance, resolveWorkspaceMembers, verifyAuth, verifyPublishAccess, verifyTrustedPublishing } from "@reelout/npm";
3
3
  import { colors } from "consola/utils";
4
4
  // src/PLUGIN_NAME.ts
5
5
  var PLUGIN_NAME = "@reelout/yarn";
6
6
  // package.json
7
- var version = "0.2.0";
7
+ var version = "0.2.2";
8
8
  // src/yarn.ts
9
9
  /**
10
10
  * Built-in plugin that discovers Yarn workspace packages, updates package manifests, and publishes packages with Yarn Classic or Yarn Berry.
@@ -15,8 +15,10 @@ var version = "0.2.0";
15
15
  * no root `package.json` or the workspace is not managed by Yarn.
16
16
  * Otherwise resolves and attaches Git repository metadata from root
17
17
  * package configuration, then verifies registry authentication,
18
- * failing in strict mode or skipping the publish phase when no
19
- * credentials exist.
18
+ * failing with a version diagnosis in strict mode and warning
19
+ * otherwise when OIDC environment tokens exist but the Yarn release
20
+ * predates the trusted-publishing exchange, and failing in strict
21
+ * mode or skipping the publish phase when no credentials exist.
20
22
  * - `discover`: Skips discovery when the plugin is inactive. Discovers
21
23
  * workspace member packages, filters them against the `filter` patterns,
22
24
  * and loads package metadata into context.
@@ -64,9 +66,15 @@ var yarn = (options = {}) => {
64
66
  }
65
67
  context.repository = await resolveGitRepositoryFromPackage(context.cwd) ?? context.repository;
66
68
  if (await verifyAuth(context, packageManager) === "none") {
67
- if (context.strict) throw new Error("NPM_TOKEN is required for Yarn authentication in strict mode.");
69
+ const oidcVersionDiagnosis = describeYarnOidcVersionBlocker(packageManager, context.env);
70
+ if (oidcVersionDiagnosis) {
71
+ if (context.strict) throw new Error(oidcVersionDiagnosis);
72
+ context.logger.warn(colors.yellow(oidcVersionDiagnosis));
73
+ }
74
+ const ambientCredentialFile = packageManager.isYarnBerry ? "(\".yarnrc.yml\")" : "(\".npmrc\")";
75
+ if (context.strict) throw new Error(`NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication in strict mode.`);
68
76
  publishSkipped = true;
69
- context.logger.warn(colors.yellow("Packages will not be published: NPM_TOKEN is required for Yarn authentication."));
77
+ context.logger.warn(colors.yellow(`Packages will not be published: NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication.`));
70
78
  }
71
79
  return next(context);
72
80
  },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/PLUGIN_NAME.ts","../src/yarn.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nexport const PLUGIN_NAME = '@reelout/yarn'\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport {\n filterPackages,\n formatError,\n normalizeWorkspace,\n sortPackages,\n type Package,\n type ReleasePlan,\n type ReleasePlugin,\n type Workspace,\n} from '@reelout/core'\nimport {\n bumpPackageDependencies,\n hasPackageManifest,\n inspectVersionedPackageManager,\n isCompleteReleasePlan,\n loadPackages,\n probeReleasePlan,\n publishPlans,\n resolveGitRepositoryFromPackage,\n resolveProvenance,\n resolveWorkspaceMembers,\n verifyAuth,\n verifyPublishAccess,\n verifyTrustedPublishing,\n type PublishAccess,\n type PublishPackageOptions,\n} from '@reelout/npm'\nimport { colors } from 'consola/utils'\nimport { version } from '../package.json'\nimport { PLUGIN_NAME } from './PLUGIN_NAME'\n\nexport interface PluginOptions {\n workspace?: Partial<Workspace>\n access?: PublishAccess | null | undefined\n provenance?: boolean | undefined\n stage?: boolean | undefined\n}\n\n/**\n * Built-in plugin that discovers Yarn workspace packages, updates package manifests, and publishes packages with Yarn Classic or Yarn Berry.\n *\n * @remarks\n * **Lifecycle Stages:**\n * - `configure`: Leaves the plugin inactive when the working directory holds\n * no root `package.json` or the workspace is not managed by Yarn.\n * Otherwise resolves and attaches Git repository metadata from root\n * package configuration, then verifies registry authentication,\n * failing in strict mode or skipping the publish phase when no\n * credentials exist.\n * - `discover`: Skips discovery when the plugin is inactive. Discovers\n * workspace member packages, filters them against the `filter` patterns,\n * and loads package metadata into context.\n * - `write`: Skips manifest updates when the plugin is inactive. Bumps\n * internal workspace dependency versions in `package.json` files (skipped\n * in dry-run).\n * - `publish`: For OIDC-authenticated Yarn Berry releases — Yarn 4.3.0 or\n * newer on a supported CI platform targeting the public npm registry —\n * verifies trusted publishing through the registry's token exchange\n * before anything is published, failing when the registry rejects it.\n * Verifies each publishable package's publish permission against its\n * resolved registry, failing when access is definitively\n * missing and warning when it cannot be confirmed. Then authenticates\n * and probes each publishable package version before publishing,\n * skipping versions the registry already holds with identical content\n * (syncing their dist-tags) and failing on different or unverifiable\n * content. Publishes non-private packages with Yarn, enabling provenance\n * when the manifest repository is valid, matches the context repository,\n * and is public. Falls back to staged publishing when the registry\n * rejects a direct publish with a staged-publishing requirement and the\n * `stage` option does not disable the fallback, summarizing the staged\n * publications at the end. Skips entirely when no Yarn workspace was\n * found, another package manager is active, or configure-stage\n * verification found no registry authentication.\n *\n * @param options Configuration options for Yarn workspace discovery and publishing behavior.\n * @returns A release plugin configured for Yarn workspace management and package publication.\n */\nconst yarn = (options: PluginOptions = {}): ReleasePlugin => {\n let inactive = false\n\n let publishSkipped = false\n\n return {\n name: PLUGIN_NAME,\n version,\n configure: async (context, next) => {\n if (!(await hasPackageManifest(context.cwd))) {\n context.logger.debug(\n `Yarn workspace could not be found at \"${context.cwd}\".`\n )\n\n return next(context)\n }\n\n const packageManager = await inspectVersionedPackageManager(context)\n\n if (!packageManager.isYarn) {\n inactive = true\n\n context.logger.debug(\n `Yarn plugin is inactive: \"${packageManager.name}\" is the active package manager.`\n )\n\n return next(context)\n }\n\n const repo = await resolveGitRepositoryFromPackage(context.cwd)\n context.repository = repo ?? context.repository\n\n const authKind = await verifyAuth(context, packageManager)\n\n if (authKind === 'none') {\n if (context.strict) {\n throw new Error(\n 'NPM_TOKEN is required for Yarn authentication in strict mode.'\n )\n }\n\n publishSkipped = true\n\n context.logger.warn(\n colors.yellow(\n 'Packages will not be published: NPM_TOKEN is required for Yarn authentication.'\n )\n )\n }\n\n return next(context)\n },\n discover: async (context, next) => {\n if (inactive || !(await hasPackageManifest(context.cwd))) {\n return next(context)\n }\n\n const packages: Package[] = []\n\n const workspace = normalizeWorkspace(context.cwd, options.workspace)\n\n workspace.members ??= await resolveWorkspaceMembers(context.cwd)\n\n for (const result of await loadPackages(context.cwd, workspace)) {\n if (result.status === 'fulfilled') {\n packages.push({\n ...result.value,\n provider: PLUGIN_NAME,\n })\n } else {\n context.logger.warn(\n colors.yellow(\n `Package could not be loaded: ${formatError(result.reason)}`\n )\n )\n }\n }\n\n context.packages = sortPackages(\n filterPackages(context.packages.concat(packages), context.filter)\n )\n\n return next(context)\n },\n write: async (context, next) => {\n if (inactive || !(await hasPackageManifest(context.cwd))) {\n return next(context)\n }\n\n if (context.dryRun) {\n context.logger.debug('[DRY RUN] Package files will not be updated.')\n } else {\n await bumpPackageDependencies(\n context.cwd,\n context.plans.filter((plan) => plan.package.provider === PLUGIN_NAME)\n )\n }\n\n return next(context)\n },\n publish: async (context, next) => {\n if (inactive) {\n context.logger.debug(\n 'Yarn plugin is inactive: another package manager is active.'\n )\n\n return next(context)\n }\n\n if (!(await hasPackageManifest(context.cwd))) {\n context.logger.debug(\n 'Yarn publishing was skipped: no Yarn workspace was found.'\n )\n\n return next(context)\n }\n\n if (publishSkipped) {\n context.logger.debug(\n 'Yarn publishing was skipped: no registry authentication was found.'\n )\n\n return next(context)\n }\n\n const provenance = await resolveProvenance(context, options.provenance)\n\n const publishable = context.plans.filter((plan) =>\n isCompleteReleasePlan(plan, PLUGIN_NAME)\n )\n\n const packageManager =\n publishable.length > 0\n ? await inspectVersionedPackageManager(context)\n : undefined\n\n const skipped = new Set<ReleasePlan>()\n\n if (packageManager) {\n const trustedPublishing = await verifyTrustedPublishing(\n context,\n publishable,\n packageManager,\n PLUGIN_NAME\n )\n\n await verifyPublishAccess(\n context,\n publishable,\n packageManager,\n PLUGIN_NAME,\n trustedPublishing\n )\n\n for (const plan of publishable) {\n await probeReleasePlan(context, plan, packageManager, skipped)\n }\n }\n\n const publishOptions: PublishPackageOptions = {\n dryRun: context.dryRun,\n tag: context.releaseChannel,\n access: options.access,\n provenance,\n stage: options.stage,\n }\n\n const staged = await publishPlans(\n context,\n PLUGIN_NAME,\n packageManager,\n publishOptions,\n skipped\n )\n\n if (packageManager !== undefined && staged.length > 0) {\n const targets = staged\n .map((plan) => `\"${plan.package.name}@${plan.release.version}\"`)\n .join(', ')\n\n context.logger.warn(\n colors.yellow(\n `Packages were staged instead of published: ${targets}. Review the staged publications with \"yarn npm stage list\" and finish the release with \"yarn npm stage approve <stage-id>\".`\n )\n )\n }\n\n return next(context)\n },\n }\n}\n\nexport default yarn\n"],"mappings":";;;;AAGA,IAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6E3B,IAAM,QAAQ,UAAyB,CAAC,MAAqB;CAC3D,IAAI,WAAW;CAEf,IAAI,iBAAiB;CAErB,OAAO;EACL,MAAM;EACN;EACA,WAAW,OAAO,SAAS,SAAS;GAClC,IAAI,CAAE,MAAM,mBAAmB,QAAQ,GAAG,GAAI;IAC5C,QAAQ,OAAO,MACb,yCAAyC,QAAQ,IAAI,GACvD;IAEA,OAAO,KAAK,O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index.js","names":[],"sources":["../src/PLUGIN_NAME.ts","../src/yarn.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nexport const PLUGIN_NAME = '@reelout/yarn'\n","// SPDX-License-Identifier: MIT\n// Copyright (c) 2026 Fai\n\nimport {\n filterPackages,\n formatError,\n normalizeWorkspace,\n sortPackages,\n type Package,\n type ReleasePlan,\n type ReleasePlugin,\n type Workspace,\n} from '@reelout/core'\nimport {\n bumpPackageDependencies,\n describeYarnOidcVersionBlocker,\n hasPackageManifest,\n inspectVersionedPackageManager,\n isCompleteReleasePlan,\n loadPackages,\n probeReleasePlan,\n publishPlans,\n resolveGitRepositoryFromPackage,\n resolveProvenance,\n resolveWorkspaceMembers,\n verifyAuth,\n verifyPublishAccess,\n verifyTrustedPublishing,\n type PublishAccess,\n type PublishPackageOptions,\n} from '@reelout/npm'\nimport { colors } from 'consola/utils'\nimport { version } from '../package.json'\nimport { PLUGIN_NAME } from './PLUGIN_NAME'\n\nexport interface PluginOptions {\n workspace?: Partial<Workspace>\n access?: PublishAccess | null | undefined\n provenance?: boolean | undefined\n stage?: boolean | undefined\n}\n\n/**\n * Built-in plugin that discovers Yarn workspace packages, updates package manifests, and publishes packages with Yarn Classic or Yarn Berry.\n *\n * @remarks\n * **Lifecycle Stages:**\n * - `configure`: Leaves the plugin inactive when the working directory holds\n * no root `package.json` or the workspace is not managed by Yarn.\n * Otherwise resolves and attaches Git repository metadata from root\n * package configuration, then verifies registry authentication,\n * failing with a version diagnosis in strict mode and warning\n * otherwise when OIDC environment tokens exist but the Yarn release\n * predates the trusted-publishing exchange, and failing in strict\n * mode or skipping the publish phase when no credentials exist.\n * - `discover`: Skips discovery when the plugin is inactive. Discovers\n * workspace member packages, filters them against the `filter` patterns,\n * and loads package metadata into context.\n * - `write`: Skips manifest updates when the plugin is inactive. Bumps\n * internal workspace dependency versions in `package.json` files (skipped\n * in dry-run).\n * - `publish`: For OIDC-authenticated Yarn Berry releases — Yarn 4.3.0 or\n * newer on a supported CI platform targeting the public npm registry —\n * verifies trusted publishing through the registry's token exchange\n * before anything is published, failing when the registry rejects it.\n * Verifies each publishable package's publish permission against its\n * resolved registry, failing when access is definitively\n * missing and warning when it cannot be confirmed. Then authenticates\n * and probes each publishable package version before publishing,\n * skipping versions the registry already holds with identical content\n * (syncing their dist-tags) and failing on different or unverifiable\n * content. Publishes non-private packages with Yarn, enabling provenance\n * when the manifest repository is valid, matches the context repository,\n * and is public. Falls back to staged publishing when the registry\n * rejects a direct publish with a staged-publishing requirement and the\n * `stage` option does not disable the fallback, summarizing the staged\n * publications at the end. Skips entirely when no Yarn workspace was\n * found, another package manager is active, or configure-stage\n * verification found no registry authentication.\n *\n * @param options Configuration options for Yarn workspace discovery and publishing behavior.\n * @returns A release plugin configured for Yarn workspace management and package publication.\n */\nconst yarn = (options: PluginOptions = {}): ReleasePlugin => {\n let inactive = false\n\n let publishSkipped = false\n\n return {\n name: PLUGIN_NAME,\n version,\n configure: async (context, next) => {\n if (!(await hasPackageManifest(context.cwd))) {\n context.logger.debug(\n `Yarn workspace could not be found at \"${context.cwd}\".`\n )\n\n return next(context)\n }\n\n const packageManager = await inspectVersionedPackageManager(context)\n\n if (!packageManager.isYarn) {\n inactive = true\n\n context.logger.debug(\n `Yarn plugin is inactive: \"${packageManager.name}\" is the active package manager.`\n )\n\n return next(context)\n }\n\n const repo = await resolveGitRepositoryFromPackage(context.cwd)\n context.repository = repo ?? context.repository\n\n const authKind = await verifyAuth(context, packageManager)\n\n if (authKind === 'none') {\n const oidcVersionDiagnosis = describeYarnOidcVersionBlocker(\n packageManager,\n context.env\n )\n\n if (oidcVersionDiagnosis) {\n if (context.strict) {\n throw new Error(oidcVersionDiagnosis)\n }\n\n context.logger.warn(colors.yellow(oidcVersionDiagnosis))\n }\n\n // Yarn Berry reads registry credentials from \".yarnrc.yml\" and\n // Yarn Classic from \".npmrc\", so the message names the file the\n // active release family reads.\n const ambientCredentialFile = packageManager.isYarnBerry\n ? '(\".yarnrc.yml\")'\n : '(\".npmrc\")'\n\n if (context.strict) {\n throw new Error(\n `NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication in strict mode.`\n )\n }\n\n publishSkipped = true\n\n context.logger.warn(\n colors.yellow(\n `Packages will not be published: NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication.`\n )\n )\n }\n\n return next(context)\n },\n discover: async (context, next) => {\n if (inactive || !(await hasPackageManifest(context.cwd))) {\n return next(context)\n }\n\n const packages: Package[] = []\n\n const workspace = normalizeWorkspace(context.cwd, options.workspace)\n\n workspace.members ??= await resolveWorkspaceMembers(context.cwd)\n\n for (const result of await loadPackages(context.cwd, workspace)) {\n if (result.status === 'fulfilled') {\n packages.push({\n ...result.value,\n provider: PLUGIN_NAME,\n })\n } else {\n context.logger.warn(\n colors.yellow(\n `Package could not be loaded: ${formatError(result.reason)}`\n )\n )\n }\n }\n\n context.packages = sortPackages(\n filterPackages(context.packages.concat(packages), context.filter)\n )\n\n return next(context)\n },\n write: async (context, next) => {\n if (inactive || !(await hasPackageManifest(context.cwd))) {\n return next(context)\n }\n\n if (context.dryRun) {\n context.logger.debug('[DRY RUN] Package files will not be updated.')\n } else {\n await bumpPackageDependencies(\n context.cwd,\n context.plans.filter((plan) => plan.package.provider === PLUGIN_NAME)\n )\n }\n\n return next(context)\n },\n publish: async (context, next) => {\n if (inactive) {\n context.logger.debug(\n 'Yarn plugin is inactive: another package manager is active.'\n )\n\n return next(context)\n }\n\n if (!(await hasPackageManifest(context.cwd))) {\n context.logger.debug(\n 'Yarn publishing was skipped: no Yarn workspace was found.'\n )\n\n return next(context)\n }\n\n if (publishSkipped) {\n context.logger.debug(\n 'Yarn publishing was skipped: no registry authentication was found.'\n )\n\n return next(context)\n }\n\n const provenance = await resolveProvenance(context, options.provenance)\n\n const publishable = context.plans.filter((plan) =>\n isCompleteReleasePlan(plan, PLUGIN_NAME)\n )\n\n const packageManager =\n publishable.length > 0\n ? await inspectVersionedPackageManager(context)\n : undefined\n\n const skipped = new Set<ReleasePlan>()\n\n if (packageManager) {\n const trustedPublishing = await verifyTrustedPublishing(\n context,\n publishable,\n packageManager,\n PLUGIN_NAME\n )\n\n await verifyPublishAccess(\n context,\n publishable,\n packageManager,\n PLUGIN_NAME,\n trustedPublishing\n )\n\n for (const plan of publishable) {\n await probeReleasePlan(context, plan, packageManager, skipped)\n }\n }\n\n const publishOptions: PublishPackageOptions = {\n dryRun: context.dryRun,\n tag: context.releaseChannel,\n access: options.access,\n provenance,\n stage: options.stage,\n }\n\n const staged = await publishPlans(\n context,\n PLUGIN_NAME,\n packageManager,\n publishOptions,\n skipped\n )\n\n if (packageManager !== undefined && staged.length > 0) {\n const targets = staged\n .map((plan) => `\"${plan.package.name}@${plan.release.version}\"`)\n .join(', ')\n\n context.logger.warn(\n colors.yellow(\n `Packages were staged instead of published: ${targets}. Review the staged publications with \"yarn npm stage list\" and finish the release with \"yarn npm stage approve <stage-id>\".`\n )\n )\n }\n\n return next(context)\n },\n }\n}\n\nexport default yarn\n"],"mappings":";;;;AAGA,IAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgF3B,IAAM,QAAQ,UAAyB,CAAC,MAAqB;CAC3D,IAAI,WAAW;CAEf,IAAI,iBAAiB;CAErB,OAAO;EACL,MAAM;EACN;EACA,WAAW,OAAO,SAAS,SAAS;GAClC,IAAI,CAAE,MAAM,mBAAmB,QAAQ,GAAG,GAAI;IAC5C,QAAQ,OAAO,MACb,yCAAyC,QAAQ,IAAI,GACvD;IAEA,OAAO,KAAK,OAAO;GACrB;GAEA,MAAM,iBAAiB,MAAM,+BAA+B,OAAO;GAEnE,IAAI,CAAC,eAAe,QAAQ;IAC1B,WAAW;IAEX,QAAQ,OAAO,MACb,6BAA6B,eAAe,KAAK,iCACnD;IAEA,OAAO,KAAK,OAAO;GACrB;GAGA,QAAQ,aAAa,MADF,gCAAgC,QAAQ,GAAG,K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F;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reelout/yarn",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Yarn plugin for discovering workspaces, updating manifests and dependency ranges, and publishing packages with Yarn Classic and Yarn Berry.",
5
5
  "keywords": [
6
6
  "release",
@@ -39,9 +39,9 @@
39
39
  "./src"
40
40
  ],
41
41
  "dependencies": {
42
- "@reelout/core": "^0.14.1",
43
- "@reelout/github": "^0.9.1",
44
- "@reelout/npm": "^0.15.1",
42
+ "@reelout/core": "^0.15.0",
43
+ "@reelout/github": "^0.9.3",
44
+ "@reelout/npm": "^0.15.3",
45
45
  "consola": "^3.4.2"
46
46
  },
47
47
  "engines": {
package/src/yarn.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  } from '@reelout/core'
14
14
  import {
15
15
  bumpPackageDependencies,
16
+ describeYarnOidcVersionBlocker,
16
17
  hasPackageManifest,
17
18
  inspectVersionedPackageManager,
18
19
  isCompleteReleasePlan,
@@ -48,8 +49,10 @@ export interface PluginOptions {
48
49
  * no root `package.json` or the workspace is not managed by Yarn.
49
50
  * Otherwise resolves and attaches Git repository metadata from root
50
51
  * package configuration, then verifies registry authentication,
51
- * failing in strict mode or skipping the publish phase when no
52
- * credentials exist.
52
+ * failing with a version diagnosis in strict mode and warning
53
+ * otherwise when OIDC environment tokens exist but the Yarn release
54
+ * predates the trusted-publishing exchange, and failing in strict
55
+ * mode or skipping the publish phase when no credentials exist.
53
56
  * - `discover`: Skips discovery when the plugin is inactive. Discovers
54
57
  * workspace member packages, filters them against the `filter` patterns,
55
58
  * and loads package metadata into context.
@@ -113,9 +116,29 @@ const yarn = (options: PluginOptions = {}): ReleasePlugin => {
113
116
  const authKind = await verifyAuth(context, packageManager)
114
117
 
115
118
  if (authKind === 'none') {
119
+ const oidcVersionDiagnosis = describeYarnOidcVersionBlocker(
120
+ packageManager,
121
+ context.env
122
+ )
123
+
124
+ if (oidcVersionDiagnosis) {
125
+ if (context.strict) {
126
+ throw new Error(oidcVersionDiagnosis)
127
+ }
128
+
129
+ context.logger.warn(colors.yellow(oidcVersionDiagnosis))
130
+ }
131
+
132
+ // Yarn Berry reads registry credentials from ".yarnrc.yml" and
133
+ // Yarn Classic from ".npmrc", so the message names the file the
134
+ // active release family reads.
135
+ const ambientCredentialFile = packageManager.isYarnBerry
136
+ ? '(".yarnrc.yml")'
137
+ : '(".npmrc")'
138
+
116
139
  if (context.strict) {
117
140
  throw new Error(
118
- 'NPM_TOKEN is required for Yarn authentication in strict mode.'
141
+ `NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication in strict mode.`
119
142
  )
120
143
  }
121
144
 
@@ -123,7 +146,7 @@ const yarn = (options: PluginOptions = {}): ReleasePlugin => {
123
146
 
124
147
  context.logger.warn(
125
148
  colors.yellow(
126
- 'Packages will not be published: NPM_TOKEN is required for Yarn authentication.'
149
+ `Packages will not be published: NPM_TOKEN or ambient registry credentials ${ambientCredentialFile} are required for Yarn authentication.`
127
150
  )
128
151
  )
129
152
  }