semantic-release-vsce 5.6.0 → 5.6.2

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.
@@ -22,7 +22,7 @@ jobs:
22
22
  - 18
23
23
 
24
24
  steps:
25
- - uses: actions/checkout@v3
25
+ - uses: actions/checkout@v4
26
26
  - uses: volta-cli/action@v4.0.1
27
27
  with:
28
28
  node-version: ${{ matrix.node-version }}
@@ -35,7 +35,7 @@ jobs:
35
35
  needs: test
36
36
 
37
37
  steps:
38
- - uses: actions/checkout@v3
38
+ - uses: actions/checkout@v4
39
39
  - uses: volta-cli/action@v4.0.1
40
40
  - run: npm ci
41
41
  - run: npm run release
@@ -11,6 +11,6 @@ jobs:
11
11
  validate-pr-title:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: amannn/action-semantic-pull-request@v5.2.0
14
+ - uses: amannn/action-semantic-pull-request@v5.3.0
15
15
  env:
16
16
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/lib/error.js ADDED
@@ -0,0 +1,11 @@
1
+ // @ts-check
2
+
3
+ const createError = async (message, code) => {
4
+ const SemanticReleaseError = (await import('@semantic-release/error'))
5
+ .default;
6
+ return new SemanticReleaseError(message, code);
7
+ };
8
+
9
+ module.exports = {
10
+ createError,
11
+ };
@@ -1,13 +1,13 @@
1
1
  // @ts-check
2
2
 
3
- const SemanticReleaseError = require('@semantic-release/error');
3
+ const { createError } = require('./error');
4
4
  const execa = require('execa');
5
5
 
