@containerbase/semantic-release-pnpm 1.0.0-semantic-release → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +68 -14
  2. package/package.json +7 -3
package/lib/index.js CHANGED
@@ -1,12 +1,71 @@
1
1
  /* eslint-disable */ // @ts-nocheck
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
2
7
 
3
- // packages/pnpm/src/index.ts
4
- import { validRange } from "semver";
8
+ // src/index.ts
5
9
  import { execa } from "execa";
6
10
  import "semantic-release";
11
+ import AggregateError from "aggregate-error";
12
+
13
+ // src/get-error.ts
14
+ import SemanticReleaseError from "@semantic-release/error";
15
+
16
+ // src/definitions/errors.ts
17
+ var errors_exports = {};
18
+ __export(errors_exports, {
19
+ EINVALIDNPMAUTH: () => EINVALIDNPMAUTH
20
+ });
21
+ function EINVALIDNPMAUTH(_ctx) {
22
+ return {
23
+ message: "Invalid npm authentication.",
24
+ details: `The authentication required to publish is not configured as needed.
25
+
26
+ Please verify your authentication configuration.`
27
+ };
28
+ }
29
+
30
+ // src/get-error.ts
31
+ var get_error_default = (code, ctx = {}) => {
32
+ const { message, details } = errors_exports[code](ctx);
33
+ return new SemanticReleaseError(message, code, details);
34
+ };
35
+
36
+ // src/util.ts
37
+ import validRange from "semver/ranges/valid.js";
7
38
  function getChannel(channel) {
8
39
  return channel ? validRange(channel) ? `release-${channel}` : channel : "latest";
9
40
  }
41
+
42
+ // src/index.ts
43
+ async function verifyConditions(_pluginConfig, { cwd = ".", env, stderr, stdout, logger }) {
44
+ logger.log(`Verifying registry access`);
45
+ const res = await execa(
46
+ "pnpm",
47
+ [
48
+ "-r",
49
+ "publish",
50
+ "--dry-run",
51
+ "--tag",
52
+ "semantic-release-auth-check",
53
+ "--no-git-checks"
54
+ ],
55
+ {
56
+ cwd,
57
+ env,
58
+ stdout: ["pipe", stdout],
59
+ stderr: ["pipe", stderr],
60
+ lines: true
61
+ }
62
+ );
63
+ for (const line of [...res.stdout, ...res.stderr]) {
64
+ if (line.includes("This command requires you to be logged in to ")) {
65
+ throw new AggregateError([get_error_default("EINVALIDNPMAUTH")]);
66
+ }
67
+ }
68
+ }
10
69
  async function prepare(_pluginConfig, {
11
70
  cwd = ".",
12
71
  env,
@@ -30,8 +89,8 @@ async function prepare(_pluginConfig, {
30
89
  {
31
90
  cwd,
32
91
  env,
33
- stderr,
34
- stdout
92
+ stdout,
93
+ stderr
35
94
  }
36
95
  );
37
96
  }
@@ -49,22 +108,17 @@ async function publish(_pluginConfig, {
49
108
  );
50
109
  await execa(
51
110
  "pnpm",
52
- [
53
- "-r",
54
- "publish",
55
- "--tag",
56
- distributionTag,
57
- "--no-git-checks"
58
- ],
111
+ ["-r", "publish", "--tag", distributionTag, "--no-git-checks"],
59
112
  {
60
113
  cwd,
61
114
  env,
62
- stderr,
63
- stdout
115
+ stdout,
116
+ stderr
64
117
  }
65
118
  );
66
119
  }
67
120
  export {
68
121
  prepare,
69
- publish
122
+ publish,
123
+ verifyConditions
70
124
  };
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@containerbase/semantic-release-pnpm",
3
- "version": "1.0.0-semantic-release",
3
+ "version": "1.2.0",
4
4
  "description": "A pnpm plugin for semantic-release",
5
5
  "keywords": [
6
6
  "semantic-release",
7
7
  "pnpm"
8
8
  ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/containerbase/semantic-release.git"
12
+ },
9
13
  "license": "MIT",
10
14
  "author": "Michael Kriese <michael.kriese@gmx.de>",
11
15
  "type": "module",
@@ -14,9 +18,9 @@
14
18
  "lib"
15
19
  ],
16
20
  "dependencies": {
21
+ "@semantic-release/error": "^4.0.0",
22
+ "aggregate-error": "^5.0.0",
17
23
  "execa": "^9.0.0",
18
- "npm": "^11.6.0",
19
- "pnpm": "^10.16.1",
20
24
  "semver": "^7.7.2"
21
25
  },
22
26
  "peerDependencies": {