@anolilab/semantic-release-pnpm 1.1.6 → 1.1.7

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