@containerbase/semantic-release-pnpm 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/lib/index.js +81 -7
  2. package/package.json +3 -1
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,
@@ -16,6 +75,22 @@ async function prepare(_pluginConfig, {
16
75
  nextRelease: { version }
17
76
  }) {
18
77
  logger.log("Write version %s to package.json in %s", version, cwd);
78
+ await execa(
79
+ "pnpm",
80
+ [
81
+ "pnpm",
82
+ "version",
83
+ version,
84
+ "--no-git-tag-version",
85
+ "--allow-same-version"
86
+ ],
87
+ {
88
+ cwd,
89
+ env,
90
+ stdout,
91
+ stderr
92
+ }
93
+ );
19
94
  await execa(
20
95
  "pnpm",
21
96
  [
@@ -31,8 +106,7 @@ async function prepare(_pluginConfig, {
31
106
  cwd,
32
107
  env,
33
108
  stdout,
34
- stderr,
35
- preferLocal: true
109
+ stderr
36
110
  }
37
111
  );
38
112
  }
@@ -55,12 +129,12 @@ async function publish(_pluginConfig, {
55
129
  cwd,
56
130
  env,
57
131
  stdout,
58
- stderr,
59
- preferLocal: true
132
+ stderr
60
133
  }
61
134
  );
62
135
  }
63
136
  export {
64
137
  prepare,
65
- publish
138
+ publish,
139
+ verifyConditions
66
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@containerbase/semantic-release-pnpm",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "A pnpm plugin for semantic-release",
5
5
  "keywords": [
6
6
  "semantic-release",
@@ -18,6 +18,8 @@
18
18
  "lib"
19
19
  ],
20
20
  "dependencies": {
21
+ "@semantic-release/error": "^4.0.0",
22
+ "aggregate-error": "^5.0.0",
21
23
  "execa": "^9.0.0",
22
24
  "semver": "^7.7.2"
23
25
  },