@anolilab/semantic-release-pnpm 1.1.6 โ†’ 1.1.8

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 CHANGED
@@ -1,3 +1,20 @@
1
+ ## @anolilab/semantic-release-pnpm [1.1.8](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@1.1.7...@anolilab/semantic-release-pnpm@1.1.8) (2025-01-16)
2
+
3
+ ### Bug Fixes
4
+
5
+ * remove usage of aggregate-error library ([e0c6e95](https://github.com/anolilab/semantic-release/commit/e0c6e95b07416d6694fa192ddca96e17a4c1c4b8))
6
+
7
+ ## @anolilab/semantic-release-pnpm [1.1.7](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@1.1.6...@anolilab/semantic-release-pnpm@1.1.7) (2025-01-14)
8
+
9
+ ### Bug Fixes
10
+
11
+ * **rc:** updated @visulima/fs, @visulima/package and @visulima/path deps and all dev deps ([f65154a](https://github.com/anolilab/semantic-release/commit/f65154a74f2737f5f208523d8993d65583059333))
12
+
13
+
14
+ ### Dependencies
15
+
16
+ * **@anolilab/rc:** upgraded to 1.1.5
17
+
1
18
  ## @anolilab/semantic-release-pnpm [1.1.6](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@1.1.5...@anolilab/semantic-release-pnpm@1.1.6) (2024-12-15)
2
19
 
3
20
  ### Bug Fixes
package/README.md CHANGED
@@ -135,8 +135,8 @@ The [`registry`](https://docs.npmjs.com/misc/registry) and [`dist-tag`](https://
135
135
 
136
136
  **Notes**:
137
137
 
138
- - The presence of an `.npmrc` file will override any specified environment variables.
139
- - The presence of `registry` or `dist-tag` under `publishConfig` in the `package.json` will take precedence over the configuration in `.npmrc` and `NPM_CONFIG_REGISTRY`
138
+ - The presence of an `.npmrc` file will override any specified environment variables.
139
+ - The presence of `registry` or `dist-tag` under `publishConfig` in the `package.json` will take precedence over the configuration in `.npmrc` and `NPM_CONFIG_REGISTRY`
140
140
 
141
141
  ### Examples
142
142
 
@@ -197,8 +197,8 @@ When publishing from a sub-directory with the `pkgRoot` option, the `package.jso
197
197
 
198
198
  ## Related
199
199
 
200
- - [@semantic-release/npm](https://github.com/semantic-release/npm) - ๐Ÿšข semantic-release plugin to publish a npm package
201
- - [semantic-release-yarn](https://github.com/hongaar/semantic-release-yarn) - ๐Ÿงถ A semantic-release plugin to publish npm packages with Yarn. Comes with built-in support for monorepos.
200
+ - [@semantic-release/npm](https://github.com/semantic-release/npm) - ๐Ÿšข semantic-release plugin to publish a npm package
201
+ - [semantic-release-yarn](https://github.com/hongaar/semantic-release-yarn) - ๐Ÿงถ A semantic-release plugin to publish npm packages with Yarn. Comes with built-in support for monorepos.
202
202
 
203
203
  ## Supported Node.js Versions
204
204
 
@@ -213,8 +213,8 @@ If you would like to help take a look at the [list of issues](https://github.com
213
213
 
214
214
  ## Credits
215
215
 
216
- - [Daniel Bannert](https://github.com/prisis)
217
- - [All Contributors](https://github.com/anolilab/semantic-release/graphs/contributors)
216
+ - [Daniel Bannert](https://github.com/prisis)
217
+ - [All Contributors](https://github.com/anolilab/semantic-release/graphs/contributors)
218
218
 
219
219
  ## License
220
220
 
package/dist/index.mjs CHANGED
@@ -1,15 +1,657 @@
1
- var ee=Object.defineProperty;var o=(e,t)=>ee(e,"name",{value:t,configurable:!0});import{execa as y}from"execa";import{validRange as te,gte as ne}from"semver";import{isAccessibleSync as K,ensureFileSync as ie,move as se,writeFile as _}from"@visulima/fs";import{resolve as h}from"@visulima/path";import{rc as U}from"@anolilab/rc";import E from"normalize-url";import b from"aggregate-error";import{findPackageJson as re,getPackageManagerVersion as oe}from"@visulima/package";import ae from"@semantic-release/error";import{stringify as j}from"ini";import le from"registry-auth-token";import{URL as V}from"node:url";var ce=Object.defineProperty,pe=o((e,t)=>ce(e,"name",{value:t,configurable:!0}),"e$4");const H=pe(e=>e?te(e)?`release-${e}`:e:"latest","default");var ge=Object.defineProperty,me=o((e,t)=>ge(e,"name",{value:t,configurable:!0}),"s$4");const Y=me((e,t)=>{const n=h(e,".npmrc");return t.NPM_CONFIG_USERCONFIG&&K(t.NPM_CONFIG_USERCONFIG)?t.NPM_CONFIG_USERCONFIG:(K(n)||ie(n),n)},"getNpmrcPath"),W="https://registry.npmjs.org/";var ue=Object.defineProperty,z=o((e,t)=>ue(e,"name",{value:t,configurable:!0}),"s$3");const de=z((e,t)=>{let n=W;if(t){const i=t[`${e}:registry`]??t.registry;i&&(n=i)}return n.endsWith("/")?n:`${n}/`},"getRegistryUrl"),R=z(({name:e,publishConfig:{registry:t}={}},{cwd:n,env:i})=>t??i.NPM_CONFIG_REGISTRY??de(e.split("/")[0],U("npm",{config:i.NPM_CONFIG_USERCONFIG??h(n,".npmrc"),cwd:n,defaults:{registry:"https://registry.npmjs.org/"}}).config),"default");var fe=Object.defineProperty,he=o((e,t)=>fe(e,"name",{value:t,configurable:!0}),"r");const q=he(({name:e},{env:{DEFAULT_NPM_REGISTRY:t="https://registry.npmjs.org/"},nextRelease:{version:n}},i,r)=>({channel:i,name:`pnpm package (@${i} dist-tag)`,url:E(r)===E(t)?`https://www.npmjs.com/package/${e}/v/${n}`:void 0}),"getReleaseInfo");var be=Object.defineProperty,J=o((e,t)=>be(e,"name",{value:t,configurable:!0}),"o$4");const D=J((e,t)=>e.npmPublish===!1?"npmPublish plugin option is false":t.private===!0&&t.workspaces===void 0?"package is private and has no workspaces":null,"reasonToNotPublish"),S=J((e,t)=>D(e,t)===null,"shouldPublish");var ve=Object.defineProperty,ye=o((e,t)=>ve(e,"name",{value:t,configurable:!0}),"l$2");const Ne=ye(async(e,t,n)=>{const{cwd:i,env:r,logger:l,nextRelease:{channel:m,version:c},stderr:p,stdout:s}=n;if(S(e,t)){const a=R(t,n),d=H(m);l.log(`Adding version ${c} to npm registry on dist-tag ${d}`);const v=Y(i,r),u=y("pnpm",["dist-tag","add",`${t.name}@${c}`,d,"--userconfig",v,"--registry",a],{cwd:i,env:r,preferLocal:!0});return u.stdout.pipe(s,{end:!1}),u.stderr.pipe(p,{end:!1}),await u,l.log(`Added ${t.name}@${c} to dist-tag @${d} on ${a}`),q(t,n,d,a)}return l.log(`Skip adding to npm channel as ${D(e,t)}`),!1},"default");var Pe=Object.defineProperty,$e=o((e,t)=>Pe(e,"name",{value:t,configurable:!0}),"d$3");const Q=$e(async({pkgRoot:e,tarballDir:t},{cwd:n,env:i,logger:r,nextRelease:{version:l},stderr:m,stdout:c})=>{const p=e?h(n,e):n;r.log("Write version %s to package.json in %s",l,p);const s=y("pnpm",["version",l,"--no-git-tag-version","--allow-same-version"],{cwd:p,env:i,preferLocal:!0});if(s.stdout.pipe(c,{end:!1}),s.stderr.pipe(m,{end:!1}),await s,t){r.log("Creating npm package version %s",l);const a=y("pnpm",["pack",p],{cwd:n,env:i,preferLocal:!0});a.stdout.pipe(c,{end:!1}),a.stderr.pipe(m,{end:!1});const d=(await a).stdout.split(`
2
- `).pop(),v=h(n,d),u=h(n,t.trim(),d);v!==u&&await se(v,u)}},"default");var Ee=Object.defineProperty,we=o((e,t)=>Ee(e,"name",{value:t,configurable:!0}),"d$1");const ke=we(async(e,t,n)=>{const{cwd:i,env:r,logger:l,nextRelease:{channel:m,version:c},stderr:p,stdout:s}=n,{pkgRoot:a,publishBranch:d}=e;if(S(e,t)){const v=a?h(i,a):i,u=R(t,n),P=H(m),{stdout:L}=await y("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:i,env:r,preferLocal:!0}),C=typeof d=="string"&&d.split("|"),x=C&&C.includes(L)?L:"main";l.log(`Publishing version ${c} on branch ${x} to npm registry on dist-tag ${P}`);const G=["publish",v,"--publish-branch",x,"--tag",P,"--registry",u,"--no-git-checks"];e.disableScripts&&G.push("--ignore-scripts");const O=y("pnpm",G,{cwd:i,env:r,preferLocal:!0});O.stdout.pipe(s,{end:!1}),O.stderr.pipe(p,{end:!1});try{await O}catch(A){throw l.log(`Failed to publish ${t.name}@${c} to dist-tag @${P} on ${u}: ${A.message??A}`),new b([A])}return l.log(`Published ${t.name}@${c} to dist-tag @${P} on ${u}`),q(t,n,P,u)}return l.log(`Skip publishing to npm registry as ${D(e,t)}`),!1},"default"),Ie="@anolilab/semantic-release-pnpm",Oe="1.1.5",Ae="Semantic-release plugin to publish a npm package with pnpm.",_e=["anolilab","npm","pnpm","publish","monorepo","semantic-release","semantic-release-plugin","semantic-release-pnpm"],je="https://github.com/anolilab/semantic-release/tree/main/packages/semantic-release-pnpm",Me={url:"https://github.com/anolilab/semantic-release/issues"},Re={type:"git",url:"git+https://github.com/anolilab/semantic-release.git",directory:"packages/semantic-release-pnpm"},De=[{type:"github",url:"https://github.com/sponsors/prisis"},{type:"consulting",url:"https://anolilab.com/support"}],Se="MIT",Te={name:"Daniel Bannert",email:"d.bannert@anolilab.de"},Le=!1,Ce="module",xe="./dist/index.mjs",Ge="./dist/index.d.mts",Ke=["dist","README.md","CHANGELOG.md"],Ve={build:"cross-env NODE_ENV=development packem build","build:prod":"cross-env NODE_ENV=production packem build",clean:"rimraf node_modules dist .eslintcache",dev:"pnpm run build --watch","lint:attw":"attw --pack","lint:eslint":"eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs","lint:eslint:fix":"eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix","lint:package-json":"publint --strict","lint:prettier":"prettier --config=.prettierrc.cjs --check .","lint:prettier:fix":"prettier --config=.prettierrc.cjs --write .","lint:types":"tsc --noEmit",test:"vitest run","test:coverage":"vitest run --coverage","test:ui":"vitest --ui --coverage.enabled=true","test:watch":"vitest"},Be={"@anolilab/rc":"1.1.3","@semantic-release/error":"^4.0.0","@visulima/fs":"^2.3.1","@visulima/package":"^3.1.6","@visulima/path":"^1.1.2","aggregate-error":"^5.0.0",execa:"^9.5.2",ini:"^5.0.0","normalize-url":"^8.0.1","registry-auth-token":"^5.0.3",semver:"^7.6.3"},Fe={"@anolilab/eslint-config":"^15.0.3","@anolilab/prettier-config":"^5.0.14","@arethetypeswrong/cli":"^0.17.1","@babel/core":"^7.26.0","@rushstack/eslint-plugin-security":"^0.8.3","@secretlint/secretlint-rule-preset-recommend":"^9.0.0","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/exec":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/dockerode":"^3.3.32","@types/ini":"^4.1.1","@types/node":"18.19.68","@types/semantic-release__error":"3.0.3","@types/semver":"7.5.8","@types/stream-buffers":"^3.0.7","@visulima/packem":"^1.10.0","@vitest/coverage-v8":"^2.1.8","@vitest/ui":"^2.1.8","conventional-changelog-conventionalcommits":"8.0.0","cross-env":"^7.0.3",dockerode:"4.0.2",esbuild:"0.24.0",eslint:"^8.57.1","eslint-plugin-deprecation":"^3.0.0","eslint-plugin-editorconfig":"^4.0.3","eslint-plugin-import":"npm:eslint-plugin-i@2.29.1","eslint-plugin-mdx":"^3.1.5","eslint-plugin-n":"^17.15.0","eslint-plugin-vitest":"^0.4.1","eslint-plugin-vitest-globals":"^1.5.0","eslint-plugin-you-dont-need-lodash-underscore":"^6.14.0","get-stream":"9.0.1",got:"^14.4.5","p-retry":"^6.2.1",prettier:"^3.4.2",rimraf:"^6.0.1",secretlint:"9.0.0","semantic-release":"^24.2.0","sort-package-json":"^2.12.0","stream-buffers":"^3.0.3",tempy:"^3.1.0",typescript:"^5.7.2",vitest:"^2.1.8"},Ue={node:">=18.* <=23.*"},He={access:"public",provenance:!0},Ye={"eslint-config":{plugin:{etc:!1,tsdoc:!1},warn_on_unsupported_typescript_version:!1,info_on_disabling_jsx_react_rule:!1,info_on_disabling_prettier_conflict_rule:!1,info_on_disabling_jsonc_sort_keys_rule:!1,import_ignore_exports:["**/*.cjs"]}},We={name:Ie,version:Oe,description:Ae,keywords:_e,homepage:je,bugs:Me,repository:Re,funding:De,license:Se,author:Te,sideEffects:Le,type:Ce,main:xe,types:Ge,files:Ke,scripts:Ve,dependencies:Be,devDependencies:Fe,engines:Ue,publishConfig:He,anolilab:Ye};var ze=Object.defineProperty,g=o((e,t)=>ze(e,"name",{value:t,configurable:!0}),"e$3");const f=g(e=>We.homepage+"/blob/main/"+e,"linkify"),qe={EINVALIDBRANCHES:g(e=>({details:`The [branches option](${f("README.md#branches")}) option, if defined, must be an array of \`String\`.
3
- Your configuration for the \`branches\` option is \`${e.join(",")}\`.`,message:"Invalid `branches` option."}),"EINVALIDBRANCHES"),EINVALIDNPMPUBLISH:g(({npmPublish:e})=>({details:`The [npmPublish option](${f("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
4
- Your configuration for the \`npmPublish\` option is \`${String(e)}\`.`,message:"Invalid `npmPublish` option."}),"EINVALIDNPMPUBLISH"),EINVALIDNPMTOKEN:g(({registry:e})=>({details:`The [npm token](${f("README.md#npm-registry-authentication")}) configured in the \`NPM_TOKEN\` environment variable must be a valid [token](https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry \`${String(e)}\`.
1
+ import { execa } from 'execa';
2
+ import { validRange, gte } from 'semver';
3
+ import { isAccessibleSync, ensureFileSync, move, writeFile } from '@visulima/fs';
4
+ import { resolve } from '@visulima/path';
5
+ import { rc } from '@anolilab/rc';
6
+ import normalizeUrl from 'normalize-url';
7
+ import { findPackageJson, getPackageManagerVersion } from '@visulima/package';
8
+ import SemanticReleaseError from '@semantic-release/error';
9
+ import { stringify } from 'ini';
10
+ import getAuthToken from 'registry-auth-token';
11
+ import { URL } from 'node:url';
12
+
13
+ var __defProp$h = Object.defineProperty;
14
+ var __name$h = (target, value) => __defProp$h(target, "name", { value, configurable: true });
15
+ const getChannel = /* @__PURE__ */ __name$h((channel) => channel ? validRange(channel) ? `release-${channel}` : channel : "latest", "default");
16
+
17
+ var __defProp$g = Object.defineProperty;
18
+ var __name$g = (target, value) => __defProp$g(target, "name", { value, configurable: true });
19
+ const getNpmrcPath = /* @__PURE__ */ __name$g((cwd, environment) => {
20
+ const npmrcPath = resolve(cwd, ".npmrc");
21
+ if (environment.NPM_CONFIG_USERCONFIG && isAccessibleSync(environment.NPM_CONFIG_USERCONFIG)) {
22
+ return environment.NPM_CONFIG_USERCONFIG;
23
+ }
24
+ if (isAccessibleSync(npmrcPath)) {
25
+ return npmrcPath;
26
+ }
27
+ ensureFileSync(npmrcPath);
28
+ return npmrcPath;
29
+ }, "getNpmrcPath");
30
+
31
+ const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/";
32
+
33
+ var __defProp$f = Object.defineProperty;
34
+ var __name$f = (target, value) => __defProp$f(target, "name", { value, configurable: true });
35
+ const getRegistryUrl = /* @__PURE__ */ __name$f((scope, npmrc) => {
36
+ let url = DEFAULT_NPM_REGISTRY;
37
+ if (npmrc) {
38
+ const registryUrl = npmrc[`${scope}:registry`] ?? npmrc.registry;
39
+ if (registryUrl) {
40
+ url = registryUrl;
41
+ }
42
+ }
43
+ return url.endsWith("/") ? url : `${url}/`;
44
+ }, "getRegistryUrl");
45
+ const getRegistry = /* @__PURE__ */ __name$f(({ name, publishConfig: { registry } = {} }, { cwd, env }) => registry ?? env.NPM_CONFIG_REGISTRY ?? getRegistryUrl(
46
+ name.split("/")[0],
47
+ rc("npm", {
48
+ config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc"),
49
+ cwd,
50
+ defaults: { registry: "https://registry.npmjs.org/" }
51
+ }).config
52
+ ), "default");
53
+
54
+ var __defProp$e = Object.defineProperty;
55
+ var __name$e = (target, value) => __defProp$e(target, "name", { value, configurable: true });
56
+ const getReleaseInfo = /* @__PURE__ */ __name$e(({ name }, { env: { DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/" }, nextRelease: { version } }, distributionTag, registry) => {
57
+ return {
58
+ channel: distributionTag,
59
+ name: `pnpm package (@${distributionTag} dist-tag)`,
60
+ url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY) ? `https://www.npmjs.com/package/${name}/v/${version}` : undefined
61
+ };
62
+ }, "getReleaseInfo");
63
+
64
+ var __defProp$d = Object.defineProperty;
65
+ var __name$d = (target, value) => __defProp$d(target, "name", { value, configurable: true });
66
+ const reasonToNotPublish = /* @__PURE__ */ __name$d((pluginConfig, package_) => pluginConfig.npmPublish === false ? "npmPublish plugin option is false" : package_.private === true && package_.workspaces === undefined ? "package is private and has no workspaces" : null, "reasonToNotPublish");
67
+ const shouldPublish = /* @__PURE__ */ __name$d((pluginConfig, package_) => reasonToNotPublish(pluginConfig, package_) === null, "shouldPublish");
68
+
69
+ var __defProp$c = Object.defineProperty;
70
+ var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
71
+ const addChannelNpm = /* @__PURE__ */ __name$c(async (pluginConfig, packageJson, context) => {
72
+ const {
73
+ cwd,
74
+ env,
75
+ logger,
76
+ nextRelease: { channel, version },
77
+ stderr,
78
+ stdout
79
+ } = context;
80
+ if (shouldPublish(pluginConfig, packageJson)) {
81
+ const registry = getRegistry(packageJson, context);
82
+ const distributionTag = getChannel(channel);
83
+ logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);
84
+ const npmrc = getNpmrcPath(cwd, env);
85
+ const result = execa("pnpm", ["dist-tag", "add", `${packageJson.name}@${version}`, distributionTag, "--userconfig", npmrc, "--registry", registry], {
86
+ cwd,
87
+ env,
88
+ preferLocal: true
89
+ });
90
+ result.stdout.pipe(stdout, { end: false });
91
+ result.stderr.pipe(stderr, { end: false });
92
+ await result;
93
+ logger.log(`Added ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
94
+ return getReleaseInfo(packageJson, context, distributionTag, registry);
95
+ }
96
+ logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson)}`);
97
+ return false;
98
+ }, "default");
99
+
100
+ var __defProp$b = Object.defineProperty;
101
+ var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
102
+ const prepareNpm = /* @__PURE__ */ __name$b(async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextRelease: { version }, stderr, stdout }) => {
103
+ const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
104
+ logger.log("Write version %s to package.json in %s", version, basePath);
105
+ const versionResult = execa("pnpm", ["version", version, "--no-git-tag-version", "--allow-same-version"], {
106
+ cwd: basePath,
107
+ env,
108
+ preferLocal: true
109
+ });
110
+ versionResult.stdout.pipe(stdout, { end: false });
111
+ versionResult.stderr.pipe(stderr, { end: false });
112
+ await versionResult;
113
+ if (tarballDir) {
114
+ logger.log("Creating npm package version %s", version);
115
+ const packResult = execa("pnpm", ["pack", basePath], { cwd, env, preferLocal: true });
116
+ packResult.stdout.pipe(stdout, { end: false });
117
+ packResult.stderr.pipe(stderr, { end: false });
118
+ const tarball = (await packResult).stdout.split("\n").pop();
119
+ const tarballSource = resolve(cwd, tarball);
120
+ const tarballDestination = resolve(cwd, tarballDir.trim(), tarball);
121
+ if (tarballSource !== tarballDestination) {
122
+ await move(tarballSource, tarballDestination);
123
+ }
124
+ }
125
+ }, "default");
126
+
127
+ var __defProp$a = Object.defineProperty;
128
+ var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
129
+ const publishNpm = /* @__PURE__ */ __name$a(async (pluginConfig, packageJson, context) => {
130
+ const {
131
+ cwd,
132
+ env,
133
+ logger,
134
+ nextRelease: { channel, version },
135
+ stderr,
136
+ stdout
137
+ } = context;
138
+ const { pkgRoot, publishBranch: publishBranchConfig } = pluginConfig;
139
+ if (shouldPublish(pluginConfig, packageJson)) {
140
+ const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
141
+ const registry = getRegistry(packageJson, context);
142
+ const distributionTag = getChannel(channel);
143
+ const { stdout: currentBranch } = await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
144
+ cwd,
145
+ env,
146
+ preferLocal: true
147
+ });
148
+ const publishBranches = typeof publishBranchConfig === "string" && publishBranchConfig.split("|");
149
+ const isPublishBranch = publishBranches && publishBranches.includes(currentBranch);
150
+ const publishBranch = isPublishBranch ? currentBranch : "main";
151
+ logger.log(`Publishing version ${version} on branch ${publishBranch} to npm registry on dist-tag ${distributionTag}`);
152
+ const pnpmArguments = ["publish", basePath, "--publish-branch", publishBranch, "--tag", distributionTag, "--registry", registry, "--no-git-checks"];
153
+ if (pluginConfig.disableScripts) {
154
+ pnpmArguments.push("--ignore-scripts");
155
+ }
156
+ const result = execa("pnpm", pnpmArguments, {
157
+ cwd,
158
+ env,
159
+ preferLocal: true
160
+ });
161
+ result.stdout.pipe(stdout, { end: false });
162
+ result.stderr.pipe(stderr, { end: false });
163
+ try {
164
+ await result;
165
+ } catch (error) {
166
+ logger.log(`Failed to publish ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}: ${error.message ?? error}`);
167
+ throw new AggregateError([error], error.message);
168
+ }
169
+ logger.log(`Published ${packageJson.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
170
+ return getReleaseInfo(packageJson, context, distributionTag, registry);
171
+ }
172
+ logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson)}`);
173
+ return false;
174
+ }, "default");
175
+
176
+ const name = "@anolilab/semantic-release-pnpm";
177
+ const version = "1.1.7";
178
+ const description = "Semantic-release plugin to publish a npm package with pnpm.";
179
+ const keywords = [
180
+ "anolilab",
181
+ "npm",
182
+ "pnpm",
183
+ "publish",
184
+ "monorepo",
185
+ "semantic-release",
186
+ "semantic-release-plugin",
187
+ "semantic-release-pnpm"
188
+ ];
189
+ const homepage = "https://github.com/anolilab/semantic-release/tree/main/packages/semantic-release-pnpm";
190
+ const bugs = {
191
+ url: "https://github.com/anolilab/semantic-release/issues"
192
+ };
193
+ const repository = {
194
+ type: "git",
195
+ url: "git+https://github.com/anolilab/semantic-release.git",
196
+ directory: "packages/semantic-release-pnpm"
197
+ };
198
+ const funding = [
199
+ {
200
+ type: "github",
201
+ url: "https://github.com/sponsors/prisis"
202
+ },
203
+ {
204
+ type: "consulting",
205
+ url: "https://anolilab.com/support"
206
+ }
207
+ ];
208
+ const license = "MIT";
209
+ const author = {
210
+ name: "Daniel Bannert",
211
+ email: "d.bannert@anolilab.de"
212
+ };
213
+ const sideEffects = false;
214
+ const type = "module";
215
+ const main = "./dist/index.mjs";
216
+ const types = "./dist/index.d.mts";
217
+ const files = [
218
+ "dist",
219
+ "README.md",
220
+ "CHANGELOG.md"
221
+ ];
222
+ const scripts = {
223
+ build: "cross-env NODE_ENV=development packem build",
224
+ "build:prod": "cross-env NODE_ENV=production packem build",
225
+ clean: "rimraf node_modules dist .eslintcache",
226
+ dev: "pnpm run build --watch",
227
+ "lint:attw": "attw --pack",
228
+ "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
229
+ "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
230
+ "lint:package-json": "publint --strict",
231
+ "lint:prettier": "prettier --config=.prettierrc.cjs --check .",
232
+ "lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
233
+ "lint:types": "tsc --noEmit",
234
+ test: "vitest run",
235
+ "test:coverage": "vitest run --coverage",
236
+ "test:ui": "vitest --ui --coverage.enabled=true",
237
+ "test:watch": "vitest"
238
+ };
239
+ const dependencies = {
240
+ "@anolilab/rc": "1.1.5",
241
+ "@semantic-release/error": "^4.0.0",
242
+ "@visulima/fs": "^2.3.7",
243
+ "@visulima/package": "^3.4.4",
244
+ "@visulima/path": "^1.3.3",
245
+ execa: "^9.5.2",
246
+ ini: "^5.0.0",
247
+ "normalize-url": "^8.0.1",
248
+ "registry-auth-token": "^5.0.3",
249
+ semver: "^7.6.3"
250
+ };
251
+ const devDependencies = {
252
+ "@anolilab/eslint-config": "^15.0.3",
253
+ "@anolilab/prettier-config": "^5.0.14",
254
+ "@arethetypeswrong/cli": "^0.17.3",
255
+ "@babel/core": "^7.26.0",
256
+ "@rushstack/eslint-plugin-security": "^0.8.3",
257
+ "@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
258
+ "@semantic-release/changelog": "^6.0.3",
259
+ "@semantic-release/commit-analyzer": "13.0.1",
260
+ "@semantic-release/exec": "^6.0.3",
261
+ "@semantic-release/git": "^10.0.1",
262
+ "@semantic-release/github": "^11.0.1",
263
+ "@semantic-release/release-notes-generator": "14.0.3",
264
+ "@types/dockerode": "^3.3.34",
265
+ "@types/ini": "^4.1.1",
266
+ "@types/node": "18.19.68",
267
+ "@types/semantic-release__error": "3.0.3",
268
+ "@types/semver": "7.5.8",
269
+ "@types/stream-buffers": "^3.0.7",
270
+ "@visulima/packem": "^1.11.0",
271
+ "@vitest/coverage-v8": "^2.1.8",
272
+ "@vitest/ui": "^2.1.8",
273
+ "conventional-changelog-conventionalcommits": "8.0.0",
274
+ "cross-env": "^7.0.3",
275
+ dockerode: "4.0.3",
276
+ esbuild: "0.24.2",
277
+ eslint: "^8.57.1",
278
+ "eslint-plugin-deprecation": "^3.0.0",
279
+ "eslint-plugin-editorconfig": "^4.0.3",
280
+ "eslint-plugin-import": "npm:eslint-plugin-i@2.29.1",
281
+ "eslint-plugin-mdx": "^3.1.5",
282
+ "eslint-plugin-n": "^17.15.1",
283
+ "eslint-plugin-vitest": "^0.4.1",
284
+ "eslint-plugin-vitest-globals": "^1.5.0",
285
+ "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
286
+ "get-stream": "9.0.1",
287
+ got: "^14.4.5",
288
+ "p-retry": "^6.2.1",
289
+ prettier: "^3.4.2",
290
+ rimraf: "^6.0.1",
291
+ secretlint: "9.0.0",
292
+ "semantic-release": "^24.2.1",
293
+ "sort-package-json": "^2.13.0",
294
+ "stream-buffers": "^3.0.3",
295
+ tempy: "^3.1.0",
296
+ typescript: "^5.7.3",
297
+ vitest: "^2.1.8"
298
+ };
299
+ const engines = {
300
+ node: ">=18.* <=23.*"
301
+ };
302
+ const publishConfig = {
303
+ access: "public",
304
+ provenance: true
305
+ };
306
+ const anolilab = {
307
+ "eslint-config": {
308
+ plugin: {
309
+ etc: false,
310
+ tsdoc: false
311
+ },
312
+ warn_on_unsupported_typescript_version: false,
313
+ info_on_disabling_jsx_react_rule: false,
314
+ info_on_disabling_prettier_conflict_rule: false,
315
+ info_on_disabling_jsonc_sort_keys_rule: false,
316
+ import_ignore_exports: [
317
+ "**/*.cjs"
318
+ ]
319
+ }
320
+ };
321
+ const packageJson = {
322
+ name: name,
323
+ version: version,
324
+ description: description,
325
+ keywords: keywords,
326
+ homepage: homepage,
327
+ bugs: bugs,
328
+ repository: repository,
329
+ funding: funding,
330
+ license: license,
331
+ author: author,
332
+ sideEffects: sideEffects,
333
+ type: type,
334
+ main: main,
335
+ types: types,
336
+ files: files,
337
+ scripts: scripts,
338
+ dependencies: dependencies,
339
+ devDependencies: devDependencies,
340
+ engines: engines,
341
+ publishConfig: publishConfig,
342
+ anolilab: anolilab
343
+ };
344
+
345
+ var __defProp$9 = Object.defineProperty;
346
+ var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
347
+ const linkify = /* @__PURE__ */ __name$9((file) => packageJson.homepage + "/blob/main/" + file, "linkify");
348
+ const errors = {
349
+ EINVALIDBRANCHES: /* @__PURE__ */ __name$9((branches) => {
350
+ return {
351
+ details: `The [branches option](${linkify("README.md#branches")}) option, if defined, must be an array of \`String\`.
352
+ Your configuration for the \`branches\` option is \`${branches.join(",")}\`.`,
353
+ message: "Invalid `branches` option."
354
+ };
355
+ }, "EINVALIDBRANCHES"),
356
+ EINVALIDNPMPUBLISH: /* @__PURE__ */ __name$9(({ npmPublish }) => {
357
+ return {
358
+ details: `The [npmPublish option](${linkify("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
359
+ Your configuration for the \`npmPublish\` option is \`${String(npmPublish)}\`.`,
360
+ message: "Invalid `npmPublish` option."
361
+ };
362
+ }, "EINVALIDNPMPUBLISH"),
363
+ EINVALIDNPMTOKEN: /* @__PURE__ */ __name$9(({ registry }) => {
364
+ return {
365
+ details: `The [npm token](${linkify(
366
+ "README.md#npm-registry-authentication"
367
+ )}) configured in the \`NPM_TOKEN\` environment variable must be a valid [token](https://docs.npmjs.com/getting-started/working_with_tokens) allowing to publish to the registry \`${String(registry)}\`.
5
368
  If you are using Two Factor Authentication for your account, set its level to ["Authorization only"](https://docs.npmjs.com/getting-started/using-two-factor-authentication#levels-of-authentication) in your account settings. **semantic-release** cannot publish with the default "Authorization and writes" level.
6
- Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with the exact value of the npm token.`,message:"Invalid npm token."}),"EINVALIDNPMTOKEN"),EINVALIDPKGROOT:g(({pkgRoot:e})=>({details:`The [pkgRoot option](${f("README.md#pkgroot")}) option, if defined, must be a \`String\`.
7
- Your configuration for the \`pkgRoot\` option is \`${String(e)}\`.`,message:"Invalid `pkgRoot` option."}),"EINVALIDPKGROOT"),EINVALIDPNPM:g(({version:e})=>({details:`The version of Pnpm that you are using is not compatible. Please refer to [the README](${f("README.md#install")}) to review which versions of Pnpm are currently supported
8
-
9
- Your version of Pnpm is "${String(e)}".`,message:"Incompatible Pnpm version detected."}),"EINVALIDPNPM"),EINVALIDPUBLISHBRANCH:g(({publishBranch:e})=>({details:`The [publishBranch option](${f("README.md#publishBranch")}) option, if defined, must be a \`String\`.
10
- Your configuration for the \`publishBranch\` option is \`${String(e)}\`.`,message:"Invalid `publishBranch` option."}),"EINVALIDPUBLISHBRANCH"),EINVALIDTARBALLDIR:g(({tarballDir:e})=>({details:`The [tarballDir option](${f("README.md#tarballdir")}) option, if defined, must be a \`String\`.
11
- Your configuration for the \`tarballDir\` option is \`${String(e)}\`.`,message:"Invalid `tarballDir` option."}),"EINVALIDTARBALLDIR"),ENONPMTOKEN:g(({registry:e})=>({details:`An [npm token](${f("README.md#npm-registry-authentication")}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
12
- Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and to set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow to publish to the registry \`${String(e)}\`.`,message:"No npm token specified."}),"ENONPMTOKEN"),ENOPKG:g(()=>({details:"A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.\nPlease follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid `package.json` file.",message:"Missing `package.json` file."}),"ENOPKG"),ENOPKGNAME:g(()=>({details:"The `package.json`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry.\nPlease make sure to add a valid `name` for your package in your `package.json`.",message:"Missing `name` property in `package.json`."}),"ENOPKGNAME"),ENOPNPM:g(()=>({details:"The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.",message:"Pnpm not found."}),"ENOPNPM"),ENOPNPMRC:g(()=>({details:"Didnt find a `.npmrc` file or it was not possible to create , in the root of your project.",message:"Missing `.npmrc` file."}),"ENOPNPMRC")};var Je=Object.defineProperty,Qe=o((e,t)=>Je(e,"name",{value:t,configurable:!0}),"o$2");const N=Qe((e,t={})=>{const{details:n,message:i}=qe[e](t);return new ae(i,e,n)},"default");var Xe=Object.defineProperty,Ze=o((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"e$2");const T=Ze(async({pkgRoot:e},{cwd:t})=>{try{const{packageJson:n}=await re(e?h(t,e):t);if(!n.name)throw new b([N("ENOPKGNAME")]);return n}catch(n){throw n.code==="ENOENT"?new b([N("ENOPKG")]):n}},"default");var et=Object.defineProperty,tt=o((e,t)=>et(e,"name",{value:t,configurable:!0}),"n$2");const nt=tt(e=>{const t=new V(e),n=`${t.protocol}//${t.host}${t.pathname}`,i=new V(".",n);return`//${i.host}${i.pathname}`},"nerfDart");var it=Object.defineProperty,st=o((e,t)=>it(e,"name",{value:t,configurable:!0}),"a$2");const rt=st(async(e,t,{cwd:n,env:{NPM_CONFIG_USERCONFIG:i,NPM_EMAIL:r,NPM_PASSWORD:l,NPM_TOKEN:m,NPM_USERNAME:c},logger:p})=>{p.log("Verify authentication for registry %s",t);const{config:s,files:a}=U("npm",{config:i??h(n,".npmrc"),cwd:n,defaults:{registry:W}});if(Array.isArray(a)&&p.log("Reading npm config from %s",a.join(", ")),le(t,{npmrc:s})){await _(e,j(s));return}if(c&&l&&r)await _(e,`${Object.keys(s).length>0?`${j(s)}
13
- `:""}_auth = \${LEGACY_TOKEN}
14
- email = \${NPM_EMAIL}`),p.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${e}`);else if(m)await _(e,`${Object.keys(s).length>0?`${j(s)}
15
- `:""}${nt(t)}:_authToken = \${NPM_TOKEN}`),p.log(`Wrote NPM_TOKEN to ${e}`);else throw new b([N("ENONPMTOKEN",{registry:t})])},"default");var ot=Object.defineProperty,at=o((e,t)=>ot(e,"name",{value:t,configurable:!0}),"m$1");const lt=at(async(e,t,n)=>{const{cwd:i,env:{DEFAULT_NPM_REGISTRY:r="https://registry.npmjs.org/",...l},logger:m,stderr:c,stdout:p}=n,s=R(t,n);if(await rt(e,s,n),E(s)===E(r))try{m.log(`Running "pnpm whoami" to verify authentication on registry "${s}"`);const a=y("pnpm",["whoami","--userconfig",e,"--registry",s],{cwd:i,env:l,preferLocal:!0});a.stdout.pipe(p,{end:!1}),a.stderr.pipe(c,{end:!1}),await a}catch{throw new b([N("EINVALIDNPMTOKEN",{registry:s})])}else m.log(`Skipping authentication verification for non-default registry "${s}"`)},"default");var ct=Object.defineProperty,$=o((e,t)=>ct(e,"name",{value:t,configurable:!0}),"e$1");const pt=$(e=>typeof e=="string","isString"),gt=$(e=>e==null,"isNil"),M=$(e=>pt(e)?e.trim()!=="":!1,"isNonEmptyString"),B={branches:Array.isArray,npmPublish:$(e=>typeof e=="boolean","npmPublish"),pkgRoot:M,publishBranch:M,tarballDir:M},mt=$(e=>Object.entries(e).reduce((t,[n,i])=>gt(i)||!(n in B)||B[n]?.(i)?t:[...t,N(`EINVALID${n.toUpperCase()}`,{[n]:i})],[]),"default");var ut=Object.defineProperty,dt=o((e,t)=>ut(e,"name",{value:t,configurable:!0}),"t$1");const F="8.0.0";async function X({logger:e}){e.log(`Verify pnpm version is >= ${F}`);const t=oe("pnpm");if(ne(F,t))throw new b([N("EINVALIDPNPM",{version:String(t)})])}o(X,"g");dt(X,"verifyPnpm");var ft=Object.defineProperty,ht=o((e,t)=>ft(e,"name",{value:t,configurable:!0}),"n");const w=ht(async(e,t)=>{let n=mt(e);try{await X(t)}catch(i){const r=i;n=[...n,...r.errors??[i]]}try{const i=await T(e,t);if(S(e,i)){const r=Y(t.cwd,t.env);await lt(r,i,t)}}catch(i){const r=i;n=[...n,...r.errors??[i]]}if(n.length>0)throw new b(n)},"verify");var bt=Object.defineProperty,k=o((e,t)=>bt(e,"name",{value:t,configurable:!0}),"t");const vt="semantic-release-pnpm";let I,Z;const Rt=k(async(e,t)=>{if(t.options.publish){const n=(Array.isArray(t.options.publish)?t.options.publish:[t.options.publish]).find(i=>i.path&&i.path===vt)||{};e.npmPublish=e.npmPublish??n.npmPublish,e.tarballDir=e.tarballDir??n.tarballDir,e.pkgRoot=e.pkgRoot??n.pkgRoot,e.disableScripts=e.disableScripts??n.disableScripts,e.branches=e.branches??n.branches}await w(e,t),I=!0},"verifyConditions"),Dt=k(async(e,t)=>{I||await w(e,t),await Q(e,t),Z=!0},"prepare"),St=k(async(e,t)=>{const n=await T(e,t);return I||await w(e,t),Z||await Q(e,t),await ke(e,n,t)},"publish"),Tt=k(async(e,t)=>{I||await w(e,t);const n=await T(e,t);return await Ne(e,n,t)},"addChannel");export{Tt as addChannel,Dt as prepare,St as publish,Rt as verifyConditions};
369
+ Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with the exact value of the npm token.`,
370
+ message: "Invalid npm token."
371
+ };
372
+ }, "EINVALIDNPMTOKEN"),
373
+ EINVALIDPKGROOT: /* @__PURE__ */ __name$9(({ pkgRoot }) => {
374
+ return {
375
+ details: `The [pkgRoot option](${linkify("README.md#pkgroot")}) option, if defined, must be a \`String\`.
376
+ Your configuration for the \`pkgRoot\` option is \`${String(pkgRoot)}\`.`,
377
+ message: "Invalid `pkgRoot` option."
378
+ };
379
+ }, "EINVALIDPKGROOT"),
380
+ EINVALIDPNPM: /* @__PURE__ */ __name$9(({ version }) => {
381
+ return {
382
+ details: `The version of Pnpm that you are using is not compatible. Please refer to [the README](${linkify(
383
+ "README.md#install"
384
+ )}) to review which versions of Pnpm are currently supported
385
+
386
+ Your version of Pnpm is "${String(version)}".`,
387
+ message: "Incompatible Pnpm version detected."
388
+ };
389
+ }, "EINVALIDPNPM"),
390
+ EINVALIDPUBLISHBRANCH: /* @__PURE__ */ __name$9(({ publishBranch }) => {
391
+ return {
392
+ details: `The [publishBranch option](${linkify("README.md#publishBranch")}) option, if defined, must be a \`String\`.
393
+ Your configuration for the \`publishBranch\` option is \`${String(publishBranch)}\`.`,
394
+ message: "Invalid `publishBranch` option."
395
+ };
396
+ }, "EINVALIDPUBLISHBRANCH"),
397
+ EINVALIDTARBALLDIR: /* @__PURE__ */ __name$9(({ tarballDir }) => {
398
+ return {
399
+ details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
400
+ Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
401
+ message: "Invalid `tarballDir` option."
402
+ };
403
+ }, "EINVALIDTARBALLDIR"),
404
+ ENONPMTOKEN: /* @__PURE__ */ __name$9(({ registry }) => {
405
+ return {
406
+ details: `An [npm token](${linkify(
407
+ "README.md#npm-registry-authentication"
408
+ )}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
409
+ Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and to set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow to publish to the registry \`${String(registry)}\`.`,
410
+ message: "No npm token specified."
411
+ };
412
+ }, "ENONPMTOKEN"),
413
+ ENOPKG: /* @__PURE__ */ __name$9(() => {
414
+ return {
415
+ details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.
416
+ Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
417
+ message: "Missing `package.json` file."
418
+ };
419
+ }, "ENOPKG"),
420
+ ENOPKGNAME: /* @__PURE__ */ __name$9(() => {
421
+ return {
422
+ details: `The \`package.json\`'s [name](https://docs.npmjs.com/files/package.json#name) property is required in order to publish a package to the npm registry.
423
+ Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
424
+ message: "Missing `name` property in `package.json`."
425
+ };
426
+ }, "ENOPKGNAME"),
427
+ ENOPNPM: /* @__PURE__ */ __name$9(() => {
428
+ return {
429
+ details: `The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.`,
430
+ message: "Pnpm not found."
431
+ };
432
+ }, "ENOPNPM"),
433
+ ENOPNPMRC: /* @__PURE__ */ __name$9(() => {
434
+ return {
435
+ details: `Didnt find a \`.npmrc\` file or it was not possible to create , in the root of your project.`,
436
+ message: "Missing `.npmrc` file."
437
+ };
438
+ }, "ENOPNPMRC")
439
+ };
440
+
441
+ var __defProp$8 = Object.defineProperty;
442
+ var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
443
+ const getError = /* @__PURE__ */ __name$8((code, context = {}) => {
444
+ const { details, message } = errors[code](context);
445
+ return new SemanticReleaseError(message, code, details);
446
+ }, "default");
447
+
448
+ var __defProp$7 = Object.defineProperty;
449
+ var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
450
+ const getPackage = /* @__PURE__ */ __name$7(async ({ pkgRoot }, { cwd }) => {
451
+ try {
452
+ const { packageJson } = await findPackageJson(pkgRoot ? resolve(cwd, pkgRoot) : cwd);
453
+ if (!packageJson.name) {
454
+ const semanticError = getError("ENOPKGNAME");
455
+ throw new AggregateError([semanticError], semanticError.message);
456
+ }
457
+ return packageJson;
458
+ } catch (error) {
459
+ if (error.code === "ENOENT") {
460
+ const semanticError = getError("ENOPKG");
461
+ throw new AggregateError([semanticError], semanticError.message);
462
+ }
463
+ throw error;
464
+ }
465
+ }, "default");
466
+
467
+ var __defProp$6 = Object.defineProperty;
468
+ var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
469
+ const nerfDart = /* @__PURE__ */ __name$6((url) => {
470
+ const parsed = new URL(url);
471
+ const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
472
+ const real = new URL(".", from);
473
+ return `//${real.host}${real.pathname}`;
474
+ }, "nerfDart");
475
+
476
+ var __defProp$5 = Object.defineProperty;
477
+ var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
478
+ const setNpmrcAuth = /* @__PURE__ */ __name$5(async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }) => {
479
+ logger.log("Verify authentication for registry %s", registry);
480
+ const { config, files } = rc("npm", {
481
+ config: NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc"),
482
+ cwd,
483
+ defaults: { registry: DEFAULT_NPM_REGISTRY }
484
+ });
485
+ if (Array.isArray(files)) {
486
+ logger.log("Reading npm config from %s", files.join(", "));
487
+ }
488
+ if (getAuthToken(registry, { npmrc: config })) {
489
+ await writeFile(npmrc, stringify(config));
490
+ return;
491
+ }
492
+ if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {
493
+ await writeFile(npmrc, `${Object.keys(config).length > 0 ? `${stringify(config)}
494
+ ` : ""}_auth = \${LEGACY_TOKEN}
495
+ email = \${NPM_EMAIL}`);
496
+ logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${npmrc}`);
497
+ } else if (NPM_TOKEN) {
498
+ await writeFile(npmrc, `${Object.keys(config).length > 0 ? `${stringify(config)}
499
+ ` : ""}${nerfDart(registry)}:_authToken = \${NPM_TOKEN}`);
500
+ logger.log(`Wrote NPM_TOKEN to ${npmrc}`);
501
+ } else {
502
+ const semanticError = getError("ENONPMTOKEN", { registry });
503
+ throw new AggregateError([semanticError], semanticError.message);
504
+ }
505
+ }, "default");
506
+
507
+ var __defProp$4 = Object.defineProperty;
508
+ var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
509
+ const verifyAuth = /* @__PURE__ */ __name$4(async (npmrc, package_, context) => {
510
+ const {
511
+ cwd,
512
+ env: { DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/", ...environment },
513
+ logger,
514
+ stderr,
515
+ stdout
516
+ } = context;
517
+ const registry = getRegistry(package_, context);
518
+ await setNpmrcAuth(npmrc, registry, context);
519
+ if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
520
+ try {
521
+ logger.log(`Running "pnpm whoami" to verify authentication on registry "${registry}"`);
522
+ const whoamiResult = execa("pnpm", ["whoami", "--userconfig", npmrc, "--registry", registry], {
523
+ cwd,
524
+ env: environment,
525
+ preferLocal: true
526
+ });
527
+ whoamiResult.stdout.pipe(stdout, { end: false });
528
+ whoamiResult.stderr.pipe(stderr, { end: false });
529
+ await whoamiResult;
530
+ } catch {
531
+ const semanticError = getError("EINVALIDNPMTOKEN", { registry });
532
+ throw new AggregateError([semanticError], semanticError.message);
533
+ }
534
+ } else {
535
+ logger.log(`Skipping authentication verification for non-default registry "${registry}"`);
536
+ }
537
+ }, "default");
538
+
539
+ var __defProp$3 = Object.defineProperty;
540
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
541
+ const isString = /* @__PURE__ */ __name$3((value) => typeof value === "string", "isString");
542
+ const isNil = /* @__PURE__ */ __name$3((value) => value === null || value === undefined, "isNil");
543
+ const isNonEmptyString = /* @__PURE__ */ __name$3((value) => {
544
+ if (!isString(value)) {
545
+ return false;
546
+ }
547
+ return value.trim() !== "";
548
+ }, "isNonEmptyString");
549
+ const VALIDATORS = {
550
+ branches: Array.isArray,
551
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
552
+ npmPublish: /* @__PURE__ */ __name$3((value) => typeof value === "boolean", "npmPublish"),
553
+ pkgRoot: isNonEmptyString,
554
+ publishBranch: isNonEmptyString,
555
+ tarballDir: isNonEmptyString
556
+ };
557
+ const verifyConfig = /* @__PURE__ */ __name$3((config) => (
558
+ // eslint-disable-next-line unicorn/no-array-reduce
559
+ Object.entries(config).reduce((errors, [option, value]) => {
560
+ if (isNil(value)) {
561
+ return errors;
562
+ }
563
+ if (!(option in VALIDATORS)) {
564
+ return errors;
565
+ }
566
+ if (VALIDATORS[option]?.(value)) {
567
+ return errors;
568
+ }
569
+ return [...errors, getError(`EINVALID${option.toUpperCase()}`, { [option]: value })];
570
+ }, [])
571
+ ), "default");
572
+
573
+ var __defProp$2 = Object.defineProperty;
574
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
575
+ const MIN_PNPM_VERSION = "8.0.0";
576
+ async function verifyPnpm({ logger }) {
577
+ logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
578
+ const version = getPackageManagerVersion("pnpm");
579
+ if (gte(MIN_PNPM_VERSION, version)) {
580
+ const semanticError = getError("EINVALIDPNPM", { version: String(version) });
581
+ throw new AggregateError([semanticError], semanticError.message);
582
+ }
583
+ }
584
+ __name$2(verifyPnpm, "verifyPnpm");
585
+
586
+ var __defProp$1 = Object.defineProperty;
587
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
588
+ const verify = /* @__PURE__ */ __name$1(async (pluginConfig, context) => {
589
+ let errors = verifyConfig(pluginConfig);
590
+ let errorsMessage = "";
591
+ try {
592
+ await verifyPnpm(context);
593
+ } catch (error) {
594
+ const typedError = error;
595
+ errorsMessage += typedError.message;
596
+ errors = [...errors, ...typedError.errors ?? [error]];
597
+ }
598
+ try {
599
+ const packageJson = await getPackage(pluginConfig, context);
600
+ if (shouldPublish(pluginConfig, packageJson)) {
601
+ const npmrc = getNpmrcPath(context.cwd, context.env);
602
+ await verifyAuth(npmrc, packageJson, context);
603
+ }
604
+ } catch (error) {
605
+ const typedError = error;
606
+ errorsMessage += typedError.message;
607
+ errors = [...errors, ...typedError.errors ?? [error]];
608
+ }
609
+ if (errors.length > 0) {
610
+ throw new AggregateError(errors, errorsMessage);
611
+ }
612
+ }, "verify");
613
+
614
+ var __defProp = Object.defineProperty;
615
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
616
+ const PLUGIN_NAME = "semantic-release-pnpm";
617
+ let verified;
618
+ let prepared;
619
+ const verifyConditions = /* @__PURE__ */ __name(async (pluginConfig, context) => {
620
+ if (context.options.publish) {
621
+ const publish2 = Array.isArray(context.options.publish) ? context.options.publish : [context.options.publish];
622
+ const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME) || {};
623
+ pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;
624
+ pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;
625
+ pluginConfig.pkgRoot = pluginConfig.pkgRoot ?? publishPlugin.pkgRoot;
626
+ pluginConfig.disableScripts = pluginConfig.disableScripts ?? publishPlugin.disableScripts;
627
+ pluginConfig.branches = pluginConfig.branches ?? publishPlugin.branches;
628
+ }
629
+ await verify(pluginConfig, context);
630
+ verified = true;
631
+ }, "verifyConditions");
632
+ const prepare = /* @__PURE__ */ __name(async (pluginConfig, context) => {
633
+ if (!verified) {
634
+ await verify(pluginConfig, context);
635
+ }
636
+ await prepareNpm(pluginConfig, context);
637
+ prepared = true;
638
+ }, "prepare");
639
+ const publish = /* @__PURE__ */ __name(async (pluginConfig, context) => {
640
+ const packageJson = await getPackage(pluginConfig, context);
641
+ if (!verified) {
642
+ await verify(pluginConfig, context);
643
+ }
644
+ if (!prepared) {
645
+ await prepareNpm(pluginConfig, context);
646
+ }
647
+ return await publishNpm(pluginConfig, packageJson, context);
648
+ }, "publish");
649
+ const addChannel = /* @__PURE__ */ __name(async (pluginConfig, context) => {
650
+ if (!verified) {
651
+ await verify(pluginConfig, context);
652
+ }
653
+ const packageJson = await getPackage(pluginConfig, context);
654
+ return await addChannelNpm(pluginConfig, packageJson, context);
655
+ }, "addChannel");
656
+
657
+ export { addChannel, prepare, publish, verifyConditions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/semantic-release-pnpm",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Semantic-release plugin to publish a npm package with pnpm.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -46,12 +46,11 @@
46
46
  "CHANGELOG.md"
47
47
  ],
48
48
  "dependencies": {
49
- "@anolilab/rc": "1.1.4",
49
+ "@anolilab/rc": "1.1.5",
50
50
  "@semantic-release/error": "^4.0.0",
51
- "@visulima/fs": "^2.3.1",
52
- "@visulima/package": "^3.1.6",
53
- "@visulima/path": "^1.1.2",
54
- "aggregate-error": "^5.0.0",
51
+ "@visulima/fs": "^2.3.7",
52
+ "@visulima/package": "^3.4.4",
53
+ "@visulima/path": "^1.3.3",
55
54
  "execa": "^9.5.2",
56
55
  "ini": "^5.0.0",
57
56
  "normalize-url": "^8.0.1",
@@ -61,35 +60,35 @@
61
60
  "devDependencies": {
62
61
  "@anolilab/eslint-config": "^15.0.3",
63
62
  "@anolilab/prettier-config": "^5.0.14",
64
- "@arethetypeswrong/cli": "^0.17.1",
63
+ "@arethetypeswrong/cli": "^0.17.3",
65
64
  "@babel/core": "^7.26.0",
66
65
  "@rushstack/eslint-plugin-security": "^0.8.3",
67
66
  "@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
68
67
  "@semantic-release/changelog": "^6.0.3",
69
- "@semantic-release/commit-analyzer": "13.0.0",
68
+ "@semantic-release/commit-analyzer": "13.0.1",
70
69
  "@semantic-release/exec": "^6.0.3",
71
70
  "@semantic-release/git": "^10.0.1",
72
71
  "@semantic-release/github": "^11.0.1",
73
- "@semantic-release/release-notes-generator": "14.0.1",
74
- "@types/dockerode": "^3.3.32",
72
+ "@semantic-release/release-notes-generator": "14.0.3",
73
+ "@types/dockerode": "^3.3.34",
75
74
  "@types/ini": "^4.1.1",
76
75
  "@types/node": "18.19.68",
77
76
  "@types/semantic-release__error": "3.0.3",
78
77
  "@types/semver": "7.5.8",
79
78
  "@types/stream-buffers": "^3.0.7",
80
- "@visulima/packem": "^1.10.0",
79
+ "@visulima/packem": "^1.11.0",
81
80
  "@vitest/coverage-v8": "^2.1.8",
82
81
  "@vitest/ui": "^2.1.8",
83
82
  "conventional-changelog-conventionalcommits": "8.0.0",
84
83
  "cross-env": "^7.0.3",
85
- "dockerode": "4.0.2",
86
- "esbuild": "0.24.0",
84
+ "dockerode": "4.0.3",
85
+ "esbuild": "0.24.2",
87
86
  "eslint": "^8.57.1",
88
87
  "eslint-plugin-deprecation": "^3.0.0",
89
88
  "eslint-plugin-editorconfig": "^4.0.3",
90
89
  "eslint-plugin-import": "npm:eslint-plugin-i@2.29.1",
91
90
  "eslint-plugin-mdx": "^3.1.5",
92
- "eslint-plugin-n": "^17.15.0",
91
+ "eslint-plugin-n": "^17.15.1",
93
92
  "eslint-plugin-vitest": "^0.4.1",
94
93
  "eslint-plugin-vitest-globals": "^1.5.0",
95
94
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
@@ -99,11 +98,11 @@
99
98
  "prettier": "^3.4.2",
100
99
  "rimraf": "^6.0.1",
101
100
  "secretlint": "9.0.0",
102
- "semantic-release": "^24.2.0",
103
- "sort-package-json": "^2.12.0",
101
+ "semantic-release": "^24.2.1",
102
+ "sort-package-json": "^2.13.0",
104
103
  "stream-buffers": "^3.0.3",
105
104
  "tempy": "^3.1.0",
106
- "typescript": "^5.7.2",
105
+ "typescript": "^5.7.3",
107
106
  "vitest": "^2.1.8"
108
107
  },
109
108
  "engines": {