@anolilab/semantic-release-pnpm 1.0.0-alpha.2 → 1.0.0-alpha.6
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 +29 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +26 -593
- package/dist/index.js.map +1 -1
- package/package.json +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [1.0.0-alpha.6](https://github.com/anolilab/semantic-release-pnpm/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2024-05-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* more tests ([d969442](https://github.com/anolilab/semantic-release-pnpm/commit/d969442b4109723c1e5491a7dcefc5477c1518d0))
|
|
7
|
+
* replaced rc with custom version, ported more tests ([22368ff](https://github.com/anolilab/semantic-release-pnpm/commit/22368ffce0bddc647676e46f21604748d570eb76))
|
|
8
|
+
|
|
9
|
+
## [1.0.0-alpha.5](https://github.com/anolilab/semantic-release-pnpm/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2024-05-16)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* changed wrong arg ([4464484](https://github.com/anolilab/semantic-release-pnpm/commit/4464484654ca25abf5896a6c7dca322bae3c4352))
|
|
15
|
+
|
|
16
|
+
## [1.0.0-alpha.4](https://github.com/anolilab/semantic-release-pnpm/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2024-05-16)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* changed wrong arg ([90658c9](https://github.com/anolilab/semantic-release-pnpm/commit/90658c9fc5353e7290c84dab404b468df6ad311e))
|
|
22
|
+
|
|
23
|
+
## [1.0.0-alpha.3](https://github.com/anolilab/semantic-release-pnpm/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2024-05-16)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* added option for disableScripts ([2d739cf](https://github.com/anolilab/semantic-release-pnpm/commit/2d739cf36d01599264e3a70eb24e5ca4bc09e590))
|
|
29
|
+
|
|
1
30
|
## [1.0.0-alpha.2](https://github.com/anolilab/semantic-release-pnpm/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2024-05-16)
|
|
2
31
|
|
|
3
32
|
|
package/dist/index.d.ts
CHANGED
|
@@ -54,26 +54,27 @@ interface Release {
|
|
|
54
54
|
version: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
interface ReleaseInfo {
|
|
58
|
-
channel: string;
|
|
59
|
-
name: string;
|
|
60
|
-
url?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
57
|
interface PluginConfig {
|
|
64
58
|
branches?: (string | {
|
|
65
59
|
name: string;
|
|
66
60
|
prerelease: boolean;
|
|
67
61
|
})[];
|
|
62
|
+
disableScripts?: boolean;
|
|
68
63
|
npmPublish?: boolean;
|
|
69
64
|
pkgRoot?: string;
|
|
70
65
|
publishBranch?: string;
|
|
71
66
|
tarballDir?: string;
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
interface ReleaseInfo {
|
|
70
|
+
channel: string;
|
|
71
|
+
name: string;
|
|
72
|
+
url?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare const verifyConditions: (pluginConfig: PluginConfig, context: VerifyConditionsContext) => Promise<void>;
|
|
76
|
+
declare const prepare: (pluginConfig: PluginConfig, context: PrepareContext) => Promise<void>;
|
|
77
|
+
declare const publish: (pluginConfig: PluginConfig, context: PublishContext) => Promise<ReleaseInfo | false>;
|
|
78
|
+
declare const addChannel: (pluginConfig: PluginConfig, context: AddChannelContext) => Promise<ReleaseInfo | false>;
|
|
78
79
|
|
|
79
80
|
export { addChannel, prepare, publish, verifyConditions };
|
package/dist/index.js
CHANGED
|
@@ -1,602 +1,35 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
2
|
import { validRange, gte } from 'semver';
|
|
3
|
-
import { isAccessibleSync, ensureFile,
|
|
3
|
+
import { isAccessibleSync, ensureFile, readFileSync, findUpSync, writeFile } from '@visulima/fs';
|
|
4
4
|
import { findPackageJson, findCacheDirectorySync, getPackageManagerVersion } from '@visulima/package';
|
|
5
|
-
import { resolve } from '@visulima/path';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import { resolve, join } from '@visulima/path';
|
|
6
|
+
import ce from '@semantic-release/error';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import { cwd } from 'process';
|
|
9
|
+
import { parse, stringify } from 'ini';
|
|
10
|
+
import { merge } from 'ts-deepmerge';
|
|
11
|
+
import z from 'normalize-url';
|
|
9
12
|
import { moveFile } from 'move-file';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
13
|
+
import X from 'aggregate-error';
|
|
14
|
+
import Te from 'registry-auth-token';
|
|
12
15
|
import { URL } from 'url';
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// package.json
|
|
18
|
-
var package_default = {
|
|
19
|
-
name: "@anolilab/semantic-release-pnpm",
|
|
20
|
-
version: "1.0.0-alpha.1",
|
|
21
|
-
description: "Semantic-release plugin to publish a npm package with pnpm.",
|
|
22
|
-
keywords: [
|
|
23
|
-
"anolilab",
|
|
24
|
-
"npm",
|
|
25
|
-
"publish",
|
|
26
|
-
"semantic-release",
|
|
27
|
-
"pnpm",
|
|
28
|
-
"monorepo"
|
|
29
|
-
],
|
|
30
|
-
homepage: "https://github.com/anolilab/semantic-release-pnpm",
|
|
31
|
-
repository: {
|
|
32
|
-
type: "git",
|
|
33
|
-
url: "https://github.com/anolilab/semantic-release-pnpm.git"
|
|
34
|
-
},
|
|
35
|
-
license: "MIT",
|
|
36
|
-
author: {
|
|
37
|
-
name: "Daniel Bannert",
|
|
38
|
-
email: "d.bannert@anolilab.de"
|
|
39
|
-
},
|
|
40
|
-
type: "module",
|
|
41
|
-
exports: "./dist/index.js",
|
|
42
|
-
main: "dist/index.js",
|
|
43
|
-
types: "dist/index.d.ts",
|
|
44
|
-
files: [
|
|
45
|
-
"dist",
|
|
46
|
-
"README.md",
|
|
47
|
-
"CHANGELOG.md"
|
|
48
|
-
],
|
|
49
|
-
scripts: {
|
|
50
|
-
build: "cross-env NODE_ENV=development tsup",
|
|
51
|
-
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
52
|
-
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
53
|
-
"lint:eslint:fix": "pnpm run lint:eslint --fix",
|
|
54
|
-
"lint:fix": "pnpm run lint:prettier:fix && pnpm run lint:eslint:fix",
|
|
55
|
-
"lint:packagejson": "publint --strict",
|
|
56
|
-
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
57
|
-
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
58
|
-
"lint:secrets": "secretlint **/*",
|
|
59
|
-
"lint:staged": "lint-staged --verbose --concurrent false --debug",
|
|
60
|
-
"lint:text": "textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --cache --dry-run",
|
|
61
|
-
"lint:text:fix": "textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --fix",
|
|
62
|
-
"lint:types": "tsc --noEmit",
|
|
63
|
-
prepare: "is-ci || (node verify-node-version.cjs && pnpx only-allow pnpm && husky install)",
|
|
64
|
-
"sort-package-json": "sort-package-json ./package.json",
|
|
65
|
-
test: "vitest run",
|
|
66
|
-
"test:bench": "vitest bench",
|
|
67
|
-
"test:coverage": "vitest run --coverage",
|
|
68
|
-
"test:watch": "vitest",
|
|
69
|
-
"update:deps": "taze"
|
|
70
|
-
},
|
|
71
|
-
dependencies: {
|
|
72
|
-
"@visulima/package": "1.8.1",
|
|
73
|
-
"@visulima/fs": "^2.1.1",
|
|
74
|
-
"@visulima/path": "^1.0.0",
|
|
75
|
-
"@semantic-release/error": "^4.0.0",
|
|
76
|
-
"aggregate-error": "^5.0.0",
|
|
77
|
-
execa: "^9.1.0",
|
|
78
|
-
"move-file": "^3.1.0",
|
|
79
|
-
"normalize-url": "^8.0.1",
|
|
80
|
-
rc: "^1.2.8",
|
|
81
|
-
"registry-auth-token": "^5.0.2",
|
|
82
|
-
semver: "^7.6.2"
|
|
83
|
-
},
|
|
84
|
-
devDependencies: {
|
|
85
|
-
"@anolilab/commitlint-config": "^5.0.3",
|
|
86
|
-
"@anolilab/eslint-config": "^15.0.3",
|
|
87
|
-
"@anolilab/lint-staged-config": "^2.1.7",
|
|
88
|
-
"@anolilab/prettier-config": "^5.0.14",
|
|
89
|
-
"@anolilab/textlint-config": "^8.0.16",
|
|
90
|
-
"@babel/core": "^7.24.5",
|
|
91
|
-
"@babel/eslint-parser": "7.24.5",
|
|
92
|
-
"@commitlint/cli": "^19.3.0",
|
|
93
|
-
"@commitlint/config-conventional": "^19.2.2",
|
|
94
|
-
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
95
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
96
|
-
"@semantic-release/git": "^10.0.1",
|
|
97
|
-
"@semantic-release/github": "^10.0.3",
|
|
98
|
-
"@types/dockerode": "^3.3.29",
|
|
99
|
-
"@types/node": "^20.12.12",
|
|
100
|
-
"@types/rc": "^1.2.4",
|
|
101
|
-
"@types/semantic-release__error": "3.0.3",
|
|
102
|
-
"@types/semver": "7.5.8",
|
|
103
|
-
"@vitest/coverage-v8": "^1.6.0",
|
|
104
|
-
commitizen: "^4.3.0",
|
|
105
|
-
commitlint: "^19.3.0",
|
|
106
|
-
"cross-env": "^7.0.3",
|
|
107
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
108
|
-
dockerode: "4.0.2",
|
|
109
|
-
eslint: "8.55.0",
|
|
110
|
-
"eslint-plugin-deprecation": "^2.0.0",
|
|
111
|
-
"eslint-plugin-editorconfig": "^4.0.3",
|
|
112
|
-
"eslint-plugin-import": "npm:eslint-plugin-i@2.29.1",
|
|
113
|
-
"eslint-plugin-mdx": "^3.1.5",
|
|
114
|
-
"eslint-plugin-n": "^17.7.0",
|
|
115
|
-
"eslint-plugin-vitest": "^0.4.1",
|
|
116
|
-
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
117
|
-
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
118
|
-
"get-stream": "9.0.1",
|
|
119
|
-
husky: "^9.0.11",
|
|
120
|
-
"is-ci": "^3.0.1",
|
|
121
|
-
"lint-staged": "^15.2.2",
|
|
122
|
-
prettier: "^3.2.5",
|
|
123
|
-
publint: "^0.2.7",
|
|
124
|
-
rimraf: "^5.0.7",
|
|
125
|
-
secretlint: "8.2.4",
|
|
126
|
-
"semantic-release": "^23.1.1",
|
|
127
|
-
"sort-package-json": "^2.10.0",
|
|
128
|
-
taze: "^0.13.8",
|
|
129
|
-
tempy: "^3.1.0",
|
|
130
|
-
textlint: "^14.0.4",
|
|
131
|
-
tsup: "^8.0.2",
|
|
132
|
-
typescript: "^5.4.5",
|
|
133
|
-
vitest: "^1.6.0"
|
|
134
|
-
},
|
|
135
|
-
peerDependencies: {
|
|
136
|
-
"semantic-release": "^20.0 || ^21.0 || >=22.0.3"
|
|
137
|
-
},
|
|
138
|
-
packageManager: "pnpm@9.1.1",
|
|
139
|
-
engines: {
|
|
140
|
-
node: ">=18 || >=20.6.1"
|
|
141
|
-
},
|
|
142
|
-
publishConfig: {
|
|
143
|
-
access: "public",
|
|
144
|
-
provenance: true
|
|
145
|
-
},
|
|
146
|
-
anolilab: {
|
|
147
|
-
"eslint-config": {
|
|
148
|
-
plugin: {},
|
|
149
|
-
warn_on_unsupported_typescript_version: false,
|
|
150
|
-
info_on_disabling_jsx_react_rule: false,
|
|
151
|
-
info_on_disabling_prettier_conflict_rule: false,
|
|
152
|
-
info_on_disabling_jsonc_sort_keys_rule: false,
|
|
153
|
-
import_ignore_exports: [
|
|
154
|
-
"**/*.cjs",
|
|
155
|
-
"verify-node-version.cjs"
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
pnpm: {
|
|
160
|
-
overrides: {
|
|
161
|
-
"chrono-node@<2.2.4": ">=2.2.4"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// src/definitions/errors.ts
|
|
167
|
-
var linkify = (file) => `${package_default.homepage}/blob/main/${file}`;
|
|
168
|
-
var errors = {
|
|
169
|
-
EINVALIDNPMPUBLISH: ({ npmPublish }) => {
|
|
170
|
-
return {
|
|
171
|
-
details: `The [npmPublish option](${linkify("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
|
|
172
|
-
Your configuration for the \`npmPublish\` option is \`${npmPublish}\`.`,
|
|
173
|
-
message: "Invalid `npmPublish` option."
|
|
174
|
-
};
|
|
175
|
-
},
|
|
176
|
-
EINVALIDNPMTOKEN: ({ registry }) => {
|
|
177
|
-
return {
|
|
178
|
-
details: `The [npm token](${linkify(
|
|
179
|
-
"README.md#npm-registry-authentication"
|
|
180
|
-
)}) 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 \`${registry}\`.
|
|
17
|
+
var k=e=>e?validRange(e)?`release-${e}`:e:"latest";var U={name:"@anolilab/semantic-release-pnpm",version:"1.0.0-alpha.5",description:"Semantic-release plugin to publish a npm package with pnpm.",keywords:["anolilab","npm","publish","semantic-release","pnpm","monorepo"],homepage:"https://github.com/anolilab/semantic-release-pnpm",repository:{type:"git",url:"https://github.com/anolilab/semantic-release-pnpm.git"},license:"MIT",author:{name:"Daniel Bannert",email:"d.bannert@anolilab.de"},type:"module",exports:"./dist/index.js",main:"dist/index.js",types:"dist/index.d.ts",files:["dist","README.md","CHANGELOG.md"],scripts:{build:"cross-env NODE_ENV=development tsup","build:prod":"cross-env NODE_ENV=production tsup","lint:eslint":"eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs","lint:eslint:fix":"pnpm run lint:eslint --fix","lint:fix":"pnpm run lint:prettier:fix && pnpm run lint:eslint:fix","lint:packagejson":"publint --strict","lint:prettier":"prettier --config=.prettierrc.cjs --check .","lint:prettier:fix":"prettier --config=.prettierrc.cjs --write .","lint:secrets":"secretlint **/*","lint:staged":"lint-staged --verbose --concurrent false --debug","lint:text":"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --cache --dry-run","lint:text:fix":"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --fix","lint:types":"tsc --noEmit",prepare:"is-ci || (node verify-node-version.cjs && pnpx only-allow pnpm && husky install)","sort-package-json":"sort-package-json ./package.json",test:"vitest run","test:bench":"vitest bench","test:coverage":"vitest run --coverage","test:watch":"vitest","update:deps":"taze"},dependencies:{"@semantic-release/error":"^4.0.0","@visulima/fs":"^2.1.1","@visulima/package":"1.8.1","@visulima/path":"^1.0.0","aggregate-error":"^5.0.0",execa:"^9.1.0",ini:"4.1.2","move-file":"^3.1.0","normalize-url":"^8.0.1","registry-auth-token":"^5.0.2",semver:"^7.6.2","ts-deepmerge":"^7.0.0"},devDependencies:{"@anolilab/commitlint-config":"^5.0.3","@anolilab/eslint-config":"^15.0.3","@anolilab/lint-staged-config":"^2.1.7","@anolilab/prettier-config":"^5.0.14","@anolilab/textlint-config":"^8.0.16","@babel/core":"^7.24.5","@babel/eslint-parser":"7.24.5","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@secretlint/secretlint-rule-preset-recommend":"^8.2.4","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/github":"^10.0.3","@types/dockerode":"^3.3.29","@types/ini":"^4.1.0","@types/node":"^20.12.12","@types/semantic-release__error":"3.0.3","@types/semver":"7.5.8","@types/stream-buffers":"^3.0.7","@vitest/coverage-v8":"^1.6.0",commitizen:"^4.3.0",commitlint:"^19.3.0","cross-env":"^7.0.3","cz-conventional-changelog":"^3.3.0",dockerode:"4.0.2",eslint:"8.55.0","eslint-plugin-deprecation":"^2.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.7.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.2.1",husky:"^9.0.11","is-ci":"^3.0.1","lint-staged":"^15.2.2","p-retry":"^6.2.0",prettier:"^3.2.5",publint:"^0.2.7",rimraf:"^5.0.7",secretlint:"8.2.4","semantic-release":"^23.1.1","sort-package-json":"^2.10.0","stream-buffers":"^3.0.2",taze:"^0.13.8",tempy:"^3.1.0",textlint:"^14.0.4",tsup:"^8.0.2",typescript:"^5.4.5",vitest:"^1.6.0"},peerDependencies:{"semantic-release":"^20.0 || ^21.0 || >=22.0.3"},packageManager:"pnpm@9.1.1",engines:{node:">=18 || >=20.6.1"},publishConfig:{access:"public",provenance:!0},pnpm:{overrides:{"chrono-node@<2.2.4":">=2.2.4"}},anolilab:{"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","verify-node-version.cjs"]}}};var h=e=>`${U.homepage}/blob/main/${e}`,K={EINVALIDBRANCHES:e=>({details:`The [branches option](${h("README.md#branches")}) option, if defined, must be an array of \`String\`.
|
|
18
|
+
Your configuration for the \`branches\` option is \`${e}\`.`,message:"Invalid `branches` option."}),EINVALIDNPMPUBLISH:({npmPublish:e})=>({details:`The [npmPublish option](${h("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
|
|
19
|
+
Your configuration for the \`npmPublish\` option is \`${e}\`.`,message:"Invalid `npmPublish` option."}),EINVALIDNPMTOKEN:({registry:e})=>({details:`The [npm token](${h("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 \`${e}\`.
|
|
181
20
|
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.
|
|
182
|
-
Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with the exact value of the npm token.`,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
details: `The version of Pnpm that you are using is not compatible. Please refer to [the README](${linkify(
|
|
196
|
-
"README.md#install"
|
|
197
|
-
)}) to review which versions of Pnpm are currently supported
|
|
198
|
-
|
|
199
|
-
Your version of Pnpm is "${version}".`,
|
|
200
|
-
message: "Incompatible Pnpm version detected."
|
|
201
|
-
};
|
|
202
|
-
},
|
|
203
|
-
EINVALIDPUBLISHBRANCH: ({ publishBranch }) => {
|
|
204
|
-
return {
|
|
205
|
-
details: `The [publishBranch option](${linkify("README.md#publishBranch")}) option, if defined, must be a \`String\`.
|
|
206
|
-
Your configuration for the \`publishBranch\` option is \`${publishBranch}\`.`,
|
|
207
|
-
message: "Invalid `publishBranch` option."
|
|
208
|
-
};
|
|
209
|
-
},
|
|
210
|
-
EINVALIDTARBALLDIR: ({ tarballDir }) => {
|
|
211
|
-
return {
|
|
212
|
-
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
|
|
213
|
-
Your configuration for the \`tarballDir\` option is \`${tarballDir}\`.`,
|
|
214
|
-
message: "Invalid `tarballDir` option."
|
|
215
|
-
};
|
|
216
|
-
},
|
|
217
|
-
ENONPMTOKEN: ({ registry }) => {
|
|
218
|
-
return {
|
|
219
|
-
details: `An [npm token](${linkify(
|
|
220
|
-
"README.md#npm-registry-authentication"
|
|
221
|
-
)}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
|
|
222
|
-
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 \`${registry}\`.`,
|
|
223
|
-
message: "No npm token specified."
|
|
224
|
-
};
|
|
225
|
-
},
|
|
226
|
-
ENOPKG: () => {
|
|
227
|
-
return {
|
|
228
|
-
details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.
|
|
229
|
-
Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
|
|
230
|
-
message: "Missing `package.json` file."
|
|
231
|
-
};
|
|
232
|
-
},
|
|
233
|
-
ENOPKGNAME: () => {
|
|
234
|
-
return {
|
|
235
|
-
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.
|
|
236
|
-
Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
|
|
237
|
-
message: "Missing `name` property in `package.json`."
|
|
238
|
-
};
|
|
239
|
-
},
|
|
240
|
-
ENOPNPM: () => {
|
|
241
|
-
return {
|
|
242
|
-
details: `The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.`,
|
|
243
|
-
message: "Pnpm not found."
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
ENOPNPMRC: () => {
|
|
247
|
-
return {
|
|
248
|
-
details: `Didnt find a \`.npmrc\` file or it was not possible to create , in the root of your project.`,
|
|
249
|
-
message: "Missing `.npmrc` file."
|
|
250
|
-
};
|
|
251
|
-
},
|
|
252
|
-
EINVALIDBRANCHES: (branches) => {
|
|
253
|
-
return {
|
|
254
|
-
details: `The [branches option](${linkify("README.md#branches")}) option, if defined, must be an array of \`String\`.
|
|
255
|
-
Your configuration for the \`branches\` option is \`${branches}\`.`,
|
|
256
|
-
message: "Invalid `branches` option."
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
// src/utils/get-error.ts
|
|
262
|
-
var get_error_default = (code, context = {}) => {
|
|
263
|
-
const { details, message } = errors[code](context);
|
|
264
|
-
return new SemanticReleaseError(message, code, details);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// src/utils/get-npmrc.ts
|
|
268
|
-
var getNpmrc = (cwd, environment) => {
|
|
269
|
-
let npmrc = environment.NPM_CONFIG_USERCONFIG;
|
|
270
|
-
const npmrcPath = resolve(cwd, ".npmrc");
|
|
271
|
-
if (!npmrc && isAccessibleSync(npmrcPath)) {
|
|
272
|
-
npmrc = npmrcPath;
|
|
273
|
-
} else if (!npmrc) {
|
|
274
|
-
const temporaryNpmrcPath = findCacheDirectorySync("semantic-release-pnpm", { create: true, cwd });
|
|
275
|
-
if (temporaryNpmrcPath) {
|
|
276
|
-
ensureFile(temporaryNpmrcPath);
|
|
277
|
-
npmrc = temporaryNpmrcPath;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
if (!npmrc) {
|
|
281
|
-
throw new AggregateError([
|
|
282
|
-
get_error_default("ENOPNPMRC", {
|
|
283
|
-
npmrc: npmrcPath
|
|
284
|
-
})
|
|
285
|
-
]);
|
|
286
|
-
}
|
|
287
|
-
return npmrc;
|
|
288
|
-
};
|
|
289
|
-
var get_npmrc_default = getNpmrc;
|
|
290
|
-
|
|
291
|
-
// src/definitions/constants.ts
|
|
292
|
-
var DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/";
|
|
293
|
-
|
|
294
|
-
// src/utils/get-registry.ts
|
|
295
|
-
var getRegistryUrl = (scope, npmrc) => {
|
|
296
|
-
let url = DEFAULT_NPM_REGISTRY;
|
|
297
|
-
if (npmrc) {
|
|
298
|
-
const registryUrl = npmrc[`${scope}:registry`] ?? npmrc["registry"];
|
|
299
|
-
if (registryUrl) {
|
|
300
|
-
url = registryUrl;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return url.slice(-1) === "/" ? url : `${url}/`;
|
|
304
|
-
};
|
|
305
|
-
var get_registry_default = ({ name, publishConfig: { registry } = {} }, { cwd, env }) => registry ?? env.NPM_CONFIG_REGISTRY ?? getRegistryUrl(
|
|
306
|
-
name.split("/")[0],
|
|
307
|
-
rc("npm", { registry: "https://registry.npmjs.org/" }, { config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc") })
|
|
308
|
-
);
|
|
309
|
-
var getReleaseInfo = ({ name }, { env: { DEFAULT_NPM_REGISTRY: DEFAULT_NPM_REGISTRY2 = "https://registry.npmjs.org/" }, nextRelease: { version } }, distributionTag, registry) => {
|
|
310
|
-
return {
|
|
311
|
-
channel: distributionTag,
|
|
312
|
-
name: `pnpm package (@${distributionTag} dist-tag)`,
|
|
313
|
-
url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY2) ? `https://www.npmjs.com/package/${name}/v/${version}` : void 0
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
// src/utils/should-publish.ts
|
|
318
|
-
function shouldPublish(pluginConfig, package_) {
|
|
319
|
-
return reasonToNotPublish(pluginConfig, package_) === null;
|
|
320
|
-
}
|
|
321
|
-
function reasonToNotPublish(pluginConfig, package_) {
|
|
322
|
-
return pluginConfig.npmPublish === false ? "npmPublish plugin option is false" : package_.private === true && package_.workspaces === void 0 ? "package is private and has no workspaces" : null;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// src/add-channel.ts
|
|
326
|
-
var add_channel_default = async (pluginConfig, package_, context) => {
|
|
327
|
-
const {
|
|
328
|
-
cwd,
|
|
329
|
-
env,
|
|
330
|
-
logger,
|
|
331
|
-
nextRelease: { channel, version },
|
|
332
|
-
stderr,
|
|
333
|
-
stdout
|
|
334
|
-
} = context;
|
|
335
|
-
if (shouldPublish(pluginConfig, package_)) {
|
|
336
|
-
const registry = get_registry_default(package_, context);
|
|
337
|
-
const distributionTag = get_channel_default(channel);
|
|
338
|
-
logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);
|
|
339
|
-
const npmrc = get_npmrc_default(cwd, env);
|
|
340
|
-
const result = execa("pnpm", ["dist-tag", "add", `${package_.name}@${version}`, distributionTag, "--userconfig", npmrc, "--registry", registry], {
|
|
341
|
-
cwd,
|
|
342
|
-
env,
|
|
343
|
-
preferLocal: true
|
|
344
|
-
});
|
|
345
|
-
result.stdout.pipe(stdout, { end: false });
|
|
346
|
-
result.stderr.pipe(stderr, { end: false });
|
|
347
|
-
await result;
|
|
348
|
-
logger.log(`Added ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
349
|
-
return getReleaseInfo(package_, context, distributionTag, registry);
|
|
350
|
-
}
|
|
351
|
-
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, package_)}`);
|
|
352
|
-
return false;
|
|
353
|
-
};
|
|
354
|
-
var prepare_default = async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextRelease: { version }, stderr, stdout }) => {
|
|
355
|
-
const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
|
|
356
|
-
logger.log("Write version %s to package.json in %s", version, basePath);
|
|
357
|
-
const versionResult = execa("pnpm", ["version", version, "--no-git-tag-version", "--allow-same-version"], {
|
|
358
|
-
cwd: basePath,
|
|
359
|
-
env,
|
|
360
|
-
preferLocal: true
|
|
361
|
-
});
|
|
362
|
-
versionResult.stdout.pipe(stdout, { end: false });
|
|
363
|
-
versionResult.stderr.pipe(stderr, { end: false });
|
|
364
|
-
await versionResult;
|
|
365
|
-
if (tarballDir) {
|
|
366
|
-
logger.log("Creating npm package version %s", version);
|
|
367
|
-
const packResult = execa("pnpm", ["pack", basePath], { cwd, env, preferLocal: true });
|
|
368
|
-
packResult.stdout.pipe(stdout, { end: false });
|
|
369
|
-
packResult.stderr.pipe(stderr, { end: false });
|
|
370
|
-
const tarball = (await packResult).stdout.split("\n").pop();
|
|
371
|
-
const tarballSource = resolve(cwd, tarball);
|
|
372
|
-
const tarballDestination = resolve(cwd, tarballDir.trim(), tarball);
|
|
373
|
-
if (tarballSource !== tarballDestination) {
|
|
374
|
-
await moveFile(tarballSource, tarballDestination);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
var publish_default = async (pluginConfig, package_, context) => {
|
|
379
|
-
const {
|
|
380
|
-
cwd,
|
|
381
|
-
env,
|
|
382
|
-
logger,
|
|
383
|
-
nextRelease: { channel, version },
|
|
384
|
-
stderr,
|
|
385
|
-
stdout
|
|
386
|
-
} = context;
|
|
387
|
-
const { pkgRoot, publishBranch: publishBranchConfig } = pluginConfig;
|
|
388
|
-
if (shouldPublish(pluginConfig, package_)) {
|
|
389
|
-
const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
|
|
390
|
-
const registry = get_registry_default(package_, context);
|
|
391
|
-
const distributionTag = get_channel_default(channel);
|
|
392
|
-
const { stdout: currentBranch } = await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
393
|
-
cwd,
|
|
394
|
-
env,
|
|
395
|
-
preferLocal: true
|
|
396
|
-
});
|
|
397
|
-
const publishBranches = typeof publishBranchConfig === "string" && publishBranchConfig.split("|");
|
|
398
|
-
const isPublishBranch = publishBranches && publishBranches?.includes(currentBranch);
|
|
399
|
-
const publishBranch = isPublishBranch ? currentBranch : "main";
|
|
400
|
-
logger.log(`Publishing version ${version} on branch ${publishBranch} to npm registry on dist-tag ${distributionTag}`);
|
|
401
|
-
const result = execa("pnpm", ["publish", basePath, "--publish-branch", publishBranch, "--tag", distributionTag, "--registry", registry, "--no-git-checks"], {
|
|
402
|
-
cwd,
|
|
403
|
-
env,
|
|
404
|
-
preferLocal: true
|
|
405
|
-
});
|
|
406
|
-
result.stdout.pipe(stdout, { end: false });
|
|
407
|
-
result.stderr.pipe(stderr, { end: false });
|
|
408
|
-
try {
|
|
409
|
-
await result;
|
|
410
|
-
} catch (error) {
|
|
411
|
-
logger.log(`Failed to publish ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}: ${error.message || error}`);
|
|
412
|
-
throw new AggregateError5([error]);
|
|
413
|
-
}
|
|
414
|
-
logger.log(`Published ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);
|
|
415
|
-
return getReleaseInfo(package_, context, distributionTag, registry);
|
|
416
|
-
}
|
|
417
|
-
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, package_)}`);
|
|
418
|
-
return false;
|
|
419
|
-
};
|
|
420
|
-
var get_pkg_default = async ({ pkgRoot }, { cwd }) => {
|
|
421
|
-
try {
|
|
422
|
-
const { packageJson } = await findPackageJson(pkgRoot ? resolve(cwd, pkgRoot) : cwd);
|
|
423
|
-
if (!packageJson.name) {
|
|
424
|
-
throw get_error_default("ENOPKGNAME");
|
|
425
|
-
}
|
|
426
|
-
return packageJson;
|
|
427
|
-
} catch (error) {
|
|
428
|
-
if (error.code === "ENOENT") {
|
|
429
|
-
throw get_error_default("ENOPKG");
|
|
430
|
-
}
|
|
431
|
-
throw error;
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
var nerfDart = (url) => {
|
|
435
|
-
const parsed = new URL(url);
|
|
436
|
-
const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
437
|
-
const rel = new URL(".", from);
|
|
438
|
-
return `//${rel.host}${rel.pathname}`;
|
|
439
|
-
};
|
|
440
|
-
var nerf_dart_default = nerfDart;
|
|
441
|
-
|
|
442
|
-
// src/utils/set-npmrc-auth.ts
|
|
443
|
-
var set_npmrc_auth_default = async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }) => {
|
|
444
|
-
logger.log("Verify authentication for registry %s", registry);
|
|
445
|
-
const { configs, ...rcConfig } = rc("npm", { registry: DEFAULT_NPM_REGISTRY }, { config: NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc") });
|
|
446
|
-
if (configs) {
|
|
447
|
-
logger.log("Reading npm config from %s", configs.join(", "));
|
|
448
|
-
}
|
|
449
|
-
const currentConfig = configs ? (await Promise.all(configs.map((config) => readFile(config)))).join("\n") : "";
|
|
450
|
-
if (getAuthToken(registry, { npmrc: rcConfig })) {
|
|
451
|
-
await writeFile(npmrc, currentConfig);
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {
|
|
455
|
-
await writeFile(npmrc, `${currentConfig ? `${currentConfig}
|
|
456
|
-
` : ""}_auth = \${LEGACY_TOKEN}
|
|
457
|
-
email = \${NPM_EMAIL}`);
|
|
458
|
-
logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${npmrc}`);
|
|
459
|
-
} else if (NPM_TOKEN) {
|
|
460
|
-
await writeFile(npmrc, `${currentConfig ? `${currentConfig}
|
|
461
|
-
` : ""}${nerf_dart_default(registry)}:_authToken = \${NPM_TOKEN}`);
|
|
462
|
-
logger.log(`Wrote NPM_TOKEN to ${npmrc}`);
|
|
463
|
-
} else {
|
|
464
|
-
throw new AggregateError5([get_error_default("ENONPMTOKEN", { registry })]);
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
// src/verify/verify-auth.ts
|
|
469
|
-
var verify_auth_default = async (npmrc, package_, context) => {
|
|
470
|
-
const {
|
|
471
|
-
cwd,
|
|
472
|
-
env: { DEFAULT_NPM_REGISTRY: DEFAULT_NPM_REGISTRY2 = "https://registry.npmjs.org/", ...environment },
|
|
473
|
-
logger,
|
|
474
|
-
stderr,
|
|
475
|
-
stdout
|
|
476
|
-
} = context;
|
|
477
|
-
const registry = get_registry_default(package_, context);
|
|
478
|
-
await set_npmrc_auth_default(npmrc, registry, context);
|
|
479
|
-
if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY2)) {
|
|
480
|
-
try {
|
|
481
|
-
logger.log(`Running "pnpm whoami" to verify authentication on registry "${registry}"`);
|
|
482
|
-
const whoamiResult = execa("pnpm", ["whoami", "--userconfig", npmrc, "--registry", registry], {
|
|
483
|
-
cwd,
|
|
484
|
-
env: environment,
|
|
485
|
-
preferLocal: true
|
|
486
|
-
});
|
|
487
|
-
whoamiResult.stdout.pipe(stdout, { end: false });
|
|
488
|
-
whoamiResult.stderr.pipe(stderr, { end: false });
|
|
489
|
-
await whoamiResult;
|
|
490
|
-
} catch {
|
|
491
|
-
throw new AggregateError5([get_error_default("EINVALIDNPMTOKEN", { registry })]);
|
|
492
|
-
}
|
|
493
|
-
} else {
|
|
494
|
-
logger.log(`Skipping authentication verification for non-default registry "${registry}"`);
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
// src/verify/verify-config.ts
|
|
499
|
-
var isString = (value) => typeof value === "string";
|
|
500
|
-
var isNil = (value) => value === null || value === void 0;
|
|
501
|
-
var isNonEmptyString = (value) => isString(value) && value.trim();
|
|
502
|
-
var VALIDATORS = {
|
|
503
|
-
branches: Array.isArray,
|
|
504
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
505
|
-
npmPublish: (value) => typeof value === "boolean",
|
|
506
|
-
pkgRoot: isNonEmptyString,
|
|
507
|
-
publishBranch: isNonEmptyString,
|
|
508
|
-
tarballDir: isNonEmptyString
|
|
509
|
-
};
|
|
510
|
-
var verify_config_default = (config) => (
|
|
511
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
512
|
-
Object.entries(config).reduce((errors2, [option, value]) => {
|
|
513
|
-
if (isNil(value)) {
|
|
514
|
-
return errors2;
|
|
515
|
-
}
|
|
516
|
-
if (!(option in VALIDATORS)) {
|
|
517
|
-
return errors2;
|
|
518
|
-
}
|
|
519
|
-
if (VALIDATORS[option]?.(value)) {
|
|
520
|
-
return errors2;
|
|
521
|
-
}
|
|
522
|
-
return [...errors2, get_error_default(`EINVALID${option.toUpperCase()}`, { [option]: value })];
|
|
523
|
-
}, [])
|
|
524
|
-
);
|
|
525
|
-
var MIN_PNPM_VERSION = "8.0.0";
|
|
526
|
-
async function verifyPnpm({ logger }) {
|
|
527
|
-
logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
|
|
528
|
-
const version = await getPackageManagerVersion("pnpm");
|
|
529
|
-
if (version === void 0) {
|
|
530
|
-
throw new AggregateError5([new Error("pnpm is not installed")]);
|
|
531
|
-
}
|
|
532
|
-
if (gte(MIN_PNPM_VERSION, version)) {
|
|
533
|
-
throw new AggregateError5([get_error_default("EINVALIDPNPM", { version: String(version) })]);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// src/verify/index.ts
|
|
538
|
-
var verify = async (pluginConfig, context) => {
|
|
539
|
-
let errors2 = verify_config_default(pluginConfig);
|
|
540
|
-
try {
|
|
541
|
-
verifyPnpm(context);
|
|
542
|
-
} catch (error) {
|
|
543
|
-
errors2 = [...errors2, ...error.errors ? error.errors : [error]];
|
|
544
|
-
}
|
|
545
|
-
try {
|
|
546
|
-
const packageJson = await get_pkg_default(pluginConfig, context);
|
|
547
|
-
if (shouldPublish(pluginConfig, packageJson)) {
|
|
548
|
-
const npmrc = get_npmrc_default(context.cwd, context.env);
|
|
549
|
-
await verify_auth_default(npmrc, packageJson, context);
|
|
550
|
-
}
|
|
551
|
-
} catch (error) {
|
|
552
|
-
errors2 = [...errors2, ...error.errors ? error.errors : [error]];
|
|
553
|
-
}
|
|
554
|
-
if (errors2.length > 0) {
|
|
555
|
-
throw new AggregateError5(errors2);
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
var verify_default = verify;
|
|
559
|
-
|
|
560
|
-
// src/index.ts
|
|
561
|
-
var PLUGIN_NAME = "semantic-release-pnpm";
|
|
562
|
-
var verified;
|
|
563
|
-
var prepared;
|
|
564
|
-
async function verifyConditions(pluginConfig, context) {
|
|
565
|
-
if (context.options?.["publish"]) {
|
|
566
|
-
const publish2 = Array.isArray(context.options?.["publish"]) ? context.options?.["publish"] : [context.options?.["publish"]];
|
|
567
|
-
const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME) || {};
|
|
568
|
-
pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;
|
|
569
|
-
pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;
|
|
570
|
-
pluginConfig.pkgRoot = pluginConfig.pkgRoot ?? publishPlugin.pkgRoot;
|
|
571
|
-
}
|
|
572
|
-
await verify_default(pluginConfig, context);
|
|
573
|
-
verified = true;
|
|
574
|
-
}
|
|
575
|
-
async function prepare(pluginConfig, context) {
|
|
576
|
-
if (!verified) {
|
|
577
|
-
await verify_default(pluginConfig, context);
|
|
578
|
-
}
|
|
579
|
-
await prepare_default(pluginConfig, context);
|
|
580
|
-
prepared = true;
|
|
581
|
-
}
|
|
582
|
-
async function publish(pluginConfig, context) {
|
|
583
|
-
const package_ = await get_pkg_default(pluginConfig, context);
|
|
584
|
-
if (!verified) {
|
|
585
|
-
await verify_default(pluginConfig, context);
|
|
586
|
-
}
|
|
587
|
-
if (!prepared) {
|
|
588
|
-
await prepare_default(pluginConfig, context);
|
|
589
|
-
}
|
|
590
|
-
return publish_default(pluginConfig, package_, context);
|
|
591
|
-
}
|
|
592
|
-
async function addChannel(pluginConfig, context) {
|
|
593
|
-
if (!verified) {
|
|
594
|
-
await verify_default(pluginConfig, context);
|
|
595
|
-
}
|
|
596
|
-
const package_ = await get_pkg_default(pluginConfig, context);
|
|
597
|
-
return add_channel_default(pluginConfig, package_, context);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
export { addChannel, prepare, publish, verifyConditions };
|
|
21
|
+
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."}),EINVALIDPKGROOT:({pkgRoot:e})=>({details:`The [pkgRoot option](${h("README.md#pkgroot")}) option, if defined, must be a \`String\`.
|
|
22
|
+
Your configuration for the \`pkgRoot\` option is \`${e}\`.`,message:"Invalid `pkgRoot` option."}),EINVALIDPNPM:({version:e})=>({details:`The version of Pnpm that you are using is not compatible. Please refer to [the README](${h("README.md#install")}) to review which versions of Pnpm are currently supported
|
|
23
|
+
|
|
24
|
+
Your version of Pnpm is "${e}".`,message:"Incompatible Pnpm version detected."}),EINVALIDPUBLISHBRANCH:({publishBranch:e})=>({details:`The [publishBranch option](${h("README.md#publishBranch")}) option, if defined, must be a \`String\`.
|
|
25
|
+
Your configuration for the \`publishBranch\` option is \`${e}\`.`,message:"Invalid `publishBranch` option."}),EINVALIDTARBALLDIR:({tarballDir:e})=>({details:`The [tarballDir option](${h("README.md#tarballdir")}) option, if defined, must be a \`String\`.
|
|
26
|
+
Your configuration for the \`tarballDir\` option is \`${e}\`.`,message:"Invalid `tarballDir` option."}),ENONPMTOKEN:({registry:e})=>({details:`An [npm token](${h("README.md#npm-registry-authentication")}) must be created and set in the \`NPM_TOKEN\` environment variable on your CI environment.
|
|
27
|
+
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 \`${e}\`.`,message:"No npm token specified."}),ENOPKG:()=>({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."}),ENOPKGNAME:()=>({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`."}),ENOPNPM:()=>({details:"The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.",message:"Pnpm not found."}),ENOPNPMRC:()=>({details:"Didnt find a `.npmrc` file or it was not possible to create , in the root of your project.",message:"Missing `.npmrc` file."})};var g=(e,t={})=>{let{details:r,message:o}=K[e](t);return new ce(o,e,r)};var he=(e,t)=>{let r=t.NPM_CONFIG_USERCONFIG,o=resolve(e,".npmrc");if(!r&&isAccessibleSync(o))r=o;else if(!r){let n=findCacheDirectorySync("semantic-release-pnpm",{create:!0,cwd:e});n&&(ensureFile(n),r=n);}if(!r)throw new AggregateError([g("ENOPNPMRC",{npmrc:o})]);return r},w=he;var C="https://registry.npmjs.org/";var ye=e=>{try{JSON.parse(e);}catch{return !1}return !0},Y=ye;var ke=(e,t=process.env)=>{let r={},o=e.length;for(let n in t)if(n.toLowerCase().indexOf(e.toLowerCase())===0){let i=n.slice(Math.max(0,o)).split("__"),c;for(;(c=i.indexOf(""))>-1;)i.splice(c,1);let s=r;i.forEach((p,a)=>{!p||typeof s!="object"||(a===i.length-1&&(s[p]=t[n]),s[p]===void 0&&(s[p]={}),s=s[p]);});}return r},we=(e,t,r)=>{let o=[join(t,".config",e,"config"),join(t,".config",e),join(t,`.${e}`,"config"),join(t,`.${e}rc`)],n=new Set;for(let i of o)isAccessibleSync(i)&&n.add(i),isAccessibleSync(`${i}.json`)&&n.add(`${i}.json`);for(let i of [`.${e}rc.json`,`.${e}rc`,`.${e}`,"config.json","config"]){let c=findUpSync(i,{cwd:r,type:"file"});c&&n.add(c);}return [...n]},$=(e,t)=>{t={cwd:cwd(),home:homedir(),...t};let r=ke(`${e}_`),o=new Set(we(e,t.home,t.cwd));typeof r.config=="string"&&isAccessibleSync(r.config)&&o.add(r.config),t.config&&isAccessibleSync(t.config)&&o.add(t.config);let n=[...o],i=[];for(let c of n){let s=readFileSync(c);Y(s)?i.push(JSON.parse(s)):i.push(parse(s));}return {config:merge(...i),files:n}};var Re=(e,t)=>{let r=C;if(t){let o=t[`${e}:registry`]??t.registry;o&&(r=o);}return r.slice(-1)==="/"?r:`${r}/`},b=({name:e,publishConfig:{registry:t}={}},{cwd:r,env:o})=>t??o.NPM_CONFIG_REGISTRY??Re(e.split("/")[0],$("npm",{config:o.NPM_CONFIG_USERCONFIG??resolve(r,".npmrc"),cwd:r,defaults:{registry:"https://registry.npmjs.org/"}}).config);var I=({name:e},{env:{DEFAULT_NPM_REGISTRY:t="https://registry.npmjs.org/"},nextRelease:{version:r}},o,n)=>({channel:o,name:`pnpm package (@${o} dist-tag)`,url:z(n)===z(t)?`https://www.npmjs.com/package/${e}/v/${r}`:void 0});var v=(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,P=(e,t)=>v(e,t)===null;var H=async(e,t,r)=>{let{cwd:o,env:n,logger:i,nextRelease:{channel:c,version:s},stderr:p,stdout:a}=r;if(P(e,t)){let f=b(t,r),d=k(c);i.log(`Adding version ${s} to npm registry on dist-tag ${d}`);let y=w(o,n),u=execa("pnpm",["dist-tag","add",`${t.name}@${s}`,d,"--userconfig",y,"--registry",f],{cwd:o,env:n,preferLocal:!0});return u.stdout.pipe(a,{end:!1}),u.stderr.pipe(p,{end:!1}),await u,i.log(`Added ${t.name}@${s} to dist-tag @${d} on ${f}`),I(t,r,d,f)}return i.log(`Skip adding to npm channel as ${v(e,t)}`),!1};var S=async({pkgRoot:e,tarballDir:t},{cwd:r,env:o,logger:n,nextRelease:{version:i},stderr:c,stdout:s})=>{let p=e?resolve(r,e):r;n.log("Write version %s to package.json in %s",i,p);let a=execa("pnpm",["version",i,"--no-git-tag-version","--allow-same-version"],{cwd:p,env:o,preferLocal:!0});if(a.stdout.pipe(s,{end:!1}),a.stderr.pipe(c,{end:!1}),await a,t){n.log("Creating npm package version %s",i);let f=execa("pnpm",["pack",p],{cwd:r,env:o,preferLocal:!0});f.stdout.pipe(s,{end:!1}),f.stderr.pipe(c,{end:!1});let d=(await f).stdout.split(`
|
|
28
|
+
`).pop(),y=resolve(r,d),u=resolve(r,t.trim(),d);y!==u&&await moveFile(y,u);}};var Q=async(e,t,r)=>{let{cwd:o,env:n,logger:i,nextRelease:{channel:c,version:s},stderr:p,stdout:a}=r,{pkgRoot:f,publishBranch:d}=e;if(P(e,t)){let y=f?resolve(o,f):o,u=b(t,r),E=k(c),{stdout:V}=await execa("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:o,env:n,preferLocal:!0}),F=typeof d=="string"&&d.split("|"),G=F&&F?.includes(V)?V:"main";i.log(`Publishing version ${s} on branch ${G} to npm registry on dist-tag ${E}`);let B=["publish",y,"--publish-branch",G,"--tag",E,"--registry",u,"--no-git-checks"];e.disableScripts&&B.push("--ignore-scripts");let D=execa("pnpm",B,{cwd:o,env:n,preferLocal:!0});D.stdout.pipe(a,{end:!1}),D.stderr.pipe(p,{end:!1});try{await D;}catch(_){throw i.log(`Failed to publish ${t.name}@${s} to dist-tag @${E} on ${u}: ${_.message??_}`),new X([_])}return i.log(`Published ${t.name}@${s} to dist-tag @${E} on ${u}`),I(t,r,E,u)}return i.log(`Skip publishing to npm registry as ${v(e,t)}`),!1};var x=async({pkgRoot:e},{cwd:t})=>{try{let{packageJson:r}=await findPackageJson(e?resolve(t,e):t);if(!r.name)throw new X([g("ENOPKGNAME")]);return r}catch(r){throw r.code==="ENOENT"?new X([g("ENOPKG")]):r}};var je=e=>{let t=new URL(e),r=`${t.protocol}//${t.host}${t.pathname}`,o=new URL(".",r);return `//${o.host}${o.pathname}`},ee=je;var te=async(e,t,{cwd:r,env:{NPM_CONFIG_USERCONFIG:o,NPM_EMAIL:n,NPM_PASSWORD:i,NPM_TOKEN:c,NPM_USERNAME:s},logger:p})=>{p.log("Verify authentication for registry %s",t);let{config:a,files:f}=$("npm",{config:o??resolve(r,".npmrc"),cwd:r,defaults:{registry:C}});if(f&&p.log("Reading npm config from %s",f.join(", ")),Te(t,{npmrc:a})){await writeFile(e,stringify(a));return}if(s&&i&&n)await writeFile(e,`${a?`${stringify(a)}
|
|
29
|
+
`:""}_auth = \${LEGACY_TOKEN}
|
|
30
|
+
email = \${NPM_EMAIL}`),p.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${e}`);else if(c)await writeFile(e,`${a?`${stringify(a)}
|
|
31
|
+
`:""}${ee(t)}:_authToken = \${NPM_TOKEN}`),p.log(`Wrote NPM_TOKEN to ${e}`);else throw new X([g("ENONPMTOKEN",{registry:t})])};var oe=async(e,t,r)=>{let{cwd:o,env:{DEFAULT_NPM_REGISTRY:n="https://registry.npmjs.org/",...i},logger:c,stderr:s,stdout:p}=r,a=b(t,r);if(await te(e,a,r),z(a)===z(n))try{c.log(`Running "pnpm whoami" to verify authentication on registry "${a}"`);let f=execa("pnpm",["whoami","--userconfig",e,"--registry",a],{cwd:o,env:i,preferLocal:!0});f.stdout.pipe(p,{end:!1}),f.stderr.pipe(s,{end:!1}),await f;}catch{throw new X([g("EINVALIDNPMTOKEN",{registry:a})])}else c.log(`Skipping authentication verification for non-default registry "${a}"`);};var Ve=e=>typeof e=="string",Fe=e=>e==null,L=e=>Ve(e)?e.trim()!=="":!1,ne={branches:Array.isArray,npmPublish:e=>typeof e=="boolean",pkgRoot:L,publishBranch:L,tarballDir:L},ie=e=>Object.entries(e).reduce((t,[r,o])=>Fe(o)||!(r in ne)||ne[r]?.(o)?t:[...t,g(`EINVALID${r.toUpperCase()}`,{[r]:o})],[]);var ae="8.0.0";async function J({logger:e}){e.log(`Verify pnpm version is >= ${ae}`);let t=await getPackageManagerVersion("pnpm");if(t===void 0)throw new X([new Error("pnpm is not installed")]);if(gte(ae,t))throw new X([g("EINVALIDPNPM",{version:String(t)})])}var Ke=async(e,t)=>{let r=ie(e);try{J(t);}catch(o){let n=o;r=[...r,...n.errors??[o]];}try{let o=await x(e,t);if(P(e,o)){let n=w(t.cwd,t.env);await oe(n,o,t);}}catch(o){let n=o;r=[...r,...n.errors??[o]];}if(r.length>0)throw new X(r)},N=Ke;var Ye="semantic-release-pnpm",M,pe,Zr=async(e,t)=>{if(t.options?.publish){let o=(Array.isArray(t.options?.publish)?t.options?.publish:[t.options?.publish]).find(n=>n.path&&n.path===Ye)||{};e.npmPublish=e.npmPublish??o.npmPublish,e.tarballDir=e.tarballDir??o.tarballDir,e.pkgRoot=e.pkgRoot??o.pkgRoot,e.disableScripts=e.disableScripts??o.disableScripts,e.branches=e.branches??o.branches;}await N(e,t),M=!0;},eo=async(e,t)=>{M||await N(e,t),await S(e,t),pe=!0;},to=async(e,t)=>{let r=await x(e,t);return M||await N(e,t),pe||await S(e,t),Q(e,r,t)},ro=async(e,t)=>{M||await N(e,t);let r=await x(e,t);return H(e,r,t)};
|
|
32
|
+
|
|
33
|
+
export { ro as addChannel, eo as prepare, to as publish, Zr as verifyConditions };
|
|
601
34
|
//# sourceMappingURL=out.js.map
|
|
602
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/add-channel.ts","../src/utils/get-channel.ts","../src/utils/get-npmrc.ts","../src/utils/get-error.ts","../package.json","../src/definitions/errors.ts","../src/utils/get-registry.ts","../src/definitions/constants.ts","../src/utils/get-release-info.ts","../src/utils/should-publish.ts","../src/prepare.ts","../src/publish.ts","../src/utils/get-pkg.ts","../src/verify/index.ts","../src/verify/verify-auth.ts","../src/utils/set-npmrc-auth.ts","../src/utils/nerf-dart.ts","../src/verify/verify-config.ts","../src/verify/verify-pnpm.ts","../src/index.ts"],"names":["resolve","DEFAULT_NPM_REGISTRY","execa","AggregateError","normalizeUrl","rc","errors","publish"],"mappings":";AACA,SAAS,aAAa;;;ACDtB,SAAS,kBAAkB;AAE3B,IAAO,sBAAQ,CAAC,YAAgD,UAAW,WAAW,OAAO,IAAI,WAAW,OAAO,KAAK,UAAW;;;ACDnI,SAAS,YAAY,wBAAwB;AAE7C,SAAS,8BAA8B;AAEvC,SAAS,eAAe;;;ACLxB,O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AAa,UAAU,aAAa,WAAW,cAAc;AAAA,EACjE;AAEA,QAAM,eAAO,cAAc,OAAO;AAElC,aAAW;AACf;AAEA,eAAsB,QAAQ,cAA4B,SAAyB;AAC/E,MAAI,CAAC,UAAU;AACX,UAAM,eAAO,cAAc,OAAO;AAAA,EACtC;AAEA,QAAM,gBAAW,cAAc,OAAO;AAEtC,aAAW;AACf;AAEA,eAAsB,QAAQ,cAA4B,SAAyB;AAC/E,QAAM,WAAW,MAAM,gBAAW,cAAc,OAAO;AAEvD,MAAI,CAAC,UAAU;AACX,UAAM,eAAO,cAAc,OAAO;AAAA,EACtC;AAEA,MAAI,CAAC,UAAU;AACX,UAAM,gBAAW,cAAc,OAAO;AAAA,EAC1C;AAEA,SAAO,gBAAW,cAAc,UAAU,OAAO;AACrD;AAEA,eAAsB,WAAW,cAA4B,SAA4B;AACrF,MAAI,CAAC,UAAU;AACX,UAAM,eAAO,cAAc,OAAO;AAAA,EACtC;AAEA,QAAM,WAAW,MAAM,gBAAW,cAAc,OAAO;AAEvD,SAAO,oBAAc,cAAc,UAAU,OAAO;AACxD","sourcesContent":["import type { PackageJson } from \"@visulima/package\";\nimport { execa } from \"execa\";\n\nimport type { AddChannelContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport getChannel from \"./utils/get-channel\";\nimport getNpmrc from \"./utils/get-npmrc\";\nimport getRegistry from \"./utils/get-registry\";\nimport type { ReleaseInfo } from \"./utils/get-release-info\";\nimport { getReleaseInfo } from \"./utils/get-release-info\";\nimport { reasonToNotPublish, shouldPublish } from \"./utils/should-publish\";\n\nexport default async (pluginConfig: PluginConfig, package_: PackageJson, context: AddChannelContext): Promise<ReleaseInfo | boolean> => {\n const {\n cwd,\n env,\n logger,\n nextRelease: { channel, version },\n stderr,\n stdout,\n } = context;\n\n if (shouldPublish(pluginConfig, package_)) {\n const registry = getRegistry(package_, context);\n const distributionTag = getChannel(channel);\n\n logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);\n\n const npmrc = getNpmrc(cwd, env);\n\n const result = execa(\"pnpm\", [\"dist-tag\", \"add\", `${package_.name}@${version}`, distributionTag, \"--userconfig\", npmrc, \"--registry\", registry], {\n cwd,\n env,\n preferLocal: true,\n });\n\n result.stdout.pipe(stdout, { end: false });\n result.stderr.pipe(stderr, { end: false });\n\n await result;\n\n logger.log(`Added ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);\n\n return getReleaseInfo(package_, context, distributionTag, registry);\n }\n\n logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, package_)}`);\n\n return false;\n};\n","import { validRange } from \"semver\";\n\nexport default (channel: string | null | undefined): string => (channel ? (validRange(channel) ? `release-${channel}` : channel) : \"latest\");\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ensureFile, isAccessibleSync } from \"@visulima/fs\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { findCacheDirectorySync } from \"@visulima/package\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { resolve } from \"@visulima/path\";\n\nimport getError from \"./get-error\";\n\nconst getNpmrc = (cwd: string, environment: NodeJS.ProcessEnv): string => {\n let npmrc = environment.NPM_CONFIG_USERCONFIG;\n\n const npmrcPath = resolve(cwd, \".npmrc\");\n\n if (!npmrc && isAccessibleSync(npmrcPath)) {\n npmrc = npmrcPath;\n } else if (!npmrc) {\n const temporaryNpmrcPath = findCacheDirectorySync(\"semantic-release-pnpm\", { create: true, cwd });\n\n if (temporaryNpmrcPath) {\n ensureFile(temporaryNpmrcPath);\n\n npmrc = temporaryNpmrcPath;\n }\n }\n\n if (!npmrc) {\n // eslint-disable-next-line unicorn/error-message\n throw new AggregateError([\n getError(\"ENOPNPMRC\", {\n npmrc: npmrcPath,\n }),\n ]);\n }\n\n return npmrc;\n};\n\nexport default getNpmrc;\n","import SemanticReleaseError from \"@semantic-release/error\";\n\nimport type { ErrorContext, ErrorDefinition } from \"../definitions/errors\";\nimport { errors } from \"../definitions/errors\";\n\nexport default <T extends keyof typeof errors>(code: T, context: ErrorContext = {}): SemanticReleaseError => {\n const { details, message }: { details?: string; message: string } = (errors[code] as ErrorDefinition)(context);\n\n return new SemanticReleaseError(message, code, details);\n};\n","{\n \"name\": \"@anolilab/semantic-release-pnpm\",\n \"version\": \"1.0.0-alpha.1\",\n \"description\": \"Semantic-release plugin to publish a npm package with pnpm.\",\n \"keywords\": [\n \"anolilab\",\n \"npm\",\n \"publish\",\n \"semantic-release\",\n \"pnpm\",\n \"monorepo\"\n ],\n \"homepage\": \"https://github.com/anolilab/semantic-release-pnpm\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/anolilab/semantic-release-pnpm.git\"\n },\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"Daniel Bannert\",\n \"email\": \"d.bannert@anolilab.de\"\n },\n \"type\": \"module\",\n \"exports\": \"./dist/index.js\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"CHANGELOG.md\"\n ],\n \"scripts\": {\n \"build\": \"cross-env NODE_ENV=development tsup\",\n \"build:prod\": \"cross-env NODE_ENV=production tsup\",\n \"lint:eslint\": \"eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs\",\n \"lint:eslint:fix\": \"pnpm run lint:eslint --fix\",\n \"lint:fix\": \"pnpm run lint:prettier:fix && pnpm run lint:eslint:fix\",\n \"lint:packagejson\": \"publint --strict\",\n \"lint:prettier\": \"prettier --config=.prettierrc.cjs --check .\",\n \"lint:prettier:fix\": \"prettier --config=.prettierrc.cjs --write .\",\n \"lint:secrets\": \"secretlint **/*\",\n \"lint:staged\": \"lint-staged --verbose --concurrent false --debug\",\n \"lint:text\": \"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --cache --dry-run\",\n \"lint:text:fix\": \"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --fix\",\n \"lint:types\": \"tsc --noEmit\",\n \"prepare\": \"is-ci || (node verify-node-version.cjs && pnpx only-allow pnpm && husky install)\",\n \"sort-package-json\": \"sort-package-json ./package.json\",\n \"test\": \"vitest run\",\n \"test:bench\": \"vitest bench\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:watch\": \"vitest\",\n \"update:deps\": \"taze\"\n },\n \"dependencies\": {\n \"@visulima/package\": \"1.8.1\",\n \"@visulima/fs\": \"^2.1.1\",\n \"@visulima/path\": \"^1.0.0\",\n \"@semantic-release/error\": \"^4.0.0\",\n \"aggregate-error\": \"^5.0.0\",\n \"execa\": \"^9.1.0\",\n \"move-file\": \"^3.1.0\",\n \"normalize-url\": \"^8.0.1\",\n \"rc\": \"^1.2.8\",\n \"registry-auth-token\": \"^5.0.2\",\n \"semver\": \"^7.6.2\"\n },\n \"devDependencies\": {\n \"@anolilab/commitlint-config\": \"^5.0.3\",\n \"@anolilab/eslint-config\": \"^15.0.3\",\n \"@anolilab/lint-staged-config\": \"^2.1.7\",\n \"@anolilab/prettier-config\": \"^5.0.14\",\n \"@anolilab/textlint-config\": \"^8.0.16\",\n \"@babel/core\": \"^7.24.5\",\n \"@babel/eslint-parser\": \"7.24.5\",\n \"@commitlint/cli\": \"^19.3.0\",\n \"@commitlint/config-conventional\": \"^19.2.2\",\n \"@secretlint/secretlint-rule-preset-recommend\": \"^8.2.4\",\n \"@semantic-release/changelog\": \"^6.0.3\",\n \"@semantic-release/git\": \"^10.0.1\",\n \"@semantic-release/github\": \"^10.0.3\",\n \"@types/dockerode\": \"^3.3.29\",\n \"@types/node\": \"^20.12.12\",\n \"@types/rc\": \"^1.2.4\",\n \"@types/semantic-release__error\": \"3.0.3\",\n \"@types/semver\": \"7.5.8\",\n \"@vitest/coverage-v8\": \"^1.6.0\",\n \"commitizen\": \"^4.3.0\",\n \"commitlint\": \"^19.3.0\",\n \"cross-env\": \"^7.0.3\",\n \"cz-conventional-changelog\": \"^3.3.0\",\n \"dockerode\": \"4.0.2\",\n \"eslint\": \"8.55.0\",\n \"eslint-plugin-deprecation\": \"^2.0.0\",\n \"eslint-plugin-editorconfig\": \"^4.0.3\",\n \"eslint-plugin-import\": \"npm:eslint-plugin-i@2.29.1\",\n \"eslint-plugin-mdx\": \"^3.1.5\",\n \"eslint-plugin-n\": \"^17.7.0\",\n \"eslint-plugin-vitest\": \"^0.4.1\",\n \"eslint-plugin-vitest-globals\": \"^1.5.0\",\n \"eslint-plugin-you-dont-need-lodash-underscore\": \"^6.14.0\",\n \"get-stream\": \"9.0.1\",\n \"husky\": \"^9.0.11\",\n \"is-ci\": \"^3.0.1\",\n \"lint-staged\": \"^15.2.2\",\n \"prettier\": \"^3.2.5\",\n \"publint\": \"^0.2.7\",\n \"rimraf\": \"^5.0.7\",\n \"secretlint\": \"8.2.4\",\n \"semantic-release\": \"^23.1.1\",\n \"sort-package-json\": \"^2.10.0\",\n \"taze\": \"^0.13.8\",\n \"tempy\": \"^3.1.0\",\n \"textlint\": \"^14.0.4\",\n \"tsup\": \"^8.0.2\",\n \"typescript\": \"^5.4.5\",\n \"vitest\": \"^1.6.0\"\n },\n \"peerDependencies\": {\n \"semantic-release\": \"^20.0 || ^21.0 || >=22.0.3\"\n },\n \"packageManager\": \"pnpm@9.1.1\",\n \"engines\": {\n \"node\": \">=18 || >=20.6.1\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"anolilab\": {\n \"eslint-config\": {\n \"plugin\": {},\n \"warn_on_unsupported_typescript_version\": false,\n \"info_on_disabling_jsx_react_rule\": false,\n \"info_on_disabling_prettier_conflict_rule\": false,\n \"info_on_disabling_jsonc_sort_keys_rule\": false,\n \"import_ignore_exports\": [\n \"**/*.cjs\",\n \"verify-node-version.cjs\"\n ]\n }\n },\n \"pnpm\": {\n \"overrides\": {\n \"chrono-node@<2.2.4\": \">=2.2.4\"\n }\n }\n}\n","import package_ from \"../../package.json\";\n\nconst linkify = (file: string) => `${package_.homepage}/blob/main/${file}`;\n\n\ninterface ErrorDetails {\n details: string;\n message: string;\n}\n\nexport type ErrorDefinition = (context: ErrorContext) => ErrorDetails;\n\nexport interface ErrorContext {\n npmPublish?: boolean;\n npmrc?: string;\n pkgRoot?: string;\n publishBranch?: string;\n registry?: string;\n tarballDir?: string;\n version?: string;\n}\n\nexport const errors = {\n EINVALIDNPMPUBLISH: ({ npmPublish }: ErrorContext) => {\n return {\n details: `The [npmPublish option](${linkify(\"README.md#npmpublish\")}) option, if defined, must be a \\`Boolean\\`.\nYour configuration for the \\`npmPublish\\` option is \\`${npmPublish}\\`.`,\n message: \"Invalid `npmPublish` option.\",\n };\n },\n EINVALIDNPMTOKEN: ({ registry }: ErrorContext) => {\n return {\n details: `The [npm token](${linkify(\n \"README.md#npm-registry-authentication\",\n )}) 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 \\`${registry}\\`.\nIf 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.\nPlease make sure to set the \\`NPM_TOKEN\\` environment variable in your CI with the exact value of the npm token.`,\n message: \"Invalid npm token.\",\n };\n },\n EINVALIDPKGROOT: ({ pkgRoot }: ErrorContext) => {\n return {\n details: `The [pkgRoot option](${linkify(\"README.md#pkgroot\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`pkgRoot\\` option is \\`${pkgRoot}\\`.`,\n message: \"Invalid `pkgRoot` option.\",\n };\n },\n EINVALIDPNPM: ({ version }: ErrorContext) => {\n return {\n details: `The version of Pnpm that you are using is not compatible. Please refer to [the README](${linkify(\n \"README.md#install\",\n )}) to review which versions of Pnpm are currently supported\n\nYour version of Pnpm is \"${version}\".`,\n message: \"Incompatible Pnpm version detected.\",\n };\n },\n EINVALIDPUBLISHBRANCH: ({ publishBranch }: ErrorContext) => {\n return {\n details: `The [publishBranch option](${linkify(\"README.md#publishBranch\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`publishBranch\\` option is \\`${publishBranch}\\`.`,\n message: \"Invalid `publishBranch` option.\",\n };\n },\n EINVALIDTARBALLDIR: ({ tarballDir }: ErrorContext) => {\n return {\n details: `The [tarballDir option](${linkify(\"README.md#tarballdir\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`tarballDir\\` option is \\`${tarballDir}\\`.`,\n message: \"Invalid `tarballDir` option.\",\n };\n },\n ENONPMTOKEN: ({ registry }: ErrorContext) => {\n return {\n details: `An [npm token](${linkify(\n \"README.md#npm-registry-authentication\",\n )}) must be created and set in the \\`NPM_TOKEN\\` environment variable on your CI environment.\nPlease 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 \\`${registry}\\`.`,\n message: \"No npm token specified.\",\n };\n },\n ENOPKG: () => {\n return {\n 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.`,\n message: \"Missing `package.json` file.\",\n };\n },\n ENOPKGNAME: () => {\n return {\n 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\\`.`,\n message: \"Missing `name` property in `package.json`.\",\n };\n },\n ENOPNPM: () => {\n return {\n details: `The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.`,\n message: \"Pnpm not found.\",\n };\n },\n ENOPNPMRC: () => {\n return {\n details: `Didnt find a \\`.npmrc\\` file or it was not possible to create , in the root of your project.`,\n message: \"Missing `.npmrc` file.\",\n };\n },\n EINVALIDBRANCHES: (branches: string[]) => {\n return {\n details: `The [branches option](${linkify(\"README.md#branches\")}) option, if defined, must be an array of \\`String\\`.\nYour configuration for the \\`branches\\` option is \\`${branches}\\`.`,\n message: \"Invalid `branches` option.\",\n };\n },\n};\n","import type { PackageJson } from \"@visulima/package\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { resolve } from \"@visulima/path\";\nimport rc from \"rc\";\nimport type { AuthOptions } from \"registry-auth-token\";\n\nimport { DEFAULT_NPM_REGISTRY } from \"../definitions/constants\";\nimport type { CommonContext } from \"../definitions/context\";\n\nconst getRegistryUrl = (scope: string, npmrc: AuthOptions[\"npmrc\"]): string => {\n let url: string = DEFAULT_NPM_REGISTRY;\n\n if (npmrc) {\n const registryUrl = npmrc[`${scope}:registry`] ?? npmrc[\"registry\"];\n\n if (registryUrl) {\n url = registryUrl;\n }\n }\n\n return url.slice(-1) === \"/\" ? url : `${url}/`;\n};\n\nexport default ({ name, publishConfig: { registry } = {} }: PackageJson, { cwd, env }: CommonContext): string =>\n registry ??\n env.NPM_CONFIG_REGISTRY ??\n getRegistryUrl(\n (name as string).split(\"/\")[0] as string,\n rc(\"npm\", { registry: \"https://registry.npmjs.org/\" }, { config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, \".npmrc\") }) as AuthOptions[\"npmrc\"],\n );\n","export const DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\";\n","import type { PackageJson } from \"@visulima/package\";\nimport normalizeUrl from \"normalize-url\";\n\nimport type { PublishContext } from \"../definitions/context\";\n\nexport interface ReleaseInfo {\n channel: string;\n name: string;\n url?: string;\n}\n\nexport const getReleaseInfo = (\n { name }: PackageJson,\n { env: { DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\" }, nextRelease: { version } }: PublishContext,\n distributionTag: string,\n registry: string,\n): ReleaseInfo => {\n return {\n channel: distributionTag,\n name: `pnpm package (@${distributionTag} dist-tag)`,\n url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY) ? `https://www.npmjs.com/package/${name}/v/${version}` : undefined,\n };\n};\n","import type { PackageJson } from \"@visulima/package\";\n\nimport type { PluginConfig } from \"../definitions/plugin-config\";\n\nexport function shouldPublish(pluginConfig: PluginConfig, package_: PackageJson) {\n return reasonToNotPublish(pluginConfig, package_) === null;\n}\n/**\n * Returns null if `npmPublish` is not `false` and `pkg.private` is not\n * `true` or `pkg.workspaces` is not `undefined`.\n * Returns reason otherwise.\n */\nexport function reasonToNotPublish(pluginConfig: PluginConfig, package_: PackageJson) {\n return pluginConfig.npmPublish === false\n ? \"npmPublish plugin option is false\"\n : package_.private === true && package_.workspaces === undefined\n ? \"package is private and has no workspaces\"\n : null;\n}\n","import { resolve } from \"@visulima/path\";\nimport { execa } from \"execa\";\nimport { moveFile } from \"move-file\";\n\nimport type { PrepareContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\n\nexport default async ({ pkgRoot, tarballDir }: PluginConfig, { cwd, env, logger, nextRelease: { version }, stderr, stdout }: PrepareContext): Promise<void> => {\n const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;\n\n logger.log(\"Write version %s to package.json in %s\", version, basePath);\n\n const versionResult = execa(\"pnpm\", [\"version\", version, \"--no-git-tag-version\", \"--allow-same-version\"], {\n cwd: basePath,\n env,\n preferLocal: true,\n });\n\n versionResult.stdout.pipe(stdout, { end: false });\n versionResult.stderr.pipe(stderr, { end: false });\n\n await versionResult;\n\n if (tarballDir) {\n logger.log(\"Creating npm package version %s\", version);\n\n const packResult = execa(\"pnpm\", [\"pack\", basePath], { cwd, env, preferLocal: true });\n\n packResult.stdout.pipe(stdout, { end: false });\n packResult.stderr.pipe(stderr, { end: false });\n\n const tarball = (await packResult).stdout.split(\"\\n\").pop() as string;\n const tarballSource = resolve(cwd, tarball);\n const tarballDestination = resolve(cwd, tarballDir.trim(), tarball);\n\n // Only move the tarball if we need to\n // Fixes: https://github.com/semantic-release/npm/issues/169\n if (tarballSource !== tarballDestination) {\n await moveFile(tarballSource, tarballDestination);\n }\n }\n};\n","import type { PackageJson } from \"@visulima/package\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { resolve } from \"@visulima/path\";\nimport AggregateError from \"aggregate-error\";\nimport { execa } from \"execa\";\n\nimport type { PublishContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport getChannel from \"./utils/get-channel\";\nimport getRegistry from \"./utils/get-registry\";\nimport { getReleaseInfo } from \"./utils/get-release-info\";\nimport { reasonToNotPublish, shouldPublish } from \"./utils/should-publish\";\n\nexport default async (pluginConfig: PluginConfig, package_: PackageJson, context: PublishContext) => {\n const {\n cwd,\n env,\n logger,\n nextRelease: { channel, version },\n stderr,\n stdout,\n } = context;\n const { pkgRoot, publishBranch: publishBranchConfig } = pluginConfig;\n\n if (shouldPublish(pluginConfig, package_)) {\n const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;\n const registry = getRegistry(package_, context);\n const distributionTag = getChannel(channel);\n\n const { stdout: currentBranch } = await execa(\"git\", [\"rev-parse\", \"--abbrev-ref\", \"HEAD\"], {\n cwd,\n env,\n preferLocal: true,\n });\n const publishBranches = typeof publishBranchConfig === \"string\" && publishBranchConfig.split(\"|\");\n const isPublishBranch = publishBranches && publishBranches?.includes(currentBranch);\n const publishBranch = isPublishBranch ? currentBranch : \"main\";\n\n logger.log(`Publishing version ${version} on branch ${publishBranch} to npm registry on dist-tag ${distributionTag}`);\n\n const result = execa(\"pnpm\", [\"publish\", basePath, \"--publish-branch\", publishBranch, \"--tag\", distributionTag, \"--registry\", registry, \"--no-git-checks\"], {\n cwd,\n env,\n preferLocal: true,\n });\n\n result.stdout.pipe(stdout, { end: false });\n result.stderr.pipe(stderr, { end: false });\n\n try {\n await result;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n logger.log(`Failed to publish ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}: ${error.message || error}`);\n\n throw new AggregateError([error]);\n }\n\n logger.log(`Published ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);\n\n return getReleaseInfo(package_, context, distributionTag, registry);\n }\n\n logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, package_)}`);\n\n return false;\n};\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { PackageJson } from \"@visulima/package\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { findPackageJson } from \"@visulima/package\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { resolve } from \"@visulima/path\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"./get-error\";\n\ninterface Options {\n pkgRoot?: string;\n}\n\nexport default async ({ pkgRoot }: Options, { cwd }: { cwd: CommonContext[\"cwd\"] }): Promise<PackageJson> => {\n try {\n const { packageJson } = await findPackageJson(pkgRoot ? resolve(cwd, pkgRoot) : cwd);\n\n if (!packageJson.name) {\n throw getError(\"ENOPKGNAME\");\n }\n\n return packageJson;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n throw getError(\"ENOPKG\");\n }\n\n throw error;\n }\n};\n","import AggregateError from \"aggregate-error\";\n\nimport type { VerifyConditionsContext } from \"../definitions/context\";\nimport type { PluginConfig } from \"../definitions/plugin-config\";\nimport getNpmrc from \"../utils/get-npmrc\";\nimport getPackage from \"../utils/get-pkg\";\nimport { shouldPublish } from \"../utils/should-publish\";\nimport verifyAuth from \"./verify-auth\";\nimport verifyConfig from \"./verify-config\";\nimport verifyPnpm from \"./verify-pnpm\";\n\nconst verify = async (pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> => {\n let errors: Error[] = verifyConfig(pluginConfig);\n\n try {\n verifyPnpm(context);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n errors = [...errors, ...(error.errors ? error.errors : [error])];\n }\n\n try {\n const packageJson = await getPackage(pluginConfig, context);\n\n if (shouldPublish(pluginConfig, packageJson)) {\n const npmrc = getNpmrc(context.cwd, context.env);\n\n await verifyAuth(npmrc, packageJson, context);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n errors = [...errors, ...(error.errors ? error.errors : [error])];\n }\n\n if (errors.length > 0) {\n throw new AggregateError(errors);\n }\n}\n\nexport default verify;\n","import type { PackageJson } from \"@visulima/package\";\nimport AggregateError from \"aggregate-error\";\nimport { execa } from \"execa\";\nimport normalizeUrl from \"normalize-url\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"../utils/get-error\";\nimport getRegistry from \"../utils/get-registry\";\nimport setNpmrcAuth from \"../utils/set-npmrc-auth\";\n\nexport default async (npmrc: string, package_: PackageJson, context: CommonContext): Promise<void> => {\n const {\n cwd,\n env: { DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\", ...environment },\n logger,\n stderr,\n stdout,\n } = context;\n const registry = getRegistry(package_, context);\n\n await setNpmrcAuth(npmrc, registry, context);\n\n if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {\n try {\n logger.log(`Running \"pnpm whoami\" to verify authentication on registry \"${registry}\"`);\n\n const whoamiResult = execa(\"pnpm\", [\"whoami\", \"--userconfig\", npmrc, \"--registry\", registry], {\n cwd,\n env: environment,\n preferLocal: true,\n });\n\n whoamiResult.stdout.pipe(stdout, { end: false });\n whoamiResult.stderr.pipe(stderr, { end: false });\n\n await whoamiResult;\n } catch {\n throw new AggregateError([getError(\"EINVALIDNPMTOKEN\", { registry })]);\n }\n } else {\n logger.log(`Skipping authentication verification for non-default registry \"${registry}\"`);\n }\n};\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { readFile, writeFile } from \"@visulima/fs\";\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { resolve } from \"@visulima/path\";\nimport AggregateError from \"aggregate-error\";\nimport rc from \"rc\";\nimport type { AuthOptions } from \"registry-auth-token\";\nimport getAuthToken from \"registry-auth-token\";\n\nimport { DEFAULT_NPM_REGISTRY } from \"../definitions/constants\";\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"./get-error\";\nimport nerfDart from \"./nerf-dart\";\n\nexport default async (\n npmrc: string,\n registry: string,\n { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }: CommonContext,\n): Promise<void> => {\n logger.log(\"Verify authentication for registry %s\", registry);\n\n const { configs, ...rcConfig } = rc(\"npm\", { registry: DEFAULT_NPM_REGISTRY }, { config: NPM_CONFIG_USERCONFIG ?? resolve(cwd, \".npmrc\") });\n\n if (configs) {\n logger.log(\"Reading npm config from %s\", configs.join(\", \"));\n }\n\n // eslint-disable-next-line compat/compat,unicorn/no-await-expression-member\n const currentConfig = configs ? (await Promise.all(configs.map((config) => readFile(config)))).join(\"\\n\") : \"\";\n\n if (getAuthToken(registry, { npmrc: rcConfig } as AuthOptions)) {\n await writeFile(npmrc, currentConfig);\n\n return;\n }\n\n if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {\n await writeFile(npmrc, `${currentConfig ? `${currentConfig}\\n` : \"\"}_auth = \\${LEGACY_TOKEN}\\nemail = \\${NPM_EMAIL}`);\n\n logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${npmrc}`);\n } else if (NPM_TOKEN) {\n await writeFile(npmrc, `${currentConfig ? `${currentConfig}\\n` : \"\"}${nerfDart(registry)}:_authToken = \\${NPM_TOKEN}`);\n\n logger.log(`Wrote NPM_TOKEN to ${npmrc}`);\n } else {\n throw new AggregateError([getError(\"ENONPMTOKEN\", { registry })]);\n }\n};\n","import { URL } from \"node:url\";\n\n/**\n * Maps a URL to an identifier.\n *\n * The ISC License\n * Copyright (c) npm, Inc.\n *\n * Name courtesy schiffertronix media LLC, a New Jersey corporation\n *\n * @param {String} uri The URL to be nerfed.\n *\n * @returns {String} A nerfed URL.\n */\nconst nerfDart = (url: string): string => {\n const parsed = new URL(url);\n const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;\n const rel = new URL(\".\", from);\n\n return `//${rel.host}${rel.pathname}`;\n};\n\nexport default nerfDart;\n","import type SemanticReleaseError from \"@semantic-release/error\";\n\nimport type { PluginConfig } from \"../definitions/plugin-config\";\nimport getError from \"../utils/get-error\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isString = (value: any): boolean => typeof value === \"string\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isNil = (value: any): boolean => value === null || value === undefined;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isNonEmptyString = (value: any): boolean => isString(value) && value.trim();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ValidatorFunction = (value: any) => boolean;\n\nconst VALIDATORS: Record<string, ValidatorFunction> = {\n branches: Array.isArray,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n npmPublish: (value: any): boolean => typeof value === \"boolean\",\n pkgRoot: isNonEmptyString,\n publishBranch: isNonEmptyString,\n tarballDir: isNonEmptyString,\n};\n\nexport default (config: PluginConfig): SemanticReleaseError[] =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.entries(config).reduce((errors, [option, value]) => {\n if (isNil(value)) {\n return errors;\n }\n\n if (!(option in VALIDATORS)) {\n return errors;\n }\n\n if (VALIDATORS[option]?.(value)) {\n return errors;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment\n return [...errors, getError(`EINVALID${option.toUpperCase()}` as any, { [option]: value })];\n }, [] as SemanticReleaseError[]);\n","// eslint-disable-next-line import/no-extraneous-dependencies\nimport { getPackageManagerVersion } from \"@visulima/package\";\nimport AggregateError from \"aggregate-error\";\nimport { gte } from \"semver\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"../utils/get-error\";\n\nconst MIN_PNPM_VERSION = \"8.0.0\";\n\nexport default async function verifyPnpm({ logger }: CommonContext): Promise<void> {\n logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);\n\n const version = await getPackageManagerVersion(\"pnpm\");\n\n if (version === undefined) {\n throw new AggregateError([new Error(\"pnpm is not installed\")]);\n }\n\n if (gte(MIN_PNPM_VERSION, version)) {\n throw new AggregateError([getError(\"EINVALIDPNPM\", { version: String(version) })]);\n }\n}\n","import addChannelNpm from \"./add-channel\";\nimport type { AddChannelContext, PrepareContext, PublishContext, VerifyConditionsContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport prepareNpm from \"./prepare\";\nimport publishNpm from \"./publish\";\nimport getPackage from \"./utils/get-pkg\";\nimport verify from \"./verify\";\n\nconst PLUGIN_NAME = \"semantic-release-pnpm\";\n\nlet verified: boolean;\nlet prepared: boolean;\n\nexport async function verifyConditions(pluginConfig: PluginConfig, context: VerifyConditionsContext) {\n /**\n * If the plugin is used and has `npmPublish`, `tarballDir` or\n * `pkgRoot` configured, validate them now in order to prevent any release if\n * the configuration is wrong\n */\n if (context.options?.[\"publish\"]) {\n const publish = Array.isArray(context.options?.[\"publish\"]) ? context.options?.[\"publish\"] : [context.options?.[\"publish\"]];\n const publishPlugin = publish.find((config) => config.path && config.path === PLUGIN_NAME) || {};\n\n pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;\n pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;\n pluginConfig.pkgRoot = pluginConfig.pkgRoot ?? publishPlugin.pkgRoot;\n }\n\n await verify(pluginConfig, context);\n\n verified = true;\n}\n\nexport async function prepare(pluginConfig: PluginConfig, context: PrepareContext) {\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n await prepareNpm(pluginConfig, context);\n\n prepared = true;\n}\n\nexport async function publish(pluginConfig: PluginConfig, context: PublishContext) {\n const package_ = await getPackage(pluginConfig, context);\n\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n if (!prepared) {\n await prepareNpm(pluginConfig, context);\n }\n\n return publishNpm(pluginConfig, package_, context);\n}\n\nexport async function addChannel(pluginConfig: PluginConfig, context: AddChannelContext) {\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n const package_ = await getPackage(pluginConfig, context);\n\n return addChannelNpm(pluginConfig, package_, context);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/add-channel.ts","../src/utils/get-channel.ts","../src/utils/get-npmrc.ts","../src/utils/get-error.ts","../package.json","../src/definitions/errors.ts","../src/utils/get-registry.ts","../src/definitions/constants.ts","../src/utils/rc.ts","../src/utils/is-json.ts","../src/utils/get-release-info.ts","../src/utils/should-publish.ts","../src/prepare.ts","../src/publish.ts","../src/utils/get-pkg.ts","../src/verify/index.ts","../src/verify/verify-auth.ts","../src/utils/set-npmrc-auth.ts","../src/utils/nerf-dart.ts","../src/verify/verify-config.ts","../src/verify/verify-pnpm.ts","../src/index.ts"],"names":["execa","validRange","get_channel_default","channel","ensureFile","isAccessibleSync","findCacheDirectorySync","resolve","SemanticReleaseError","package_default","linkify","file","errors","branches","npmPublish","registry","pkgRoot","version","publishBranch","tarballDir","get_error_default","code","context","details","message","getNpmrc","cwd","environment","npmrc","npmrcPath","temporaryNpmrcPath","get_npmrc_default","DEFAULT_NPM_REGISTRY","homedir","findUpSync","readFileSync","join","parse","merge","isJson","value","is_json_default","getEnvironment","prefix","returnValue","l","k","keypath","emptyStringIndex","cursor","subkey","index","getConfigFiles","name","home","internalCwd","defaultHomeFiles","configFiles","foundConfigFile","rc_default","options","uniqueConfigFiles","configs","content","getRegistryUrl","scope","url","registryUrl","get_registry_default","env","normalizeUrl","getReleaseInfo","distributionTag","reasonToNotPublish","pluginConfig","package_","shouldPublish","add_channel_default","logger","stderr","stdout","result","moveFile","prepare_default","basePath","versionResult","packResult","tarball","tarballSource","tarballDestination","AggregateError","publish_default","publishBranchConfig","currentBranch","publishBranches","pnpmArguments","error","findPackageJson","get_pkg_default","packageJson","writeFile","stringify","getAuthToken","URL","nerfDart","parsed","from","real","nerf_dart_default","set_npmrc_auth_default","NPM_CONFIG_USERCONFIG","NPM_EMAIL","NPM_PASSWORD","NPM_TOKEN","NPM_USERNAME","config","files","verify_auth_default","whoamiResult","isString","isNil","isNonEmptyString","VALIDATORS","verify_config_default","option","getPackageManagerVersion","gte","MIN_PNPM_VERSION","verifyPnpm","verify","typedError","verify_default","PLUGIN_NAME","verified","prepared","verifyConditions","publishPlugin","prepare","publish","addChannel"],"mappings":"AACA,OAAS,SAAAA,OAAa,QCDtB,OAAS,cAAAC,OAAkB,SAE3B,IAAOC,EAASC,GAAgDA,EAAWF,GAAWE,CAAO,EAAI,WAAWA,CAAO,GAAKA,EAAW,SCFnI,OAAS,cAAAC,GAAY,oBAAAC,OAAwB,eAC7C,OAAS,0BAAAC,OAA8B,oBACvC,OAAS,WAAAC,OAAe,iBCFxB,OAAOC,OAA0B,0BCAjC,IAAAC,EAAA,CACI,KAAQ,kCACR,QAAW,gBACX,YAAe,8DACf,SAAY,CACR,WACA,MACA,UACA,mBACA,OACA,UACJ,EACA,SAAY,oDACZ,WAAc,CACV,KAAQ,MACR,IAAO,uDACX,EACA,QAAW,MACX,OAAU,CACN,KAAQ,iBACR,MAAS,uBACb,EACA,KAAQ,SACR,QAAW,kBACX,KAAQ,gBACR,MAAS,kBACT,MAAS,CACL,OACA,YACA,cACJ,EACA,QAAW,CACP,MAAS,sCACT,aAAc,qCACd,cAAe,oGACf,kBAAmB,6BACnB,WAAY,yDACZ,mBAAoB,mBACpB,gBAAiB,8CACjB,oBAAqB,8CACrB,eAAgB,kBAChB,cAAe,mDACf,YAAa,2FACb,gBAAiB,+EACjB,aAAc,eACd,QAAW,mFACX,oBAAqB,mCACrB,KAAQ,aACR,aAAc,eACd,gBAAiB,wBACjB,aAAc,SACd,cAAe,MACnB,EACA,aAAgB,CACZ,0BAA2B,SAC3B,eAAgB,SAChB,oBAAqB,QACrB,iBAAkB,SAClB,kBAAmB,SACnB,M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EOuH,EAAQF,GMlCf,IAAMG,GAAc,wBAEhBC,EACAC,GAESC,GAAmB,MAAO7D,EAA4BpD,IAAoD,CAMnH,GAAIA,EAAQ,SAAU,QAAY,CAI9B,IAAMkH,GAHU,MAAM,QAAQlH,EAAQ,SAAU,OAAU,EAAIA,EAAQ,SAAU,QAAa,CAACA,EAAQ,SAAU,OAAU,GAG5F,KAAM6F,GAAWA,EAAO,MAAQA,EAAO,OAASiB,EAAW,GAAK,CAAC,EAG/F1D,EAAa,WAAaA,EAAa,YAAc8D,EAAc,WAEnE9D,EAAa,WAAaA,EAAa,YAAc8D,EAAc,WAEnE9D,EAAa,QAAUA,EAAa,SAAW8D,EAAc,QAE7D9D,EAAa,eAAiBA,EAAa,gBAAkB8D,EAAc,eAE3E9D,EAAa,SAAWA,EAAa,UAAY8D,EAAc,QACnE,CAEA,MAAML,EAAOzD,EAAcpD,CAAO,EAElC+G,EAAW,EACf,EAEaI,GAAU,MAAO/D,EAA4BpD,IAA2C,CAC5F+G,GACD,MAAMF,EAAOzD,EAAcpD,CAAO,EAGtC,MAAM6D,EAAWT,EAAcpD,CAAO,EAEtCgH,GAAW,EACf,EAEaI,GAAU,MAAOhE,EAA4BpD,IAA0D,CAChH,IAAM6E,EAAc,MAAMD,EAAWxB,EAAcpD,CAAO,EAE1D,OAAK+G,GACD,MAAMF,EAAOzD,EAAcpD,CAAO,EAGjCgH,IACD,MAAMnD,EAAWT,EAAcpD,CAAO,EAGnCqE,EAAWjB,EAAcyB,EAAa7E,CAAO,CACxD,EAEaqH,GAAa,MAAOjE,EAA4BpD,IAA6D,CACjH+G,GACD,MAAMF,EAAOzD,EAAcpD,CAAO,EAGtC,IAAM6E,EAAc,MAAMD,EAAWxB,EAAcpD,CAAO,EAE1D,OAAOuD,EAAcH,EAAcyB,EAAa7E,CAAO,CAC3D","sourcesContent":["import type { PackageJson } from \"@visulima/package\";\nimport { execa } from \"execa\";\n\nimport type { AddChannelContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport getChannel from \"./utils/get-channel\";\nimport getNpmrc from \"./utils/get-npmrc\";\nimport getRegistry from \"./utils/get-registry\";\nimport type { ReleaseInfo } from \"./utils/get-release-info\";\nimport { getReleaseInfo } from \"./utils/get-release-info\";\nimport { reasonToNotPublish, shouldPublish } from \"./utils/should-publish\";\n\nexport default async (pluginConfig: PluginConfig, package_: PackageJson, context: AddChannelContext): Promise<ReleaseInfo | false> => {\n const {\n cwd,\n env,\n logger,\n nextRelease: { channel, version },\n stderr,\n stdout,\n } = context;\n\n if (shouldPublish(pluginConfig, package_)) {\n const registry = getRegistry(package_, context);\n const distributionTag = getChannel(channel);\n\n logger.log(`Adding version ${version} to npm registry on dist-tag ${distributionTag}`);\n\n const npmrc = getNpmrc(cwd, env);\n\n const result = execa(\"pnpm\", [\"dist-tag\", \"add\", `${package_.name}@${version}`, distributionTag, \"--userconfig\", npmrc, \"--registry\", registry], {\n cwd,\n env,\n preferLocal: true,\n });\n\n result.stdout.pipe(stdout, { end: false });\n result.stderr.pipe(stderr, { end: false });\n\n await result;\n\n logger.log(`Added ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);\n\n return getReleaseInfo(package_, context, distributionTag, registry);\n }\n\n logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, package_)}`);\n\n return false;\n};\n","import { validRange } from \"semver\";\n\nexport default (channel: string | null | undefined): string => (channel ? (validRange(channel) ? `release-${channel}` : channel) : \"latest\");\n","import { ensureFile, isAccessibleSync } from \"@visulima/fs\";\nimport { findCacheDirectorySync } from \"@visulima/package\";\nimport { resolve } from \"@visulima/path\";\n\nimport getError from \"./get-error\";\n\nconst getNpmrc = (cwd: string, environment: NodeJS.ProcessEnv): string => {\n let npmrc = environment.NPM_CONFIG_USERCONFIG;\n\n const npmrcPath = resolve(cwd, \".npmrc\");\n\n if (!npmrc && isAccessibleSync(npmrcPath)) {\n npmrc = npmrcPath;\n } else if (!npmrc) {\n const temporaryNpmrcPath = findCacheDirectorySync(\"semantic-release-pnpm\", { create: true, cwd });\n\n if (temporaryNpmrcPath) {\n ensureFile(temporaryNpmrcPath);\n\n npmrc = temporaryNpmrcPath;\n }\n }\n\n if (!npmrc) {\n // eslint-disable-next-line unicorn/error-message\n throw new AggregateError([\n getError(\"ENOPNPMRC\", {\n npmrc: npmrcPath,\n }),\n ]);\n }\n\n return npmrc;\n};\n\nexport default getNpmrc;\n","import SemanticReleaseError from \"@semantic-release/error\";\n\nimport type { ErrorContext, ErrorDefinition } from \"../definitions/errors\";\nimport { errors } from \"../definitions/errors\";\n\nexport default <T extends keyof typeof errors>(code: T, context: ErrorContext = {}): SemanticReleaseError => {\n const { details, message }: { details?: string; message: string } = (errors[code] as ErrorDefinition)(context);\n\n return new SemanticReleaseError(message, code, details);\n};\n","{\n \"name\": \"@anolilab/semantic-release-pnpm\",\n \"version\": \"1.0.0-alpha.5\",\n \"description\": \"Semantic-release plugin to publish a npm package with pnpm.\",\n \"keywords\": [\n \"anolilab\",\n \"npm\",\n \"publish\",\n \"semantic-release\",\n \"pnpm\",\n \"monorepo\"\n ],\n \"homepage\": \"https://github.com/anolilab/semantic-release-pnpm\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/anolilab/semantic-release-pnpm.git\"\n },\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"Daniel Bannert\",\n \"email\": \"d.bannert@anolilab.de\"\n },\n \"type\": \"module\",\n \"exports\": \"./dist/index.js\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"CHANGELOG.md\"\n ],\n \"scripts\": {\n \"build\": \"cross-env NODE_ENV=development tsup\",\n \"build:prod\": \"cross-env NODE_ENV=production tsup\",\n \"lint:eslint\": \"eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs\",\n \"lint:eslint:fix\": \"pnpm run lint:eslint --fix\",\n \"lint:fix\": \"pnpm run lint:prettier:fix && pnpm run lint:eslint:fix\",\n \"lint:packagejson\": \"publint --strict\",\n \"lint:prettier\": \"prettier --config=.prettierrc.cjs --check .\",\n \"lint:prettier:fix\": \"prettier --config=.prettierrc.cjs --write .\",\n \"lint:secrets\": \"secretlint **/*\",\n \"lint:staged\": \"lint-staged --verbose --concurrent false --debug\",\n \"lint:text\": \"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --cache --dry-run\",\n \"lint:text:fix\": \"textlint ./.github/ ./README.md ./UPGRADE.md --parallel --experimental --fix\",\n \"lint:types\": \"tsc --noEmit\",\n \"prepare\": \"is-ci || (node verify-node-version.cjs && pnpx only-allow pnpm && husky install)\",\n \"sort-package-json\": \"sort-package-json ./package.json\",\n \"test\": \"vitest run\",\n \"test:bench\": \"vitest bench\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:watch\": \"vitest\",\n \"update:deps\": \"taze\"\n },\n \"dependencies\": {\n \"@semantic-release/error\": \"^4.0.0\",\n \"@visulima/fs\": \"^2.1.1\",\n \"@visulima/package\": \"1.8.1\",\n \"@visulima/path\": \"^1.0.0\",\n \"aggregate-error\": \"^5.0.0\",\n \"execa\": \"^9.1.0\",\n \"ini\": \"4.1.2\",\n \"move-file\": \"^3.1.0\",\n \"normalize-url\": \"^8.0.1\",\n \"registry-auth-token\": \"^5.0.2\",\n \"semver\": \"^7.6.2\",\n \"ts-deepmerge\": \"^7.0.0\"\n },\n \"devDependencies\": {\n \"@anolilab/commitlint-config\": \"^5.0.3\",\n \"@anolilab/eslint-config\": \"^15.0.3\",\n \"@anolilab/lint-staged-config\": \"^2.1.7\",\n \"@anolilab/prettier-config\": \"^5.0.14\",\n \"@anolilab/textlint-config\": \"^8.0.16\",\n \"@babel/core\": \"^7.24.5\",\n \"@babel/eslint-parser\": \"7.24.5\",\n \"@commitlint/cli\": \"^19.3.0\",\n \"@commitlint/config-conventional\": \"^19.2.2\",\n \"@secretlint/secretlint-rule-preset-recommend\": \"^8.2.4\",\n \"@semantic-release/changelog\": \"^6.0.3\",\n \"@semantic-release/git\": \"^10.0.1\",\n \"@semantic-release/github\": \"^10.0.3\",\n \"@types/dockerode\": \"^3.3.29\",\n \"@types/ini\": \"^4.1.0\",\n \"@types/node\": \"^20.12.12\",\n \"@types/semantic-release__error\": \"3.0.3\",\n \"@types/semver\": \"7.5.8\",\n \"@types/stream-buffers\": \"^3.0.7\",\n \"@vitest/coverage-v8\": \"^1.6.0\",\n \"commitizen\": \"^4.3.0\",\n \"commitlint\": \"^19.3.0\",\n \"cross-env\": \"^7.0.3\",\n \"cz-conventional-changelog\": \"^3.3.0\",\n \"dockerode\": \"4.0.2\",\n \"eslint\": \"8.55.0\",\n \"eslint-plugin-deprecation\": \"^2.0.0\",\n \"eslint-plugin-editorconfig\": \"^4.0.3\",\n \"eslint-plugin-import\": \"npm:eslint-plugin-i@2.29.1\",\n \"eslint-plugin-mdx\": \"^3.1.5\",\n \"eslint-plugin-n\": \"^17.7.0\",\n \"eslint-plugin-vitest\": \"^0.4.1\",\n \"eslint-plugin-vitest-globals\": \"^1.5.0\",\n \"eslint-plugin-you-dont-need-lodash-underscore\": \"^6.14.0\",\n \"get-stream\": \"9.0.1\",\n \"got\": \"^14.2.1\",\n \"husky\": \"^9.0.11\",\n \"is-ci\": \"^3.0.1\",\n \"lint-staged\": \"^15.2.2\",\n \"p-retry\": \"^6.2.0\",\n \"prettier\": \"^3.2.5\",\n \"publint\": \"^0.2.7\",\n \"rimraf\": \"^5.0.7\",\n \"secretlint\": \"8.2.4\",\n \"semantic-release\": \"^23.1.1\",\n \"sort-package-json\": \"^2.10.0\",\n \"stream-buffers\": \"^3.0.2\",\n \"taze\": \"^0.13.8\",\n \"tempy\": \"^3.1.0\",\n \"textlint\": \"^14.0.4\",\n \"tsup\": \"^8.0.2\",\n \"typescript\": \"^5.4.5\",\n \"vitest\": \"^1.6.0\"\n },\n \"peerDependencies\": {\n \"semantic-release\": \"^20.0 || ^21.0 || >=22.0.3\"\n },\n \"packageManager\": \"pnpm@9.1.1\",\n \"engines\": {\n \"node\": \">=18 || >=20.6.1\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"provenance\": true\n },\n \"pnpm\": {\n \"overrides\": {\n \"chrono-node@<2.2.4\": \">=2.2.4\"\n }\n },\n \"anolilab\": {\n \"eslint-config\": {\n \"plugin\": {\n \"etc\": false,\n \"tsdoc\": false\n },\n \"warn_on_unsupported_typescript_version\": false,\n \"info_on_disabling_jsx_react_rule\": false,\n \"info_on_disabling_prettier_conflict_rule\": false,\n \"info_on_disabling_jsonc_sort_keys_rule\": false,\n \"import_ignore_exports\": [\n \"**/*.cjs\",\n \"verify-node-version.cjs\"\n ]\n }\n }\n}\n","import package_ from \"../../package.json\";\n\nconst linkify = (file: string) => `${package_.homepage}/blob/main/${file}`;\n\ninterface ErrorDetails {\n details: string;\n message: string;\n}\n\nexport type ErrorDefinition = (context: ErrorContext) => ErrorDetails;\n\nexport interface ErrorContext {\n npmPublish?: boolean;\n npmrc?: string;\n pkgRoot?: string;\n publishBranch?: string;\n registry?: string;\n tarballDir?: string;\n version?: string;\n}\n\nexport const errors = {\n EINVALIDBRANCHES: (branches: string[]) => {\n return {\n details: `The [branches option](${linkify(\"README.md#branches\")}) option, if defined, must be an array of \\`String\\`.\nYour configuration for the \\`branches\\` option is \\`${branches}\\`.`,\n message: \"Invalid `branches` option.\",\n };\n },\n EINVALIDNPMPUBLISH: ({ npmPublish }: ErrorContext) => {\n return {\n details: `The [npmPublish option](${linkify(\"README.md#npmpublish\")}) option, if defined, must be a \\`Boolean\\`.\nYour configuration for the \\`npmPublish\\` option is \\`${npmPublish}\\`.`,\n message: \"Invalid `npmPublish` option.\",\n };\n },\n EINVALIDNPMTOKEN: ({ registry }: ErrorContext) => {\n return {\n details: `The [npm token](${linkify(\n \"README.md#npm-registry-authentication\",\n )}) 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 \\`${registry}\\`.\nIf 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.\nPlease make sure to set the \\`NPM_TOKEN\\` environment variable in your CI with the exact value of the npm token.`,\n message: \"Invalid npm token.\",\n };\n },\n EINVALIDPKGROOT: ({ pkgRoot }: ErrorContext) => {\n return {\n details: `The [pkgRoot option](${linkify(\"README.md#pkgroot\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`pkgRoot\\` option is \\`${pkgRoot}\\`.`,\n message: \"Invalid `pkgRoot` option.\",\n };\n },\n EINVALIDPNPM: ({ version }: ErrorContext) => {\n return {\n details: `The version of Pnpm that you are using is not compatible. Please refer to [the README](${linkify(\n \"README.md#install\",\n )}) to review which versions of Pnpm are currently supported\n\nYour version of Pnpm is \"${version}\".`,\n message: \"Incompatible Pnpm version detected.\",\n };\n },\n EINVALIDPUBLISHBRANCH: ({ publishBranch }: ErrorContext) => {\n return {\n details: `The [publishBranch option](${linkify(\"README.md#publishBranch\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`publishBranch\\` option is \\`${publishBranch}\\`.`,\n message: \"Invalid `publishBranch` option.\",\n };\n },\n EINVALIDTARBALLDIR: ({ tarballDir }: ErrorContext) => {\n return {\n details: `The [tarballDir option](${linkify(\"README.md#tarballdir\")}) option, if defined, must be a \\`String\\`.\nYour configuration for the \\`tarballDir\\` option is \\`${tarballDir}\\`.`,\n message: \"Invalid `tarballDir` option.\",\n };\n },\n ENONPMTOKEN: ({ registry }: ErrorContext) => {\n return {\n details: `An [npm token](${linkify(\n \"README.md#npm-registry-authentication\",\n )}) must be created and set in the \\`NPM_TOKEN\\` environment variable on your CI environment.\nPlease 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 \\`${registry}\\`.`,\n message: \"No npm token specified.\",\n };\n },\n ENOPKG: () => {\n return {\n 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.`,\n message: \"Missing `package.json` file.\",\n };\n },\n ENOPKGNAME: () => {\n return {\n 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\\`.`,\n message: \"Missing `name` property in `package.json`.\",\n };\n },\n ENOPNPM: () => {\n return {\n details: `The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.`,\n message: \"Pnpm not found.\",\n };\n },\n ENOPNPMRC: () => {\n return {\n details: `Didnt find a \\`.npmrc\\` file or it was not possible to create , in the root of your project.`,\n message: \"Missing `.npmrc` file.\",\n };\n },\n};\n","import type { PackageJson } from \"@visulima/package\";\nimport { resolve } from \"@visulima/path\";\nimport type { AuthOptions } from \"registry-auth-token\";\n\nimport { DEFAULT_NPM_REGISTRY } from \"../definitions/constants\";\nimport type { CommonContext } from \"../definitions/context\";\nimport rc from \"./rc\";\n\nconst getRegistryUrl = (scope: string, npmrc: AuthOptions[\"npmrc\"]): string => {\n let url: string = DEFAULT_NPM_REGISTRY;\n\n if (npmrc) {\n const registryUrl = npmrc[`${scope}:registry`] ?? npmrc[\"registry\"];\n\n if (registryUrl) {\n url = registryUrl;\n }\n }\n\n return url.slice(-1) === \"/\" ? url : `${url}/`;\n};\n\nexport default ({ name, publishConfig: { registry } = {} }: PackageJson, { cwd, env }: CommonContext): string =>\n registry ??\n env.NPM_CONFIG_REGISTRY ??\n getRegistryUrl(\n (name as string).split(\"/\")[0] as string,\n rc(\"npm\", {\n config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, \".npmrc\"),\n cwd,\n defaults: { registry: \"https://registry.npmjs.org/\" },\n }).config as AuthOptions[\"npmrc\"],\n );\n","// eslint-disable-next-line import/prefer-default-export\nexport const DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\";\n","import { homedir } from \"node:os\";\nimport { cwd } from \"node:process\";\n\nimport { findUpSync, isAccessibleSync, readFileSync } from \"@visulima/fs\";\nimport { join } from \"@visulima/path\";\nimport { parse } from \"ini\";\nimport { merge } from \"ts-deepmerge\";\n\nimport isJson from \"./is-json\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst getEnvironment = (prefix: string, environment = process.env): Record<string, boolean | string> => {\n const returnValue = {};\n const l = prefix.length;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const k in environment) {\n if (k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {\n const keypath = k.slice(Math.max(0, l)).split(\"__\");\n\n // Trim empty strings from keypath array\n let emptyStringIndex;\n\n // eslint-disable-next-line no-loops/no-loops,no-cond-assign\n while ((emptyStringIndex = keypath.indexOf(\"\")) > -1) {\n keypath.splice(emptyStringIndex, 1);\n }\n\n let cursor = returnValue;\n\n keypath.forEach((subkey, index) => {\n // (check for subkey first so we ignore empty strings)\n // (check for cursor to avoid assignment to primitive objects)\n if (!subkey || typeof cursor !== \"object\") {\n return;\n }\n\n // If this is the last key, just stuff the value in there\n // Assigns actual value from env variable to final key\n // (unless it's just an empty string- in that case use the last valid key)\n if (index === keypath.length - 1) {\n cursor[subkey] = environment[k];\n }\n\n // Build sub-object if nothing already exists at the keypath\n if (cursor[subkey] === undefined) {\n cursor[subkey] = {};\n }\n\n // Increment cursor used to track the object at the current depth\n cursor = cursor[subkey];\n });\n }\n }\n\n return returnValue;\n};\n\nconst getConfigFiles = (name: string, home: string, internalCwd: string) => {\n const defaultHomeFiles = [join(home, \".config\", name, \"config\"), join(home, \".config\", name), join(home, `.${name}`, \"config\"), join(home, `.${name}rc`)];\n\n const configFiles = new Set<string>();\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const file of defaultHomeFiles) {\n if (isAccessibleSync(file)) {\n configFiles.add(file);\n }\n\n if (isAccessibleSync(`${file}.json`)) {\n configFiles.add(`${file}.json`);\n }\n }\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const file of [`.${name}rc.json`, `.${name}rc`, `.${name}`, \"config.json\", \"config\"]) {\n // TODO: use later findsUpSync\n const foundConfigFile = findUpSync(file, {\n cwd: internalCwd,\n type: \"file\",\n });\n\n if (foundConfigFile) {\n configFiles.add(foundConfigFile);\n }\n }\n\n return [...configFiles];\n};\n\nexport default (\n name: string,\n options: {\n config?: string;\n cwd?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaults?: Record<string, any>;\n home?: string;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): { config: Record<string, any>; files: string[] } => {\n // eslint-disable-next-line no-param-reassign\n options = {\n cwd: cwd(),\n home: homedir(),\n ...options,\n };\n\n const environment = getEnvironment(`${name}_`);\n\n const configFiles = new Set<string>(getConfigFiles(name, options.home as string, options.cwd as string));\n\n if (typeof environment.config === \"string\" && isAccessibleSync(environment.config)) {\n configFiles.add(environment.config);\n }\n\n if (options.config && isAccessibleSync(options.config)) {\n configFiles.add(options.config);\n }\n\n const uniqueConfigFiles = [...configFiles];\n const configs: object[] = [];\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const file of uniqueConfigFiles) {\n const content = readFileSync(file);\n\n if (isJson(content)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n configs.push(JSON.parse(content));\n } else {\n configs.push(parse(content));\n }\n }\n\n return { config: merge(...configs), files: uniqueConfigFiles };\n};\n","/**\n * Checks if string is a parseable JSON string.\n *\n * @param {string} value\n * @returns {boolean}\n */\nconst isJson = (value: string): boolean => {\n try {\n JSON.parse(value);\n } catch {\n return false;\n }\n\n return true;\n};\n\nexport default isJson;\n","import type { PackageJson } from \"@visulima/package\";\nimport normalizeUrl from \"normalize-url\";\n\nimport type { PublishContext } from \"../definitions/context\";\n\nexport interface ReleaseInfo {\n channel: string;\n name: string;\n url?: string;\n}\n\nexport const getReleaseInfo = (\n { name }: PackageJson,\n { env: { DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\" }, nextRelease: { version } }: PublishContext,\n distributionTag: string,\n registry: string,\n): ReleaseInfo => {\n return {\n channel: distributionTag,\n name: `pnpm package (@${distributionTag} dist-tag)`,\n url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY) ? `https://www.npmjs.com/package/${name}/v/${version}` : undefined,\n };\n};\n","import type { PackageJson } from \"@visulima/package\";\n\nimport type { PluginConfig } from \"../definitions/plugin-config\";\n\n/**\n * Returns null if `npmPublish` is not `false` and `pkg.private` is not\n * `true` or `pkg.workspaces` is not `undefined`.\n * Returns reason otherwise.\n */\nexport const reasonToNotPublish = (pluginConfig: PluginConfig, package_: PackageJson): string | null =>\n (pluginConfig.npmPublish === false\n ? \"npmPublish plugin option is false\"\n : package_.private === true && package_.workspaces === undefined\n ? \"package is private and has no workspaces\"\n : null);\n\nexport const shouldPublish = (pluginConfig: PluginConfig, package_: PackageJson): boolean => reasonToNotPublish(pluginConfig, package_) === null;\n","import { resolve } from \"@visulima/path\";\nimport { execa } from \"execa\";\nimport { moveFile } from \"move-file\";\n\nimport type { PrepareContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\n\nexport default async ({ pkgRoot, tarballDir }: PluginConfig, { cwd, env, logger, nextRelease: { version }, stderr, stdout }: PrepareContext): Promise<void> => {\n const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;\n\n logger.log(\"Write version %s to package.json in %s\", version, basePath);\n\n const versionResult = execa(\"pnpm\", [\"version\", version, \"--no-git-tag-version\", \"--allow-same-version\"], {\n cwd: basePath,\n env,\n preferLocal: true,\n });\n\n versionResult.stdout.pipe(stdout, { end: false });\n versionResult.stderr.pipe(stderr, { end: false });\n\n await versionResult;\n\n if (tarballDir) {\n logger.log(\"Creating npm package version %s\", version);\n\n const packResult = execa(\"pnpm\", [\"pack\", basePath], { cwd, env, preferLocal: true });\n\n packResult.stdout.pipe(stdout, { end: false });\n packResult.stderr.pipe(stderr, { end: false });\n\n // eslint-disable-next-line unicorn/no-await-expression-member\n const tarball = (await packResult).stdout.split(\"\\n\").pop() as string;\n const tarballSource = resolve(cwd, tarball);\n const tarballDestination = resolve(cwd, tarballDir.trim(), tarball);\n\n // Only move the tarball if we need to\n // Fixes: https://github.com/semantic-release/npm/issues/169\n if (tarballSource !== tarballDestination) {\n await moveFile(tarballSource, tarballDestination);\n }\n }\n};\n","import type { PackageJson } from \"@visulima/package\";\nimport { resolve } from \"@visulima/path\";\nimport AggregateError from \"aggregate-error\";\nimport { execa } from \"execa\";\n\nimport type { PublishContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport getChannel from \"./utils/get-channel\";\nimport getRegistry from \"./utils/get-registry\";\nimport type { ReleaseInfo } from \"./utils/get-release-info\";\nimport { getReleaseInfo } from \"./utils/get-release-info\";\nimport { reasonToNotPublish, shouldPublish } from \"./utils/should-publish\";\n\nexport default async (pluginConfig: PluginConfig, package_: PackageJson, context: PublishContext): Promise<ReleaseInfo | false> => {\n const {\n cwd,\n env,\n logger,\n nextRelease: { channel, version },\n stderr,\n stdout,\n } = context;\n const { pkgRoot, publishBranch: publishBranchConfig } = pluginConfig;\n\n if (shouldPublish(pluginConfig, package_)) {\n const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;\n const registry = getRegistry(package_, context);\n const distributionTag = getChannel(channel);\n\n const { stdout: currentBranch } = await execa(\"git\", [\"rev-parse\", \"--abbrev-ref\", \"HEAD\"], {\n cwd,\n env,\n preferLocal: true,\n });\n const publishBranches = typeof publishBranchConfig === \"string\" && publishBranchConfig.split(\"|\");\n const isPublishBranch = publishBranches && publishBranches?.includes(currentBranch);\n const publishBranch = isPublishBranch ? currentBranch : \"main\";\n\n logger.log(`Publishing version ${version} on branch ${publishBranch} to npm registry on dist-tag ${distributionTag}`);\n\n const pnpmArguments = [\"publish\", basePath, \"--publish-branch\", publishBranch, \"--tag\", distributionTag, \"--registry\", registry, \"--no-git-checks\"];\n\n if (pluginConfig.disableScripts) {\n pnpmArguments.push(\"--ignore-scripts\");\n }\n\n const result = execa(\"pnpm\", pnpmArguments, {\n cwd,\n env,\n preferLocal: true,\n });\n\n result.stdout.pipe(stdout, { end: false });\n result.stderr.pipe(stderr, { end: false });\n\n try {\n await result;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n logger.log(`Failed to publish ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}: ${error.message ?? error}`);\n\n throw new AggregateError([error]);\n }\n\n logger.log(`Published ${package_.name}@${version} to dist-tag @${distributionTag} on ${registry}`);\n\n return getReleaseInfo(package_, context, distributionTag, registry);\n }\n\n logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, package_)}`);\n\n return false;\n};\n","// eslint-disable-next-line unicorn/prevent-abbreviations\nimport type { PackageJson } from \"@visulima/package\";\nimport { findPackageJson } from \"@visulima/package\";\nimport { resolve } from \"@visulima/path\";\nimport AggregateError from \"aggregate-error\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"./get-error\";\n\ninterface Options {\n pkgRoot?: string;\n}\n\nexport default async ({ pkgRoot }: Options, { cwd }: { cwd: CommonContext[\"cwd\"] }): Promise<PackageJson> => {\n try {\n const { packageJson } = await findPackageJson(pkgRoot ? resolve(cwd, pkgRoot) : cwd);\n\n if (!packageJson.name) {\n throw new AggregateError([getError(\"ENOPKGNAME\")]);\n }\n\n return packageJson;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (error.code === \"ENOENT\") {\n throw new AggregateError([getError(\"ENOPKG\")]);\n }\n\n throw error;\n }\n};\n","import AggregateError from \"aggregate-error\";\n\nimport type { VerifyConditionsContext } from \"../definitions/context\";\nimport type { PluginConfig } from \"../definitions/plugin-config\";\nimport getNpmrc from \"../utils/get-npmrc\";\nimport getPackage from \"../utils/get-pkg\";\nimport { shouldPublish } from \"../utils/should-publish\";\nimport verifyAuth from \"./verify-auth\";\nimport verifyConfig from \"./verify-config\";\nimport verifyPnpm from \"./verify-pnpm\";\n\nconst verify = async (pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> => {\n let errors: Error[] = verifyConfig(pluginConfig);\n\n try {\n verifyPnpm(context);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const typedError = error as AggregateError;\n\n errors = [...errors, ...(typedError.errors ?? [error])];\n }\n\n try {\n const packageJson = await getPackage(pluginConfig, context);\n\n if (shouldPublish(pluginConfig, packageJson)) {\n const npmrc = getNpmrc(context.cwd, context.env);\n\n await verifyAuth(npmrc, packageJson, context);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const typedError = error as AggregateError;\n\n errors = [...errors, ...(typedError.errors ?? [error])];\n }\n\n if (errors.length > 0) {\n throw new AggregateError(errors);\n }\n};\n\nexport default verify;\n","import type { PackageJson } from \"@visulima/package\";\nimport AggregateError from \"aggregate-error\";\nimport { execa } from \"execa\";\nimport normalizeUrl from \"normalize-url\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"../utils/get-error\";\nimport getRegistry from \"../utils/get-registry\";\nimport setNpmrcAuth from \"../utils/set-npmrc-auth\";\n\nexport default async (npmrc: string, package_: PackageJson, context: CommonContext): Promise<void> => {\n const {\n cwd,\n env: { DEFAULT_NPM_REGISTRY = \"https://registry.npmjs.org/\", ...environment },\n logger,\n stderr,\n stdout,\n } = context;\n const registry = getRegistry(package_, context);\n\n await setNpmrcAuth(npmrc, registry, context);\n\n if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {\n try {\n logger.log(`Running \"pnpm whoami\" to verify authentication on registry \"${registry}\"`);\n\n const whoamiResult = execa(\"pnpm\", [\"whoami\", \"--userconfig\", npmrc, \"--registry\", registry], {\n cwd,\n env: environment,\n preferLocal: true,\n });\n\n whoamiResult.stdout.pipe(stdout, { end: false });\n whoamiResult.stderr.pipe(stderr, { end: false });\n\n await whoamiResult;\n } catch {\n throw new AggregateError([getError(\"EINVALIDNPMTOKEN\", { registry })]);\n }\n } else {\n logger.log(`Skipping authentication verification for non-default registry \"${registry}\"`);\n }\n};\n","import { writeFile } from \"@visulima/fs\";\nimport { resolve } from \"@visulima/path\";\nimport AggregateError from \"aggregate-error\";\nimport { stringify } from \"ini\";\nimport type { AuthOptions } from \"registry-auth-token\";\nimport getAuthToken from \"registry-auth-token\";\n\nimport { DEFAULT_NPM_REGISTRY } from \"../definitions/constants\";\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"./get-error\";\nimport nerfDart from \"./nerf-dart\";\nimport rc from \"./rc\";\n\nexport default async (\n npmrc: string,\n registry: string,\n { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }: CommonContext,\n): Promise<void> => {\n logger.log(\"Verify authentication for registry %s\", registry);\n\n const { config, files } = rc(\"npm\", {\n config: NPM_CONFIG_USERCONFIG ?? resolve(cwd, \".npmrc\"),\n cwd,\n defaults: { registry: DEFAULT_NPM_REGISTRY },\n });\n\n if (files) {\n logger.log(\"Reading npm config from %s\", files.join(\", \"));\n }\n\n if (getAuthToken(registry, { npmrc: config } as AuthOptions)) {\n await writeFile(npmrc, stringify(config));\n\n return;\n }\n\n if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) {\n await writeFile(npmrc, `${config ? `${stringify(config)}\\n` : \"\"}_auth = \\${LEGACY_TOKEN}\\nemail = \\${NPM_EMAIL}`);\n\n logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD, and NPM_EMAIL to ${npmrc}`);\n } else if (NPM_TOKEN) {\n await writeFile(npmrc, `${config ? `${stringify(config)}\\n` : \"\"}${nerfDart(registry)}:_authToken = \\${NPM_TOKEN}`);\n\n logger.log(`Wrote NPM_TOKEN to ${npmrc}`);\n } else {\n throw new AggregateError([getError(\"ENONPMTOKEN\", { registry })]);\n }\n};\n","import { URL } from \"node:url\";\n\n/**\n * Maps a URL to an identifier.\n *\n * The ISC License\n * Copyright (c) npm, Inc.\n *\n * Name courtesy schiffertronix media LLC, a New Jersey corporation\n *\n * @param {String} url The URL to be nerfed.\n *\n * @returns {String} A nerfed URL.\n */\nconst nerfDart = (url: string): string => {\n const parsed = new URL(url);\n const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;\n const real = new URL(\".\", from);\n\n return `//${real.host}${real.pathname}`;\n};\n\nexport default nerfDart;\n","import type SemanticReleaseError from \"@semantic-release/error\";\n\nimport type { PluginConfig } from \"../definitions/plugin-config\";\nimport getError from \"../utils/get-error\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isString = (value: any): boolean => typeof value === \"string\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isNil = (value: any): boolean => value === null || value === undefined;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isNonEmptyString = (value: any): boolean => {\n if (!isString(value)) {\n return false;\n }\n\n return (value as string).trim() !== \"\";\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ValidatorFunction = (value: any) => boolean;\n\nconst VALIDATORS: Record<string, ValidatorFunction> = {\n branches: Array.isArray,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n npmPublish: (value: any): boolean => typeof value === \"boolean\",\n pkgRoot: isNonEmptyString,\n publishBranch: isNonEmptyString,\n tarballDir: isNonEmptyString,\n};\n\nexport default (config: PluginConfig): SemanticReleaseError[] =>\n // eslint-disable-next-line unicorn/no-array-reduce\n Object.entries(config).reduce((errors, [option, value]) => {\n if (isNil(value)) {\n return errors;\n }\n\n if (!(option in VALIDATORS)) {\n return errors;\n }\n\n if (VALIDATORS[option]?.(value)) {\n return errors;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return [...errors, getError(`EINVALID${option.toUpperCase()}` as any, { [option]: value })];\n }, [] as SemanticReleaseError[]);\n","import { getPackageManagerVersion } from \"@visulima/package\";\nimport AggregateError from \"aggregate-error\";\nimport { gte } from \"semver\";\n\nimport type { CommonContext } from \"../definitions/context\";\nimport getError from \"../utils/get-error\";\n\nconst MIN_PNPM_VERSION = \"8.0.0\";\n\nexport default async function verifyPnpm({ logger }: CommonContext): Promise<void> {\n logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);\n\n const version = await getPackageManagerVersion(\"pnpm\");\n\n if (version === undefined) {\n throw new AggregateError([new Error(\"pnpm is not installed\")]);\n }\n\n if (gte(MIN_PNPM_VERSION, version)) {\n throw new AggregateError([getError(\"EINVALIDPNPM\", { version: String(version) })]);\n }\n}\n","import addChannelNpm from \"./add-channel\";\nimport type { AddChannelContext, PrepareContext, PublishContext, VerifyConditionsContext } from \"./definitions/context\";\nimport type { PluginConfig } from \"./definitions/plugin-config\";\nimport prepareNpm from \"./prepare\";\nimport publishNpm from \"./publish\";\nimport getPackage from \"./utils/get-pkg\";\nimport type { ReleaseInfo } from \"./utils/get-release-info\";\nimport verify from \"./verify\";\n\nconst PLUGIN_NAME = \"semantic-release-pnpm\";\n\nlet verified: boolean;\nlet prepared: boolean;\n\nexport const verifyConditions = async (pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> => {\n /**\n * If the plugin is used and has `npmPublish`, `tarballDir` or\n * `pkgRoot` configured, validate them now in order to prevent any release if\n * the configuration is wrong\n */\n if (context.options?.[\"publish\"]) {\n const publish = Array.isArray(context.options?.[\"publish\"]) ? context.options?.[\"publish\"] : [context.options?.[\"publish\"]];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const publishPlugin = publish.find((config) => config.path && config.path === PLUGIN_NAME) || {};\n\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access\n pluginConfig.npmPublish = pluginConfig.npmPublish ?? publishPlugin.npmPublish;\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access\n pluginConfig.tarballDir = pluginConfig.tarballDir ?? publishPlugin.tarballDir;\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access\n pluginConfig.pkgRoot = pluginConfig.pkgRoot ?? publishPlugin.pkgRoot;\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access\n pluginConfig.disableScripts = pluginConfig.disableScripts ?? publishPlugin.disableScripts;\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access\n pluginConfig.branches = pluginConfig.branches ?? publishPlugin.branches;\n }\n\n await verify(pluginConfig, context);\n\n verified = true;\n};\n\nexport const prepare = async (pluginConfig: PluginConfig, context: PrepareContext): Promise<void> => {\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n await prepareNpm(pluginConfig, context);\n\n prepared = true;\n};\n\nexport const publish = async (pluginConfig: PluginConfig, context: PublishContext): Promise<ReleaseInfo | false> => {\n const packageJson = await getPackage(pluginConfig, context);\n\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n if (!prepared) {\n await prepareNpm(pluginConfig, context);\n }\n\n return publishNpm(pluginConfig, packageJson, context);\n};\n\nexport const addChannel = async (pluginConfig: PluginConfig, context: AddChannelContext): Promise<ReleaseInfo | false> => {\n if (!verified) {\n await verify(pluginConfig, context);\n }\n\n const packageJson = await getPackage(pluginConfig, context);\n\n return addChannelNpm(pluginConfig, packageJson, context);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/semantic-release-pnpm",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"description": "Semantic-release plugin to publish a npm package with pnpm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -30,17 +30,18 @@
|
|
|
30
30
|
"CHANGELOG.md"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@
|
|
33
|
+
"@semantic-release/error": "^4.0.0",
|
|
34
34
|
"@visulima/fs": "^2.1.1",
|
|
35
|
+
"@visulima/package": "1.8.1",
|
|
35
36
|
"@visulima/path": "^1.0.0",
|
|
36
|
-
"@semantic-release/error": "^4.0.0",
|
|
37
37
|
"aggregate-error": "^5.0.0",
|
|
38
38
|
"execa": "^9.1.0",
|
|
39
|
+
"ini": "4.1.2",
|
|
39
40
|
"move-file": "^3.1.0",
|
|
40
41
|
"normalize-url": "^8.0.1",
|
|
41
|
-
"rc": "^1.2.8",
|
|
42
42
|
"registry-auth-token": "^5.0.2",
|
|
43
|
-
"semver": "^7.6.2"
|
|
43
|
+
"semver": "^7.6.2",
|
|
44
|
+
"ts-deepmerge": "^7.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@anolilab/commitlint-config": "^5.0.3",
|
|
@@ -57,10 +58,11 @@
|
|
|
57
58
|
"@semantic-release/git": "^10.0.1",
|
|
58
59
|
"@semantic-release/github": "^10.0.3",
|
|
59
60
|
"@types/dockerode": "^3.3.29",
|
|
61
|
+
"@types/ini": "^4.1.0",
|
|
60
62
|
"@types/node": "^20.12.12",
|
|
61
|
-
"@types/rc": "^1.2.4",
|
|
62
63
|
"@types/semantic-release__error": "3.0.3",
|
|
63
64
|
"@types/semver": "7.5.8",
|
|
65
|
+
"@types/stream-buffers": "^3.0.7",
|
|
64
66
|
"@vitest/coverage-v8": "^1.6.0",
|
|
65
67
|
"commitizen": "^4.3.0",
|
|
66
68
|
"commitlint": "^19.3.0",
|
|
@@ -77,15 +79,18 @@
|
|
|
77
79
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
78
80
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
79
81
|
"get-stream": "9.0.1",
|
|
82
|
+
"got": "^14.2.1",
|
|
80
83
|
"husky": "^9.0.11",
|
|
81
84
|
"is-ci": "^3.0.1",
|
|
82
85
|
"lint-staged": "^15.2.2",
|
|
86
|
+
"p-retry": "^6.2.0",
|
|
83
87
|
"prettier": "^3.2.5",
|
|
84
88
|
"publint": "^0.2.7",
|
|
85
89
|
"rimraf": "^5.0.7",
|
|
86
90
|
"secretlint": "8.2.4",
|
|
87
91
|
"semantic-release": "^23.1.1",
|
|
88
92
|
"sort-package-json": "^2.10.0",
|
|
93
|
+
"stream-buffers": "^3.0.2",
|
|
89
94
|
"taze": "^0.13.8",
|
|
90
95
|
"tempy": "^3.1.0",
|
|
91
96
|
"textlint": "^14.0.4",
|
|
@@ -105,7 +110,10 @@
|
|
|
105
110
|
},
|
|
106
111
|
"anolilab": {
|
|
107
112
|
"eslint-config": {
|
|
108
|
-
"plugin": {
|
|
113
|
+
"plugin": {
|
|
114
|
+
"etc": false,
|
|
115
|
+
"tsdoc": false
|
|
116
|
+
},
|
|
109
117
|
"warn_on_unsupported_typescript_version": false,
|
|
110
118
|
"info_on_disabling_jsx_react_rule": false,
|
|
111
119
|
"info_on_disabling_prettier_conflict_rule": false,
|