semantic-release-vsce 5.6.2 → 5.6.4

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.
@@ -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.3.0
14
+ - uses: amannn/action-semantic-pull-request@v5.4.0
15
15
  env:
16
16
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,13 +1,13 @@
1
1
  // @ts-check
2
2
 
3
- const { createError } = require('./error');
3
+ const SemanticReleaseError = require('@semantic-release/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 await createError(
10
+ throw new SemanticReleaseError(
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 await createError(
19
+ throw new SemanticReleaseError(
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 { createError } = require('./error');
3
+ const SemanticReleaseError = require('@semantic-release/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 await createError(
9
+ throw new SemanticReleaseError(
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 await createError(
20
+ throw new SemanticReleaseError(
21
21
  'The `package.json` seems to be invalid.',
22
22
  'EINVALIDPKG',
23
23
  );
@@ -26,10 +26,13 @@ module.exports = async () => {
26
26
  const { name, publisher } = packageJson;
27
27
 
28
28
  if (!name) {
29
- throw await createError('No `name` found in `package.json`.', 'ENOPKGNAME');
29
+ throw new SemanticReleaseError(
30
+ 'No `name` found in `package.json`.',
31
+ 'ENOPKGNAME',
32
+ );
30
33
  }
31
34
  if (!publisher) {
32
- throw await createError(
35
+ throw new SemanticReleaseError(
33
36
  'No `publisher` found in `package.json`.',
34
37
  'ENOPUBLISHER',
35
38
  );
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- const { createError } = require('./error');
3
+ const SemanticReleaseError = require('@semantic-release/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 await createError(
12
+ throw new SemanticReleaseError(
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 await createError(
23
+ throw new SemanticReleaseError(
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 { createError } = require('./error');
3
+ const SemanticReleaseError = require('@semantic-release/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 await createError(
10
+ throw new SemanticReleaseError(
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 await createError(
19
+ throw new SemanticReleaseError(
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 { createError } = require('./error');
3
+ const SemanticReleaseError = require('@semantic-release/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 await createError(
18
+ throw new SemanticReleaseError(
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,10 +1,10 @@
1
1
  {
2
2
  "name": "semantic-release-vsce",
3
- "version": "5.6.2",
3
+ "version": "5.6.4",
4
4
  "description": "semantic-release plugin to package and publish VS Code extensions",
5
5
  "license": "MIT",
6
6
  "engines": {
7
- "node": ">=14"
7
+ "node": "^14.17.0 || >=16.0.0"
8
8
  },
9
9
  "repository": "https://github.com/felipecrs/semantic-release-vsce.git",
10
10
  "bugs": "https://github.com/felipecrs/semantic-release-vsce/issues",
@@ -21,10 +21,10 @@
21
21
  ],
22
22
  "main": "index.js",
23
23
  "scripts": {
24
- "lint": "prettier --check . && eslint .",
24
+ "lint": "prettier --check . && eslint . ",
25
25
  "release": "semantic-release",
26
26
  "test": "nyc ava",
27
- "posttest": "npm run lint",
27
+ "posttest": "npm run lint && installed-check --engine-no-dev",
28
28
  "prepare": "husky install"
29
29
  },
30
30
  "ava": {
@@ -47,7 +47,7 @@
47
47
  "npm": "9.8.1"
48
48
  },
49
49
  "dependencies": {
50
- "@semantic-release/error": "^4.0.0",
50
+ "@semantic-release/error": "^3.0.0",
51
51
  "@vscode/vsce": "^2.15.0",
52
52
  "execa": "^5.0.0",
53
53
  "fs-extra": "^11.1.0",
@@ -67,12 +67,13 @@
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": "^14.0.0",
70
+ "installed-check": "^8.0.0",
71
+ "lint-staged": "^15.0.1",
71
72
  "nyc": "^15.1.0",
72
- "prettier": "3.0.3",
73
+ "prettier": "3.1.0",
73
74
  "proxyquire": "^2.1.3",
74
75
  "semantic-release": "^21.0.1",
75
- "sinon": "^16.0.0"
76
+ "sinon": "^17.0.1"
76
77
  },
77
78
  "lint-staged": {
78
79
  "**/*": "prettier --write --ignore-unknown"
@@ -1,6 +1,7 @@
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');
4
5
 
5
6
  const cwd = process.cwd();
6
7
 
@@ -36,6 +37,7 @@ test('OVSX_PAT is invalid', async (t) => {
36
37
  const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
37
38
 
38
39
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
40
+ instanceOf: SemanticReleaseError,
39
41
  code: 'EEMPTYOVSXPAT',
40
42
  });
41
43
  });
@@ -52,6 +54,7 @@ test('OVSX_PAT is invalid but not empty', async (t) => {
52
54
  const verifyOvsxAuth = require('../lib/verify-ovsx-auth');
53
55
 
54
56
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
57
+ instanceOf: SemanticReleaseError,
55
58
  code: 'EINVALIDOVSXPAT',
56
59
  });
57
60
  });
@@ -1,6 +1,7 @@
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');
4
5
 
5
6
  test('package.json is found', async (t) => {
6
7
  const name = 'test';
@@ -38,6 +39,7 @@ test('package.json is not found', async (t) => {
38
39
  });
39
40
 
40
41
  await t.throwsAsync(() => verifyPkg(), {
42
+ instanceOf: SemanticReleaseError,
41
43
  code: 'ENOPKG',
42
44
  });
43
45
  });
@@ -71,6 +73,7 @@ test('package is invalid', async (t) => {
71
73
  });
72
74
 
73
75
  await t.throwsAsync(() => verifyPkg(), {
76
+ instanceOf: SemanticReleaseError,
74
77
  code: 'EINVALIDPKG',
75
78
  });
76
79
  });
@@ -89,6 +92,7 @@ test('package is missing name', async (t) => {
89
92
  });
90
93
 
91
94
  await t.throwsAsync(() => verifyPkg(), {
95
+ instanceOf: SemanticReleaseError,
92
96
  code: 'ENOPKGNAME',
93
97
  });
94
98
  });
@@ -107,6 +111,7 @@ test('package is missing publisher', async (t) => {
107
111
  });
108
112
 
109
113
  await t.throwsAsync(() => verifyPkg(), {
114
+ instanceOf: SemanticReleaseError,
110
115
  code: 'ENOPUBLISHER',
111
116
  });
112
117
  });
@@ -1,6 +1,7 @@
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');
4
5
 
5
6
  test('VSCE_TARGET is not set', async (t) => {
6
7
  const vscePackage = sinon.stub().returns({
@@ -35,6 +36,7 @@ test('VSCE_TARGET is empty', async (t) => {
35
36
  });
36
37
 
37
38
  await t.throwsAsync(() => verifyTarget(), {
39
+ instanceOf: SemanticReleaseError,
38
40
  code: 'EINVALIDVSCETARGET',
39
41
  });
40
42
  t.false(vscePackage.called);
@@ -47,6 +49,7 @@ test('VSCE_TARGET is unsupported', async (t) => {
47
49
  const verifyTarget = require('../lib/verify-target');
48
50
 
49
51
  await t.throwsAsync(() => verifyTarget(), {
52
+ instanceOf: SemanticReleaseError,
50
53
  code: 'EUNSUPPORTEDVSCETARGET',
51
54
  });
52
55
  });
@@ -1,6 +1,7 @@
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');
4
5
 
5
6
  const logger = {
6
7
  log: sinon.fake(),
@@ -49,6 +50,7 @@ test('VSCE_PAT is invalid', async (t) => {
49
50
  const verifyOvsxAuth = require('../lib/verify-vsce-auth');
50
51
 
51
52
  await t.throwsAsync(() => verifyOvsxAuth(logger), {
53
+ instanceOf: SemanticReleaseError,
52
54
  code: 'EEMPTYVSCEPAT',
53
55
  });
54
56
  });
@@ -66,6 +68,7 @@ test('VSCE_PAT is invalid but not empty', async (t) => {
66
68
  });
67
69
 
68
70
  await t.throwsAsync(() => verifyVsceAuth(logger), {
71
+ instanceOf: SemanticReleaseError,
69
72
  code: 'EINVALIDVSCEPAT',
70
73
  });
71
74
  });
@@ -1,3 +1,4 @@
1
+ const SemanticReleaseError = require('@semantic-release/error');
1
2
  const test = require('ava');
2
3
  const sinon = require('sinon');
3
4
  const proxyquire = require('proxyquire');
@@ -106,9 +107,7 @@ test('errors when neither vsce nor ovsx personal access token is configured', as
106
107
  });
107
108
 
108
109
  await t.throwsAsync(() => verify({}, { logger, cwd }), {
109
- // TODO: restore all instanceOf checks like the below when we finally
110
- // upgrade to ES Modules.
111
- // instanceOf: SemanticReleaseError,
110
+ instanceOf: SemanticReleaseError,
112
111
  code: 'ENOPAT',
113
112
  });
114
113
  t.true(stubs.verifyVsceAuthStub.notCalled);
package/lib/error.js DELETED
@@ -1,11 +0,0 @@
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
- };