@anolilab/semantic-release-pnpm 2.0.3 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/{index.mjs → index.js} +120 -116
- package/package.json +9 -9
- package/dist/index.d.mts +0 -123
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## @anolilab/semantic-release-pnpm [3.0.0-alpha.1](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@2.0.4...@anolilab/semantic-release-pnpm@3.0.0-alpha.1) (2025-10-14)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* - node-versions: the minimum node version for the v24 range is now v24.10.0
|
|
6
|
+
- deps: a minimum of node v22.14 is now required
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update dependencies and configurations across multiple packages ([62c36cd](https://github.com/anolilab/semantic-release/commit/62c36cd7eb77324e2e60ba6d0f9137e4b9b2c86d))
|
|
11
|
+
* update dependencies and node version across multiple packages ([3cea078](https://github.com/anolilab/semantic-release/commit/3cea078f8aa27d0873e082bc54c4c5117e5105bf))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* **@anolilab/rc:** upgraded to 3.0.0-alpha.1
|
|
17
|
+
|
|
18
|
+
## @anolilab/semantic-release-pnpm [2.0.4](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@2.0.3...@anolilab/semantic-release-pnpm@2.0.4) (2025-09-22)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **deps:** update dependencies across multiple packages ([150593f](https://github.com/anolilab/semantic-release/commit/150593fec51e1646e8bc5d8aa9db76a8370d42c1))
|
|
23
|
+
* **deps:** update dependencies and configurations across multiple packages ([414ca97](https://github.com/anolilab/semantic-release/commit/414ca976b2432a2d9fb300c746ee1eebfa4361a1))
|
|
24
|
+
* update dependencies and configuration across multiple packages ([9c9b4cb](https://github.com/anolilab/semantic-release/commit/9c9b4cb5b1f9e172f2e1ce509491b950ae448c09))
|
|
25
|
+
* update dependencies and improve configuration ([de0cf70](https://github.com/anolilab/semantic-release/commit/de0cf702c2c5217203409b475f96061702806475))
|
|
26
|
+
* update Nx version and adjust package configurations ([d39ef78](https://github.com/anolilab/semantic-release/commit/d39ef78b608486214ca3a73c5903c00798e7c456))
|
|
27
|
+
* update package dependencies and configurations ([8241a76](https://github.com/anolilab/semantic-release/commit/8241a762582a25742d385d8cf113851ac8b9b801))
|
|
28
|
+
|
|
29
|
+
### Code Refactoring
|
|
30
|
+
|
|
31
|
+
* simplify packem configuration and improve comments ([592de5b](https://github.com/anolilab/semantic-release/commit/592de5b367a448974fc41fd7336e01ba4865a4cf))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Dependencies
|
|
35
|
+
|
|
36
|
+
* **@anolilab/rc:** upgraded to 2.0.4
|
|
37
|
+
|
|
1
38
|
## @anolilab/semantic-release-pnpm [2.0.3](https://github.com/anolilab/semantic-release/compare/@anolilab/semantic-release-pnpm@2.0.2...@anolilab/semantic-release-pnpm@2.0.3) (2025-07-31)
|
|
2
39
|
|
|
3
40
|
### Bug Fixes
|
|
@@ -1,22 +1,51 @@
|
|
|
1
|
+
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
+
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// Runtime capability helpers
|
|
5
|
+
const __cjs_getBuiltinModule = (module) => {
|
|
6
|
+
// Check if we're in Node.js and version supports getBuiltinModule
|
|
7
|
+
if ("object" !== "undefined" && process.versions?.node) {
|
|
8
|
+
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
9
|
+
// Node.js 20.16.0+ and 22.3.0+
|
|
10
|
+
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
11
|
+
return process.getBuiltinModule(module);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// Fallback to createRequire
|
|
15
|
+
return __cjs_require(module);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
1
19
|
import { execa } from 'execa';
|
|
2
|
-
|
|
20
|
+
const {
|
|
21
|
+
validRange,
|
|
22
|
+
gte
|
|
23
|
+
} = __cjs_require("semver");
|
|
3
24
|
import { isAccessibleSync, ensureFileSync, move, writeFile } from '@visulima/fs';
|
|
4
25
|
import { resolve } from '@visulima/path';
|
|
5
26
|
import { rc } from '@anolilab/rc';
|
|
6
27
|
import normalizeUrl from 'normalize-url';
|
|
7
28
|
import { findPackageJson, getPackageManagerVersion } from '@visulima/package';
|
|
8
29
|
import SemanticReleaseError from '@semantic-release/error';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
30
|
+
const {
|
|
31
|
+
stringify
|
|
32
|
+
} = __cjs_require("ini");
|
|
33
|
+
const getAuthToken = __cjs_require("registry-auth-token");
|
|
34
|
+
const {
|
|
35
|
+
URL
|
|
36
|
+
} = __cjs_getBuiltinModule("node:url");
|
|
12
37
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
38
|
+
const getChannel = (channel) => {
|
|
39
|
+
if (!channel) {
|
|
40
|
+
return "latest";
|
|
41
|
+
}
|
|
42
|
+
if (validRange(channel)) {
|
|
43
|
+
return `release-${channel}`;
|
|
44
|
+
}
|
|
45
|
+
return channel;
|
|
46
|
+
};
|
|
16
47
|
|
|
17
|
-
|
|
18
|
-
var __name$g = (target, value) => __defProp$g(target, "name", { value, configurable: true });
|
|
19
|
-
const getNpmrcPath = /* @__PURE__ */ __name$g((cwd, environment) => {
|
|
48
|
+
const getNpmrcPath = (cwd, environment) => {
|
|
20
49
|
const npmrcPath = resolve(cwd, ".npmrc");
|
|
21
50
|
if (environment.NPM_CONFIG_USERCONFIG && isAccessibleSync(environment.NPM_CONFIG_USERCONFIG)) {
|
|
22
51
|
return environment.NPM_CONFIG_USERCONFIG;
|
|
@@ -26,13 +55,11 @@ const getNpmrcPath = /* @__PURE__ */ __name$g((cwd, environment) => {
|
|
|
26
55
|
}
|
|
27
56
|
ensureFileSync(npmrcPath);
|
|
28
57
|
return npmrcPath;
|
|
29
|
-
}
|
|
58
|
+
};
|
|
30
59
|
|
|
31
60
|
const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/";
|
|
32
61
|
|
|
33
|
-
|
|
34
|
-
var __name$f = (target, value) => __defProp$f(target, "name", { value, configurable: true });
|
|
35
|
-
const getRegistryUrl = /* @__PURE__ */ __name$f((scope, npmrc) => {
|
|
62
|
+
const getRegistryUrl = (scope, npmrc) => {
|
|
36
63
|
let url = DEFAULT_NPM_REGISTRY;
|
|
37
64
|
if (npmrc) {
|
|
38
65
|
const registryUrl = npmrc[`${scope}:registry`] ?? npmrc.registry;
|
|
@@ -41,34 +68,36 @@ const getRegistryUrl = /* @__PURE__ */ __name$f((scope, npmrc) => {
|
|
|
41
68
|
}
|
|
42
69
|
}
|
|
43
70
|
return url.endsWith("/") ? url : `${url}/`;
|
|
44
|
-
}
|
|
45
|
-
const getRegistry =
|
|
71
|
+
};
|
|
72
|
+
const getRegistry = ({ name, publishConfig: { registry } = {} }, { cwd, env }) => registry ?? env.NPM_CONFIG_REGISTRY ?? getRegistryUrl(
|
|
46
73
|
name.split("/")[0],
|
|
47
74
|
rc("npm", {
|
|
48
75
|
config: env.NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc"),
|
|
49
76
|
cwd,
|
|
50
77
|
defaults: { registry: "https://registry.npmjs.org/" }
|
|
51
78
|
}).config
|
|
52
|
-
)
|
|
79
|
+
);
|
|
53
80
|
|
|
54
|
-
|
|
55
|
-
var __name$e = (target, value) => __defProp$e(target, "name", { value, configurable: true });
|
|
56
|
-
const getReleaseInfo = /* @__PURE__ */ __name$e(({ name }, { env: { DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/" }, nextRelease: { version } }, distributionTag, registry) => {
|
|
81
|
+
const getReleaseInfo = ({ name }, { env: { DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/" }, nextRelease: { version } }, distributionTag, registry) => {
|
|
57
82
|
return {
|
|
58
83
|
channel: distributionTag,
|
|
59
84
|
name: `pnpm package (@${distributionTag} dist-tag)`,
|
|
60
85
|
url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY) ? `https://www.npmjs.com/package/${name}/v/${version}` : void 0
|
|
61
86
|
};
|
|
62
|
-
}
|
|
87
|
+
};
|
|
63
88
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
const reasonToNotPublish = (pluginConfig, package_) => {
|
|
90
|
+
if (pluginConfig.npmPublish === false) {
|
|
91
|
+
return "npmPublish plugin option is false";
|
|
92
|
+
}
|
|
93
|
+
if (package_.private === true && package_.workspaces === void 0) {
|
|
94
|
+
return "package is private and has no workspaces";
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
const shouldPublish = (pluginConfig, package_) => reasonToNotPublish(pluginConfig, package_) === null;
|
|
68
99
|
|
|
69
|
-
|
|
70
|
-
var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
|
|
71
|
-
const addChannelNpm = /* @__PURE__ */ __name$c(async (pluginConfig, packageJson, context) => {
|
|
100
|
+
const addChannel$1 = async (pluginConfig, packageJson, context) => {
|
|
72
101
|
const {
|
|
73
102
|
cwd,
|
|
74
103
|
env,
|
|
@@ -95,11 +124,9 @@ const addChannelNpm = /* @__PURE__ */ __name$c(async (pluginConfig, packageJson,
|
|
|
95
124
|
}
|
|
96
125
|
logger.log(`Skip adding to npm channel as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
97
126
|
return false;
|
|
98
|
-
}
|
|
127
|
+
};
|
|
99
128
|
|
|
100
|
-
|
|
101
|
-
var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
|
|
102
|
-
const prepareNpm = /* @__PURE__ */ __name$b(async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextRelease: { version }, stderr, stdout }) => {
|
|
129
|
+
const prepare$1 = async ({ pkgRoot, tarballDir }, { cwd, env, logger, nextRelease: { version }, stderr, stdout }) => {
|
|
103
130
|
const basePath = pkgRoot ? resolve(cwd, pkgRoot) : cwd;
|
|
104
131
|
logger.log("Write version %s to package.json in %s", version, basePath);
|
|
105
132
|
const versionResult = execa("pnpm", ["version", version, "--no-git-tag-version", "--allow-same-version"], {
|
|
@@ -122,11 +149,9 @@ const prepareNpm = /* @__PURE__ */ __name$b(async ({ pkgRoot, tarballDir }, { cw
|
|
|
122
149
|
await move(tarballSource, tarballDestination);
|
|
123
150
|
}
|
|
124
151
|
}
|
|
125
|
-
}
|
|
152
|
+
};
|
|
126
153
|
|
|
127
|
-
|
|
128
|
-
var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
|
|
129
|
-
const publishNpm = /* @__PURE__ */ __name$a(async (pluginConfig, packageJson, context) => {
|
|
154
|
+
const publish$1 = async (pluginConfig, packageJson, context) => {
|
|
130
155
|
const {
|
|
131
156
|
cwd,
|
|
132
157
|
env,
|
|
@@ -171,31 +196,29 @@ const publishNpm = /* @__PURE__ */ __name$a(async (pluginConfig, packageJson, co
|
|
|
171
196
|
}
|
|
172
197
|
logger.log(`Skip publishing to npm registry as ${reasonToNotPublish(pluginConfig, packageJson)}`);
|
|
173
198
|
return false;
|
|
174
|
-
}
|
|
199
|
+
};
|
|
175
200
|
|
|
176
201
|
const homepage = "https://github.com/anolilab/semantic-release/tree/main/packages/semantic-release-pnpm";
|
|
177
202
|
const packageJson = {
|
|
178
203
|
homepage: homepage};
|
|
179
204
|
|
|
180
|
-
|
|
181
|
-
var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
|
|
182
|
-
const linkify = /* @__PURE__ */ __name$9((file) => packageJson.homepage + "/blob/main/" + file, "linkify");
|
|
205
|
+
const linkify = (file) => `${packageJson.homepage}/blob/main/${file}`;
|
|
183
206
|
const errors = {
|
|
184
|
-
EINVALIDBRANCHES:
|
|
207
|
+
EINVALIDBRANCHES: (branches) => {
|
|
185
208
|
return {
|
|
186
209
|
details: `The [branches option](${linkify("README.md#branches")}) option, if defined, must be an array of \`String\`.
|
|
187
210
|
Your configuration for the \`branches\` option is \`${branches.join(",")}\`.`,
|
|
188
211
|
message: "Invalid `branches` option."
|
|
189
212
|
};
|
|
190
|
-
},
|
|
191
|
-
EINVALIDNPMPUBLISH:
|
|
213
|
+
},
|
|
214
|
+
EINVALIDNPMPUBLISH: ({ npmPublish }) => {
|
|
192
215
|
return {
|
|
193
216
|
details: `The [npmPublish option](${linkify("README.md#npmpublish")}) option, if defined, must be a \`Boolean\`.
|
|
194
217
|
Your configuration for the \`npmPublish\` option is \`${String(npmPublish)}\`.`,
|
|
195
218
|
message: "Invalid `npmPublish` option."
|
|
196
219
|
};
|
|
197
|
-
},
|
|
198
|
-
EINVALIDNPMTOKEN:
|
|
220
|
+
},
|
|
221
|
+
EINVALIDNPMTOKEN: ({ registry }) => {
|
|
199
222
|
return {
|
|
200
223
|
details: `The [npm token](${linkify(
|
|
201
224
|
"README.md#npm-registry-authentication"
|
|
@@ -204,15 +227,15 @@ If you are using Two Factor Authentication for your account, set its level to ["
|
|
|
204
227
|
Please make sure to set the \`NPM_TOKEN\` environment variable in your CI with the exact value of the npm token.`,
|
|
205
228
|
message: "Invalid npm token."
|
|
206
229
|
};
|
|
207
|
-
},
|
|
208
|
-
EINVALIDPKGROOT:
|
|
230
|
+
},
|
|
231
|
+
EINVALIDPKGROOT: ({ pkgRoot }) => {
|
|
209
232
|
return {
|
|
210
233
|
details: `The [pkgRoot option](${linkify("README.md#pkgroot")}) option, if defined, must be a \`String\`.
|
|
211
234
|
Your configuration for the \`pkgRoot\` option is \`${String(pkgRoot)}\`.`,
|
|
212
235
|
message: "Invalid `pkgRoot` option."
|
|
213
236
|
};
|
|
214
|
-
},
|
|
215
|
-
EINVALIDPNPM:
|
|
237
|
+
},
|
|
238
|
+
EINVALIDPNPM: ({ version }) => {
|
|
216
239
|
return {
|
|
217
240
|
details: `The version of Pnpm that you are using is not compatible. Please refer to [the README](${linkify(
|
|
218
241
|
"README.md#install"
|
|
@@ -221,22 +244,22 @@ Your configuration for the \`pkgRoot\` option is \`${String(pkgRoot)}\`.`,
|
|
|
221
244
|
Your version of Pnpm is "${String(version)}".`,
|
|
222
245
|
message: "Incompatible Pnpm version detected."
|
|
223
246
|
};
|
|
224
|
-
},
|
|
225
|
-
EINVALIDPUBLISHBRANCH:
|
|
247
|
+
},
|
|
248
|
+
EINVALIDPUBLISHBRANCH: ({ publishBranch }) => {
|
|
226
249
|
return {
|
|
227
250
|
details: `The [publishBranch option](${linkify("README.md#publishBranch")}) option, if defined, must be a \`String\`.
|
|
228
251
|
Your configuration for the \`publishBranch\` option is \`${String(publishBranch)}\`.`,
|
|
229
252
|
message: "Invalid `publishBranch` option."
|
|
230
253
|
};
|
|
231
|
-
},
|
|
232
|
-
EINVALIDTARBALLDIR:
|
|
254
|
+
},
|
|
255
|
+
EINVALIDTARBALLDIR: ({ tarballDir }) => {
|
|
233
256
|
return {
|
|
234
257
|
details: `The [tarballDir option](${linkify("README.md#tarballdir")}) option, if defined, must be a \`String\`.
|
|
235
258
|
Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
236
259
|
message: "Invalid `tarballDir` option."
|
|
237
260
|
};
|
|
238
|
-
},
|
|
239
|
-
ENONPMTOKEN:
|
|
261
|
+
},
|
|
262
|
+
ENONPMTOKEN: ({ registry }) => {
|
|
240
263
|
return {
|
|
241
264
|
details: `An [npm token](${linkify(
|
|
242
265
|
"README.md#npm-registry-authentication"
|
|
@@ -244,45 +267,41 @@ Your configuration for the \`tarballDir\` option is \`${String(tarballDir)}\`.`,
|
|
|
244
267
|
Please make sure to create an [npm token](https://docs.npmjs.com/getting-started/working_with_tokens#how-to-create-new-tokens) and to set it in the \`NPM_TOKEN\` environment variable on your CI environment. The token must allow to publish to the registry \`${String(registry)}\`.`,
|
|
245
268
|
message: "No npm token specified."
|
|
246
269
|
};
|
|
247
|
-
},
|
|
248
|
-
ENOPKG:
|
|
270
|
+
},
|
|
271
|
+
ENOPKG: () => {
|
|
249
272
|
return {
|
|
250
273
|
details: `A [package.json file](https://docs.npmjs.com/files/package.json) at the root of your project is required to release on npm.
|
|
251
274
|
Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creating-node-modules) to create a valid \`package.json\` file.`,
|
|
252
275
|
message: "Missing `package.json` file."
|
|
253
276
|
};
|
|
254
|
-
},
|
|
255
|
-
ENOPKGNAME:
|
|
277
|
+
},
|
|
278
|
+
ENOPKGNAME: () => {
|
|
256
279
|
return {
|
|
257
280
|
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.
|
|
258
281
|
Please make sure to add a valid \`name\` for your package in your \`package.json\`.`,
|
|
259
282
|
message: "Missing `name` property in `package.json`."
|
|
260
283
|
};
|
|
261
|
-
},
|
|
262
|
-
ENOPNPM:
|
|
284
|
+
},
|
|
285
|
+
ENOPNPM: () => {
|
|
263
286
|
return {
|
|
264
287
|
details: `The Pnpm CLI could not be found in your PATH. Make sure Pnpm is installed and try again.`,
|
|
265
288
|
message: "Pnpm not found."
|
|
266
289
|
};
|
|
267
|
-
},
|
|
268
|
-
ENOPNPMRC:
|
|
290
|
+
},
|
|
291
|
+
ENOPNPMRC: () => {
|
|
269
292
|
return {
|
|
270
293
|
details: `Didnt find a \`.npmrc\` file or it was not possible to create , in the root of your project.`,
|
|
271
294
|
message: "Missing `.npmrc` file."
|
|
272
295
|
};
|
|
273
|
-
}
|
|
296
|
+
}
|
|
274
297
|
};
|
|
275
298
|
|
|
276
|
-
|
|
277
|
-
var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
|
|
278
|
-
const getError = /* @__PURE__ */ __name$8((code, context = {}) => {
|
|
299
|
+
const getError = (code, context = {}) => {
|
|
279
300
|
const { details, message } = errors[code](context);
|
|
280
301
|
return new SemanticReleaseError(message, code, details);
|
|
281
|
-
}
|
|
302
|
+
};
|
|
282
303
|
|
|
283
|
-
|
|
284
|
-
var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
|
|
285
|
-
const getPackage = /* @__PURE__ */ __name$7(async ({ pkgRoot }, { cwd }) => {
|
|
304
|
+
const getPackage = async ({ pkgRoot }, { cwd }) => {
|
|
286
305
|
try {
|
|
287
306
|
const { packageJson } = await findPackageJson(pkgRoot ? resolve(cwd, pkgRoot) : cwd);
|
|
288
307
|
if (!packageJson.name) {
|
|
@@ -297,20 +316,16 @@ const getPackage = /* @__PURE__ */ __name$7(async ({ pkgRoot }, { cwd }) => {
|
|
|
297
316
|
}
|
|
298
317
|
throw error;
|
|
299
318
|
}
|
|
300
|
-
}
|
|
319
|
+
};
|
|
301
320
|
|
|
302
|
-
|
|
303
|
-
var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
|
|
304
|
-
const nerfDart = /* @__PURE__ */ __name$6((url) => {
|
|
321
|
+
const nerfDart = (url) => {
|
|
305
322
|
const parsed = new URL(url);
|
|
306
323
|
const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`;
|
|
307
324
|
const real = new URL(".", from);
|
|
308
325
|
return `//${real.host}${real.pathname}`;
|
|
309
|
-
}
|
|
326
|
+
};
|
|
310
327
|
|
|
311
|
-
|
|
312
|
-
var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
313
|
-
const setNpmrcAuth = /* @__PURE__ */ __name$5(async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }) => {
|
|
328
|
+
const setNpmrcAuth = async (npmrc, registry, { cwd, env: { NPM_CONFIG_USERCONFIG, NPM_EMAIL, NPM_PASSWORD, NPM_TOKEN, NPM_USERNAME }, logger }) => {
|
|
314
329
|
logger.log("Verify authentication for registry %s", registry);
|
|
315
330
|
const { config, files } = rc("npm", {
|
|
316
331
|
config: NPM_CONFIG_USERCONFIG ?? resolve(cwd, ".npmrc"),
|
|
@@ -337,11 +352,9 @@ email = \${NPM_EMAIL}`);
|
|
|
337
352
|
const semanticError = getError("ENONPMTOKEN", { registry });
|
|
338
353
|
throw new AggregateError([semanticError], semanticError.message);
|
|
339
354
|
}
|
|
340
|
-
}
|
|
355
|
+
};
|
|
341
356
|
|
|
342
|
-
|
|
343
|
-
var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
|
|
344
|
-
const verifyAuth = /* @__PURE__ */ __name$4(async (npmrc, package_, context) => {
|
|
357
|
+
const verifyAuth = async (npmrc, package_, context) => {
|
|
345
358
|
const {
|
|
346
359
|
cwd,
|
|
347
360
|
env: { DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org/", ...environment },
|
|
@@ -369,27 +382,25 @@ const verifyAuth = /* @__PURE__ */ __name$4(async (npmrc, package_, context) =>
|
|
|
369
382
|
} else {
|
|
370
383
|
logger.log(`Skipping authentication verification for non-default registry "${registry}"`);
|
|
371
384
|
}
|
|
372
|
-
}
|
|
385
|
+
};
|
|
373
386
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
const isNil = /* @__PURE__ */ __name$3((value) => value === null || value === void 0, "isNil");
|
|
378
|
-
const isNonEmptyString = /* @__PURE__ */ __name$3((value) => {
|
|
387
|
+
const isString = (value) => typeof value === "string";
|
|
388
|
+
const isNil = (value) => value === null || value === void 0;
|
|
389
|
+
const isNonEmptyString = (value) => {
|
|
379
390
|
if (!isString(value)) {
|
|
380
391
|
return false;
|
|
381
392
|
}
|
|
382
393
|
return value.trim() !== "";
|
|
383
|
-
}
|
|
394
|
+
};
|
|
384
395
|
const VALIDATORS = {
|
|
385
396
|
branches: Array.isArray,
|
|
386
397
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
387
|
-
npmPublish:
|
|
398
|
+
npmPublish: (value) => typeof value === "boolean",
|
|
388
399
|
pkgRoot: isNonEmptyString,
|
|
389
400
|
publishBranch: isNonEmptyString,
|
|
390
401
|
tarballDir: isNonEmptyString
|
|
391
402
|
};
|
|
392
|
-
const verifyConfig =
|
|
403
|
+
const verifyConfig = (config) => (
|
|
393
404
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
394
405
|
Object.entries(config).reduce((errors, [option, value]) => {
|
|
395
406
|
if (isNil(value)) {
|
|
@@ -403,24 +414,19 @@ const verifyConfig = /* @__PURE__ */ __name$3((config) => (
|
|
|
403
414
|
}
|
|
404
415
|
return [...errors, getError(`EINVALID${option.toUpperCase()}`, { [option]: value })];
|
|
405
416
|
}, [])
|
|
406
|
-
)
|
|
417
|
+
);
|
|
407
418
|
|
|
408
|
-
var __defProp$2 = Object.defineProperty;
|
|
409
|
-
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
410
419
|
const MIN_PNPM_VERSION = "8.0.0";
|
|
411
|
-
async
|
|
420
|
+
const verifyPnpm = async ({ logger }) => {
|
|
412
421
|
logger.log(`Verify pnpm version is >= ${MIN_PNPM_VERSION}`);
|
|
413
422
|
const version = getPackageManagerVersion("pnpm");
|
|
414
423
|
if (gte(MIN_PNPM_VERSION, version)) {
|
|
415
424
|
const semanticError = getError("EINVALIDPNPM", { version: String(version) });
|
|
416
425
|
throw new AggregateError([semanticError], semanticError.message);
|
|
417
426
|
}
|
|
418
|
-
}
|
|
419
|
-
__name$2(verifyPnpm, "verifyPnpm");
|
|
427
|
+
};
|
|
420
428
|
|
|
421
|
-
|
|
422
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
423
|
-
const verify = /* @__PURE__ */ __name$1(async (pluginConfig, context) => {
|
|
429
|
+
const verify = async (pluginConfig, context) => {
|
|
424
430
|
let errors = verifyConfig(pluginConfig);
|
|
425
431
|
let errorsMessage = "";
|
|
426
432
|
try {
|
|
@@ -444,14 +450,12 @@ const verify = /* @__PURE__ */ __name$1(async (pluginConfig, context) => {
|
|
|
444
450
|
if (errors.length > 0) {
|
|
445
451
|
throw new AggregateError(errors, errorsMessage);
|
|
446
452
|
}
|
|
447
|
-
}
|
|
453
|
+
};
|
|
448
454
|
|
|
449
|
-
var __defProp = Object.defineProperty;
|
|
450
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
451
455
|
const PLUGIN_NAME = "semantic-release-pnpm";
|
|
452
456
|
let verified;
|
|
453
457
|
let prepared;
|
|
454
|
-
const verifyConditions =
|
|
458
|
+
const verifyConditions = async (pluginConfig, context) => {
|
|
455
459
|
if (context.options.publish) {
|
|
456
460
|
const publish2 = Array.isArray(context.options.publish) ? context.options.publish : [context.options.publish];
|
|
457
461
|
const publishPlugin = publish2.find((config) => config.path && config.path === PLUGIN_NAME) || {};
|
|
@@ -463,30 +467,30 @@ const verifyConditions = /* @__PURE__ */ __name(async (pluginConfig, context) =>
|
|
|
463
467
|
}
|
|
464
468
|
await verify(pluginConfig, context);
|
|
465
469
|
verified = true;
|
|
466
|
-
}
|
|
467
|
-
const prepare =
|
|
470
|
+
};
|
|
471
|
+
const prepare = async (pluginConfig, context) => {
|
|
468
472
|
if (!verified) {
|
|
469
473
|
await verify(pluginConfig, context);
|
|
470
474
|
}
|
|
471
|
-
await
|
|
475
|
+
await prepare$1(pluginConfig, context);
|
|
472
476
|
prepared = true;
|
|
473
|
-
}
|
|
474
|
-
const publish =
|
|
477
|
+
};
|
|
478
|
+
const publish = async (pluginConfig, context) => {
|
|
475
479
|
const packageJson = await getPackage(pluginConfig, context);
|
|
476
480
|
if (!verified) {
|
|
477
481
|
await verify(pluginConfig, context);
|
|
478
482
|
}
|
|
479
483
|
if (!prepared) {
|
|
480
|
-
await
|
|
484
|
+
await prepare$1(pluginConfig, context);
|
|
481
485
|
}
|
|
482
|
-
return await
|
|
483
|
-
}
|
|
484
|
-
const addChannel =
|
|
486
|
+
return await publish$1(pluginConfig, packageJson, context);
|
|
487
|
+
};
|
|
488
|
+
const addChannel = async (pluginConfig, context) => {
|
|
485
489
|
if (!verified) {
|
|
486
490
|
await verify(pluginConfig, context);
|
|
487
491
|
}
|
|
488
492
|
const packageJson = await getPackage(pluginConfig, context);
|
|
489
|
-
return await
|
|
490
|
-
}
|
|
493
|
+
return await addChannel$1(pluginConfig, packageJson, context);
|
|
494
|
+
};
|
|
491
495
|
|
|
492
496
|
export { addChannel, prepare, publish, verifyConditions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/semantic-release-pnpm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"description": "Semantic-release plugin to publish a npm package with pnpm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -38,27 +38,27 @@
|
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"type": "module",
|
|
41
|
-
"main": "./dist/index.
|
|
42
|
-
"types": "./dist/index.d.
|
|
41
|
+
"main": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
43
|
"files": [
|
|
44
44
|
"CHANGELOG.md",
|
|
45
45
|
"README.md",
|
|
46
46
|
"dist"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@anolilab/rc": "
|
|
49
|
+
"@anolilab/rc": "3.0.0-alpha.1",
|
|
50
50
|
"@semantic-release/error": "^4.0.0",
|
|
51
|
-
"@visulima/fs": "^3.1.
|
|
52
|
-
"@visulima/package": "^
|
|
51
|
+
"@visulima/fs": "^3.1.9",
|
|
52
|
+
"@visulima/package": "^4.0.2",
|
|
53
53
|
"@visulima/path": "^1.4.0",
|
|
54
54
|
"execa": "^9.6.0",
|
|
55
55
|
"ini": "^5.0.0",
|
|
56
|
-
"normalize-url": "^8.0
|
|
56
|
+
"normalize-url": "^8.1.0",
|
|
57
57
|
"registry-auth-token": "^5.1.0",
|
|
58
|
-
"semver": "^7.7.
|
|
58
|
+
"semver": "^7.7.3"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
61
|
+
"node": "^22.14.0 || >=24.10.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public",
|
package/dist/index.d.mts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import stream from 'node:stream';
|
|
2
|
-
|
|
3
|
-
interface BranchObject {
|
|
4
|
-
channel?: string | false | undefined;
|
|
5
|
-
name: string;
|
|
6
|
-
prerelease?: boolean | string | undefined;
|
|
7
|
-
range?: string | undefined;
|
|
8
|
-
}
|
|
9
|
-
type BranchSpec$1 = BranchObject | string;
|
|
10
|
-
type PluginSpec<T = any> = string | [string, T];
|
|
11
|
-
interface Options {
|
|
12
|
-
[name: string]: any;
|
|
13
|
-
branches?: BranchSpec$1 | ReadonlyArray<BranchSpec$1> | undefined;
|
|
14
|
-
ci?: boolean | undefined;
|
|
15
|
-
dryRun?: boolean | undefined;
|
|
16
|
-
extends?: ReadonlyArray<string> | string | undefined;
|
|
17
|
-
plugins?: ReadonlyArray<PluginSpec> | undefined;
|
|
18
|
-
repositoryUrl?: string | undefined;
|
|
19
|
-
tagFormat?: string | undefined;
|
|
20
|
-
}
|
|
21
|
-
interface Commit {
|
|
22
|
-
author: {
|
|
23
|
-
email: string;
|
|
24
|
-
name: string;
|
|
25
|
-
short: string;
|
|
26
|
-
};
|
|
27
|
-
body: string;
|
|
28
|
-
commit: {
|
|
29
|
-
long: string;
|
|
30
|
-
short: string;
|
|
31
|
-
};
|
|
32
|
-
committer: {
|
|
33
|
-
email: string;
|
|
34
|
-
name: string;
|
|
35
|
-
short: string;
|
|
36
|
-
};
|
|
37
|
-
committerDate: string;
|
|
38
|
-
hash: string;
|
|
39
|
-
message: string;
|
|
40
|
-
subject: string;
|
|
41
|
-
tree: {
|
|
42
|
-
long: string;
|
|
43
|
-
short: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface CommonContext {
|
|
48
|
-
branch: BranchSpec;
|
|
49
|
-
branches: BranchSpec[];
|
|
50
|
-
cwd: string;
|
|
51
|
-
env: "object";
|
|
52
|
-
logger: {
|
|
53
|
-
error: (...message: string[]) => void;
|
|
54
|
-
log: (...message: string[]) => void;
|
|
55
|
-
success: (...message: string[]) => void;
|
|
56
|
-
};
|
|
57
|
-
options: Options;
|
|
58
|
-
stderr: stream.Writable;
|
|
59
|
-
stdout: stream.Writable;
|
|
60
|
-
}
|
|
61
|
-
type VerifyConditionsContext = CommonContext;
|
|
62
|
-
type CommonContext2 = CommonContext & {
|
|
63
|
-
releases: Release[];
|
|
64
|
-
};
|
|
65
|
-
type AddChannelContext = CommonContext2 & {
|
|
66
|
-
commits: Commit[];
|
|
67
|
-
currentRelease: Release;
|
|
68
|
-
lastRelease: Release;
|
|
69
|
-
nextRelease: Release;
|
|
70
|
-
};
|
|
71
|
-
type CommonContext3 = CommonContext2 & {
|
|
72
|
-
commits: Commit[];
|
|
73
|
-
lastRelease: Release;
|
|
74
|
-
};
|
|
75
|
-
type CommonContext4 = CommonContext3 & {
|
|
76
|
-
commits: Commit[];
|
|
77
|
-
nextRelease: Release;
|
|
78
|
-
};
|
|
79
|
-
type PrepareContext = CommonContext4;
|
|
80
|
-
type PublishContext = CommonContext4;
|
|
81
|
-
interface BranchSpec {
|
|
82
|
-
name: string;
|
|
83
|
-
tags?: Tag[];
|
|
84
|
-
}
|
|
85
|
-
interface Tag {
|
|
86
|
-
channel?: string;
|
|
87
|
-
gitHead?: string;
|
|
88
|
-
gitTag?: string;
|
|
89
|
-
version?: string;
|
|
90
|
-
}
|
|
91
|
-
interface Release {
|
|
92
|
-
channel?: string | null;
|
|
93
|
-
gitHead?: string;
|
|
94
|
-
gitTag?: string;
|
|
95
|
-
name?: string;
|
|
96
|
-
type?: "build" | "major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease" | undefined;
|
|
97
|
-
version: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
interface PluginConfig {
|
|
101
|
-
branches?: (string | {
|
|
102
|
-
name: string;
|
|
103
|
-
prerelease: boolean;
|
|
104
|
-
})[];
|
|
105
|
-
disableScripts?: boolean;
|
|
106
|
-
npmPublish?: boolean;
|
|
107
|
-
pkgRoot?: string;
|
|
108
|
-
publishBranch?: string;
|
|
109
|
-
tarballDir?: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
interface ReleaseInfo {
|
|
113
|
-
channel: string;
|
|
114
|
-
name: string;
|
|
115
|
-
url?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
declare const verifyConditions: (pluginConfig: PluginConfig, context: VerifyConditionsContext) => Promise<void>;
|
|
119
|
-
declare const prepare: (pluginConfig: PluginConfig, context: PrepareContext) => Promise<void>;
|
|
120
|
-
declare const publish: (pluginConfig: PluginConfig, context: PublishContext) => Promise<ReleaseInfo | false>;
|
|
121
|
-
declare const addChannel: (pluginConfig: PluginConfig, context: AddChannelContext) => Promise<ReleaseInfo | false>;
|
|
122
|
-
|
|
123
|
-
export { addChannel, prepare, publish, verifyConditions };
|