6
6
  module.exports = async (logger, cwd) => {
7
7
  logger.log('Verifying authentication for ovsx');
8
8
 
9
9
  if (!process.env.OVSX_PAT) {
10
- throw new SemanticReleaseError(
10
+ throw await createError(
11
11
  'Empty ovsx personal access token (`OVSX_PAT` environment variable) specified.',
12
12
  'EEMPTYOVSXPAT',
13
13
  );
@@ -16,7 +16,7 @@ module.exports = async (logger, cwd) => {
16
16
  try {
17
17
  await execa('ovsx', ['verify-pat'], { preferLocal: true, cwd });
18
18
  } catch (e) {
19
- throw new SemanticReleaseError(
19
+ throw await createError(
20
20
  `Invalid ovsx personal access token. Additional information:\n\n${e}`,
21
21
  'EINVALIDOVSXPAT',
22
22
  );
package/lib/verify-pkg.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // @ts-check
2
2
 
3
- const SemanticReleaseError = require('@semantic-release/error');
3
+ const { createError } = require('./error');
4
4
  const { readJson } = require('fs-extra');
5
5
  const fs = require('fs');
6
6
 
7
7
  module.exports = async () => {
8
8
  if (!fs.existsSync('./package.json')) {
9
- throw new SemanticReleaseError(
9
+ throw await createError(
10
10
  'The `package.json` was not found. A `package.json` is required to release with vsce.',
11
11
  'ENOPKG',
12
12
  );
@@ -17,7 +17,7 @@ module.exports = async () => {
17
17
  try {
18
18
  packageJson = await readJson('./package.json');
19
19
  } catch {
20
- throw new SemanticReleaseError(
20
+ throw await createError(
21
21
  'The `package.json` seems to be invalid.',
22
22
  'EINVALIDPKG',
23
23
  );
@@ -26,13 +26,10 @@ module.exports = async () => {
26
26
  const { name, publisher } = packageJson;
27
27
 
28
28
  if (!name) {
29
- throw new SemanticReleaseError(
30
- 'No `name` found in `package.json`.',
31
- 'ENOPKGNAME',
32
- );
29
+ throw await createError('No `name` found in `package.json`.', 'ENOPKGNAME');
33
30
  }
34
31
  if (!publisher) {
35
- throw new SemanticReleaseError(
32
+ throw await createError(
36
33
  'No `publisher` found in `package.json`.',
37
34
  'ENOPUBLISHER',
38
35
  );
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- const SemanticReleaseError = require('@semantic-release/error');
3
+ const { createError } = require('./error');
4
4
  const { isTargetEnabled } = require('./utils');
5
5
 
6
6
  module.exports = async () => {
@@ -9,7 +9,7 @@ module.exports = async () => {
9
9
  }
10
10
 
11
11
  if (!process.env.VSCE_TARGET) {
12
- throw new SemanticReleaseError(
12
+ throw await createError(
13
13
  'Empty vsce target specified.',
14
14
  'EINVALIDVSCETARGET',
15
15
  );
@@ -20,7 +20,7 @@ module.exports = async () => {
20
20
 
21
21
  // Throw if the target is not supported
22
22
  if (!targets.has(process.env.VSCE_TARGET)) {
23
- throw new SemanticReleaseError(
23
+ throw await createError(
24
24
  `Unsupported vsce target: ${
25
25
  process.env.VSCE_TARGET
26
26
  }. Available targets: ${Object.values(targets).join(', ')}`,
@@ -1,13 +1,13 @@
1
1
  // @ts-check
2
2
 
3
- const SemanticReleaseError = require('@semantic-release/error');
3
+ const { createError } = require('./error');
4
4
  const execa = require('execa');
5
5
 
6
6
  module.exports = async (logger, cwd) => {
7
7
  logger.log('Verifying authentication for vsce');
8
8
 
9
9
  if (!process.env.VSCE_PAT) {
10
- throw new SemanticReleaseError(
10
+ throw await createError(
11
11
  'Empty vsce personal access token (`VSCE_PAT` environment variable) specified.',
12
12
  'EEMPTYVSCEPAT',
13
13
  );
@@ -16,7 +16,7 @@ module.exports = async (logger, cwd) => {
16
16
  try {
17
17
  await execa('vsce', ['verify-pat'], { preferLocal: true, cwd });
18
18
  } catch (e) {
19
- throw new SemanticReleaseError(
19
+ throw await createError(
20
20
  `Invalid vsce personal access token. Additional information:\n\n${e}`,
21
21
  'EINVALIDVSCEPAT',
22
22
  );
package/lib/verify.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- const SemanticReleaseError = require('@semantic-release/error');
3
+ const { createError } = require('./error');
4
4
  const verifyPkg = require('./verify-pkg');
5
5
  const verifyVsceAuth = require('./verify-vsce-auth');
6
6
  const verifyOvsxAuth = require('./verify-ovsx-auth');
@@ -15,7 +15,7 @@ module.exports = async (pluginConfig, { logger, cwd }) => {
15
15
  const vscePublishEnabled = isVscePublishEnabled();
16
16
  const ovsxPublishEnabled = isOvsxPublishEnabled();
17
17
  if (!vscePublishEnabled && !ovsxPublishEnabled) {
18
- throw new SemanticReleaseError(
18
+ throw await createError(
19
19
  'No personal access token was detected. Set the `VSCE_PAT` or the `OVSX_PAT` environment variable, at least one of them must be present when publish is enabled.\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing',
20
20
  'ENOPAT',
21
21
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-vsce",
3
- "version": "5.6.0",
3
+ "version": "5.6.2",
4
4
  "description": "semantic-release plugin to package and publish VS Code extensions",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -43,11 +43,11 @@
43
43
  ]
44
44
  },
45
45
  "volta": {
46
- "node": "18.16.1",
47
- "npm": "9.8.0"
46
+ "node": "18.18.0",
47
+ "npm": "9.8.1"
48
48
  },
49
49
  "dependencies": {
50
- "@semantic-release/error": "^3.0.0",
50
+ "@semantic-release/error": "^4.0.0",
51
51
  "@vscode/vsce": "^2.15.0",
52
52
  "execa": "^5.0.0",
53
53
  "fs-extra": "^11.1.0",
@@ -61,18 +61,18 @@
61
61
  "ava": "^5.0.1",
62
62
  "conventional-changelog-conventionalcommits": "^6.0.0",
63
63
  "eslint": "^8.7.0",
64
- "eslint-config-prettier": "^8.5.0",
64
+ "eslint-config-prettier": "^9.0.0",
65
65
  "eslint-config-standard": "^17.0.0",
66
66
  "eslint-plugin-import": "^2.20.1",
67
67
  "eslint-plugin-n": "^16.0.0",
68
68
  "eslint-plugin-promise": "^6.0.0",
69
69
  "husky": "^8.0.2",
70
- "lint-staged": "^13.0.3",
70
+ "lint-staged": "^14.0.0",
71
71
  "nyc": "^15.1.0",
72
- "prettier": "3.0.0",
72
+ "prettier": "3.0.3",
73
73
  "proxyquire": "^2.1.3",
74
74
  "semantic-release": "^21.0.1",
75
- "sinon": "^15.0.0"
75
+ "sinon": "^16.0.0"
76
76
  },
77
77
  "lint-staged": {
78
78
  "**/*": "prettier --write --ignore-unknown"
@@ -1,7 +1,6 @@
1
1
  const test = require('ava').serial;
2
2
  const sinon = require('sinon');
3
3
  const proxyquire = require('proxyquire');
4
- const SemanticReleaseError = require('@semantic-release/error');
5
4
 
6
5
  const cwd = process.cwd();
7
6
 
@@ -37,7 +36,6 @@ test('OVSX_PAT is invalid', async (t) => {
37
36
  const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
38
37
 
39
38
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
40
- instanceOf: SemanticReleaseError,
41
39
  code: 'EEMPTYOVSXPAT',
42
40
  });
43
41
  });
@@ -54,7 +52,6 @@ test('OVSX_PAT is invalid but not empty', async (t) => {
54
52
  const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
55
53
 
56
54
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
57
- instanceOf: SemanticReleaseError,
58
55
  code: 'EINVALIDOVSXPAT',
59
56
  });
60
57
  });
@@ -1,7 +1,6 @@
1
1
  const sinon = require('sinon');
2
2
  const test = require('ava');
3
3
  const proxyquire = require('proxyquire');
4
- const SemanticReleaseError = require('@semantic-release/error');
5
4
 
6
5
  test('package.json is found', async (t) => {
7
6
  const name = 'test';
@@ -39,7 +38,6 @@ test('package.json is not found', async (t) => {
39
38
  });
40
39
 
41
40
  await t.throwsAsync(() => verifyPkg(), {
42
- instanceOf: SemanticReleaseError,
43
41
  code: 'ENOPKG',
44
42
  });
45
43
  });
@@ -73,7 +71,6 @@ test('package is invalid', async (t) => {
73
71
  });
74
72
 
75
73
  await t.throwsAsync(() => verifyPkg(), {
76
- instanceOf: SemanticReleaseError,
77
74
  code: 'EINVALIDPKG',
78
75
  });
79
76
  });
@@ -92,7 +89,6 @@ test('package is missing name', async (t) => {
92
89
  });
93
90
 
94
91
  await t.throwsAsync(() => verifyPkg(), {
95
- instanceOf: SemanticReleaseError,
96
92
  code: 'ENOPKGNAME',
97
93
  });
98
94
  });
@@ -111,7 +107,6 @@ test('package is missing publisher', async (t) => {
111
107
  });
112
108
 
113
109
  await t.throwsAsync(() => verifyPkg(), {
114
- instanceOf: SemanticReleaseError,
115
110
  code: 'ENOPUBLISHER',
116
111
  });
117
112
  });
@@ -1,7 +1,6 @@
1
1
  const sinon = require('sinon');
2
2
  const test = require('ava');
3
3
  const proxyquire = require('proxyquire');
4
- const SemanticReleaseError = require('@semantic-release/error');
5
4
 
6
5
  test('VSCE_TARGET is not set', async (t) => {
7
6
  const vscePackage = sinon.stub().returns({
@@ -36,7 +35,6 @@ test('VSCE_TARGET is empty', async (t) => {
36
35
  });
37
36
 
38
37
  await t.throwsAsync(() => verifyTarget(), {
39
- instanceOf: SemanticReleaseError,
40
38
  code: 'EINVALIDVSCETARGET',
41
39
  });
42
40
  t.false(vscePackage.called);
@@ -49,7 +47,6 @@ test('VSCE_TARGET is unsupported', async (t) => {
49
47
  const verifyTarget = require('../lib/verify-target');
50
48
 
51
49
  await t.throwsAsync(() => verifyTarget(), {
52
- instanceOf: SemanticReleaseError,
53
50
  code: 'EUNSUPPORTEDVSCETARGET',
54
51
  });
55
52
  });
@@ -1,7 +1,6 @@
1
1
  const test = require('ava').serial;
2
2
  const sinon = require('sinon');
3
3
  const proxyquire = require('proxyquire');
4
- const SemanticReleaseError = require('@semantic-release/error');
5
4
 
6
5
  const logger = {
7
6
  log: sinon.fake(),
@@ -50,7 +49,6 @@ test('VSCE_PAT is invalid', async (t) => {
50
49
  const verifyOvsxAuth = require('../lib/verify-vsce-auth');
51
50
 
52
51
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
53
- instanceOf: SemanticReleaseError,
54
52
  code: 'EEMPTYVSCEPAT',
55
53
  });
56
54
  });
@@ -68,7 +66,6 @@ test('VSCE_PAT is invalid but not empty', async (t) => {
68
66
  });
69
67
 
70
68
  await t.throwsAsync(() => verifyVsceAuth(logger), {
71
- instanceOf: SemanticReleaseError,
72
69
  code: 'EINVALIDVSCEPAT',
73
70
  });
74
71
  });
@@ -1,4 +1,3 @@
1
- const SemanticReleaseError = require('@semantic-release/error');
2
1
  const test = require('ava');
3
2
  const sinon = require('sinon');
4
3
  const proxyquire = require('proxyquire');
@@ -107,7 +106,9 @@ test('errors when neither vsce nor ovsx personal access token is configured', as
107
106
  });
108
107
 
109
108
  await t.throwsAsync(() => verify({}, { logger, cwd }), {
110
- instanceOf: SemanticReleaseError,
109
+ // TODO: restore all instanceOf checks like the below when we finally
110
+ // upgrade to ES Modules.
111
+ // instanceOf: SemanticReleaseError,
111
112
  code: 'ENOPAT',
112
113
  });
113
114
  t.true(stubs.verifyVsceAuthStub.notCalled);