semantic-release-vsce 5.6.3 → 5.7.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.
- package/.github/workflows/ci.yaml +3 -3
- package/.github/workflows/validate-pr-title.yaml +1 -1
- package/.husky/pre-commit +1 -2
- package/README.md +5 -2
- package/index.js +10 -0
- package/lib/prepare.js +2 -1
- package/lib/publish.js +2 -1
- package/lib/verify-pkg.js +7 -4
- package/lib/verify.js +1 -1
- package/package.json +12 -12
- package/test/index.test.js +30 -0
- package/test/verify-pkg.test.js +8 -6
|
@@ -17,13 +17,13 @@ jobs:
|
|
|
17
17
|
strategy:
|
|
18
18
|
matrix:
|
|
19
19
|
node-version:
|
|
20
|
-
- 14
|
|
21
20
|
- 16
|
|
22
21
|
- 18
|
|
22
|
+
- 20
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- uses: actions/checkout@v4
|
|
26
|
-
- uses: volta-cli/action@v4
|
|
26
|
+
- uses: volta-cli/action@v4
|
|
27
27
|
with:
|
|
28
28
|
node-version: ${{ matrix.node-version }}
|
|
29
29
|
- run: npm ci
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
|
|
37
37
|
steps:
|
|
38
38
|
- uses: actions/checkout@v4
|
|
39
|
-
- uses: volta-cli/action@v4
|
|
39
|
+
- uses: volta-cli/action@v4
|
|
40
40
|
- run: npm ci
|
|
41
41
|
- run: npm run release
|
|
42
42
|
env:
|
package/.husky/pre-commit
CHANGED
package/README.md
CHANGED
|
@@ -88,6 +88,10 @@ Which `.vsix` file (or files) to publish. This controls what value will be used
|
|
|
88
88
|
| `false` | do not use a `.vsix` file to publish, which causes `vsce` to package the extension as part of the publish process |
|
|
89
89
|
| a `string` | publish the specified `.vsix` file(s). This can be a glob pattern, or a comma-separated list of files |
|
|
90
90
|
|
|
91
|
+
### `packageRoot`
|
|
92
|
+
|
|
93
|
+
The directory of the extension relative to the current working directory. Defaults to `cwd`.
|
|
94
|
+
|
|
91
95
|
### Environment variables
|
|
92
96
|
|
|
93
97
|
The following environment variables are supported by this plugin:
|
|
@@ -102,8 +106,7 @@ The following environment variables are supported by this plugin:
|
|
|
102
106
|
|
|
103
107
|
You can set `vsce` options in the `package.json`, like:
|
|
104
108
|
|
|
105
|
-
```
|
|
106
|
-
// package.json
|
|
109
|
+
```json
|
|
107
110
|
{
|
|
108
111
|
"vsce": {
|
|
109
112
|
"baseImagesUrl": "https://my.custom/base/images/url",
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
const path = require('path');
|
|
3
4
|
const verifyVsce = require('./lib/verify');
|
|
4
5
|
const vscePublish = require('./lib/publish');
|
|
5
6
|
const vscePrepare = require('./lib/prepare');
|
|
@@ -9,6 +10,7 @@ let prepared = false;
|
|
|
9
10
|
let packagePath;
|
|
10
11
|
|
|
11
12
|
async function verifyConditions(pluginConfig, { logger, cwd }) {
|
|
13
|
+
cwd = getPackageRoot(pluginConfig, cwd);
|
|
12
14
|
await verifyVsce(pluginConfig, { logger, cwd });
|
|
13
15
|
verified = true;
|
|
14
16
|
}
|
|
@@ -17,6 +19,7 @@ async function prepare(
|
|
|
17
19
|
pluginConfig,
|
|
18
20
|
{ nextRelease: { version }, logger, cwd },
|
|
19
21
|
) {
|
|
22
|
+
cwd = getPackageRoot(pluginConfig, cwd);
|
|
20
23
|
if (!verified) {
|
|
21
24
|
await verifyVsce(pluginConfig, { logger, cwd });
|
|
22
25
|
verified = true;
|
|
@@ -34,6 +37,7 @@ async function publish(
|
|
|
34
37
|
pluginConfig,
|
|
35
38
|
{ nextRelease: { version }, logger, cwd },
|
|
36
39
|
) {
|
|
40
|
+
cwd = getPackageRoot(pluginConfig, cwd);
|
|
37
41
|
if (!verified) {
|
|
38
42
|
await verifyVsce(pluginConfig, { logger, cwd });
|
|
39
43
|
verified = true;
|
|
@@ -63,6 +67,12 @@ async function publish(
|
|
|
63
67
|
return vscePublish(version, packagePath, logger, cwd);
|
|
64
68
|
}
|
|
65
69
|
|
|
70
|
+
function getPackageRoot(pluginConfig, cwd) {
|
|
71
|
+
return pluginConfig.packageRoot
|
|
72
|
+
? path.join(cwd, pluginConfig.packageRoot)
|
|
73
|
+
: cwd;
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
module.exports = {
|
|
67
77
|
verifyConditions,
|
|
68
78
|
prepare,
|
package/lib/prepare.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const execa = require('execa');
|
|
4
4
|
const { readJson } = require('fs-extra');
|
|
5
|
+
const path = require('path');
|
|
5
6
|
const { isOvsxPublishEnabled, isTargetEnabled } = require('./utils');
|
|
6
7
|
|
|
7
8
|
module.exports = async (version, packageVsix, logger, cwd) => {
|
|
@@ -23,7 +24,7 @@ module.exports = async (version, packageVsix, logger, cwd) => {
|
|
|
23
24
|
if (typeof packageVsix === 'string') {
|
|
24
25
|
packagePath = packageVsix;
|
|
25
26
|
} else {
|
|
26
|
-
const { name } = await readJson('./package.json');
|
|
27
|
+
const { name } = await readJson(path.join(cwd, './package.json'));
|
|
27
28
|
if (isTargetEnabled()) {
|
|
28
29
|
packagePath = `${name}-${process.env.VSCE_TARGET}-${version}.vsix`;
|
|
29
30
|
} else {
|
package/lib/publish.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const execa = require('execa');
|
|
4
4
|
const { readJson } = require('fs-extra');
|
|
5
|
+
const path = require('path');
|
|
5
6
|
const {
|
|
6
7
|
isOvsxPublishEnabled,
|
|
7
8
|
isTargetEnabled,
|
|
@@ -9,7 +10,7 @@ const {
|
|
|
9
10
|
} = require('./utils');
|
|
10
11
|
|
|
11
12
|
module.exports = async (version, packagePath, logger, cwd) => {
|
|
12
|
-
const { publisher, name } = await readJson('./package.json');
|
|
13
|
+
const { publisher, name } = await readJson(path.join(cwd, './package.json'));
|
|
13
14
|
|
|
14
15
|
const options = ['publish'];
|
|
15
16
|
|
package/lib/verify-pkg.js
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
const SemanticReleaseError = require('@semantic-release/error');
|
|
4
4
|
const { readJson } = require('fs-extra');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
6
7
|
|
|
7
|
-
module.exports = async () => {
|
|
8
|
-
|
|
8
|
+
module.exports = async (cwd) => {
|
|
9
|
+
const packagePath = path.join(cwd, './package.json');
|
|
10
|
+
|
|
11
|
+
if (!fs.existsSync(packagePath)) {
|
|
9
12
|
throw new SemanticReleaseError(
|
|
10
|
-
|
|
13
|
+
`${packagePath} was not found. A \`package.json\` is required to release with vsce.`,
|
|
11
14
|
'ENOPKG',
|
|
12
15
|
);
|
|
13
16
|
}
|
|
@@ -15,7 +18,7 @@ module.exports = async () => {
|
|
|
15
18
|
let packageJson;
|
|
16
19
|
|
|
17
20
|
try {
|
|
18
|
-
packageJson = await readJson(
|
|
21
|
+
packageJson = await readJson(packagePath);
|
|
19
22
|
} catch {
|
|
20
23
|
throw new SemanticReleaseError(
|
|
21
24
|
'The `package.json` seems to be invalid.',
|
package/lib/verify.js
CHANGED
|
@@ -8,7 +8,7 @@ const verifyTarget = require('./verify-target');
|
|
|
8
8
|
const { isOvsxPublishEnabled, isVscePublishEnabled } = require('./utils');
|
|
9
9
|
|
|
10
10
|
module.exports = async (pluginConfig, { logger, cwd }) => {
|
|
11
|
-
await verifyPkg();
|
|
11
|
+
await verifyPkg(cwd);
|
|
12
12
|
await verifyTarget();
|
|
13
13
|
|
|
14
14
|
if (pluginConfig?.publish !== false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release-vsce",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "semantic-release plugin to package and publish VS Code extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"release": "semantic-release",
|
|
26
26
|
"test": "nyc ava",
|
|
27
27
|
"posttest": "npm run lint && installed-check --engine-no-dev",
|
|
28
|
-
"prepare": "husky
|
|
28
|
+
"prepare": "husky"
|
|
29
29
|
},
|
|
30
30
|
"ava": {
|
|
31
31
|
"files": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
45
|
"volta": {
|
|
46
|
-
"node": "
|
|
47
|
-
"npm": "
|
|
46
|
+
"node": "20.11.1",
|
|
47
|
+
"npm": "10.5.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@semantic-release/error": "^3.0.0",
|
|
@@ -58,22 +58,22 @@
|
|
|
58
58
|
"semantic-release": ">=18"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"ava": "^
|
|
62
|
-
"conventional-changelog-conventionalcommits": "^
|
|
61
|
+
"ava": "^6.1.2",
|
|
62
|
+
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
63
63
|
"eslint": "^8.7.0",
|
|
64
64
|
"eslint-config-prettier": "^9.0.0",
|
|
65
65
|
"eslint-config-standard": "^17.0.0",
|
|
66
66
|
"eslint-plugin-import": "^2.20.1",
|
|
67
|
-
"eslint-plugin-n": "^16.
|
|
67
|
+
"eslint-plugin-n": "^16.6.2",
|
|
68
68
|
"eslint-plugin-promise": "^6.0.0",
|
|
69
|
-
"husky": "^
|
|
69
|
+
"husky": "^9.0.11",
|
|
70
70
|
"installed-check": "^8.0.0",
|
|
71
|
-
"lint-staged": "^
|
|
71
|
+
"lint-staged": "^15.0.1",
|
|
72
72
|
"nyc": "^15.1.0",
|
|
73
|
-
"prettier": "3.
|
|
73
|
+
"prettier": "^3.2.5",
|
|
74
74
|
"proxyquire": "^2.1.3",
|
|
75
|
-
"semantic-release": "^
|
|
76
|
-
"sinon": "^
|
|
75
|
+
"semantic-release": "^23.0.2",
|
|
76
|
+
"sinon": "^17.0.1"
|
|
77
77
|
},
|
|
78
78
|
"lint-staged": {
|
|
79
79
|
"**/*": "prettier --write --ignore-unknown"
|
package/test/index.test.js
CHANGED
|
@@ -229,3 +229,33 @@ test('expand globs if publishPackagePath is set', async (t) => {
|
|
|
229
229
|
semanticReleasePayload.cwd,
|
|
230
230
|
]);
|
|
231
231
|
});
|
|
232
|
+
|
|
233
|
+
test('publishes an extension in a non-root folder', async (t) => {
|
|
234
|
+
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
235
|
+
const { publish } = proxyquire('../index.js', {
|
|
236
|
+
'./lib/verify': verifyVsceStub,
|
|
237
|
+
'./lib/publish': vscePublishStub,
|
|
238
|
+
'./lib/prepare': vscePrepareStub,
|
|
239
|
+
glob: {
|
|
240
|
+
glob: {
|
|
241
|
+
sync: sinon.stub().returns(['package1.vsix', 'package2.vsix']),
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
const pluginConfig = {
|
|
247
|
+
packageRoot: './vscode-extension',
|
|
248
|
+
};
|
|
249
|
+
const resolvedCwd = `${semanticReleasePayload.cwd}/vscode-extension`;
|
|
250
|
+
|
|
251
|
+
await publish(pluginConfig, semanticReleasePayload);
|
|
252
|
+
|
|
253
|
+
t.true(verifyVsceStub.calledOnce);
|
|
254
|
+
t.true(vscePrepareStub.calledOnce);
|
|
255
|
+
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
256
|
+
semanticReleasePayload.nextRelease.version,
|
|
257
|
+
undefined,
|
|
258
|
+
semanticReleasePayload.logger,
|
|
259
|
+
resolvedCwd,
|
|
260
|
+
]);
|
|
261
|
+
});
|
package/test/verify-pkg.test.js
CHANGED
|
@@ -3,6 +3,8 @@ const test = require('ava');
|
|
|
3
3
|
const proxyquire = require('proxyquire');
|
|
4
4
|
const SemanticReleaseError = require('@semantic-release/error');
|
|
5
5
|
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
|
|
6
8
|
test('package.json is found', async (t) => {
|
|
7
9
|
const name = 'test';
|
|
8
10
|
const publisher = 'tester';
|
|
@@ -19,7 +21,7 @@ test('package.json is found', async (t) => {
|
|
|
19
21
|
},
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
await t.notThrowsAsync(() => verifyPkg());
|
|
24
|
+
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
test('package.json is not found', async (t) => {
|
|
@@ -38,7 +40,7 @@ test('package.json is not found', async (t) => {
|
|
|
38
40
|
},
|
|
39
41
|
});
|
|
40
42
|
|
|
41
|
-
await t.throwsAsync(() => verifyPkg(), {
|
|
43
|
+
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
42
44
|
instanceOf: SemanticReleaseError,
|
|
43
45
|
code: 'ENOPKG',
|
|
44
46
|
});
|
|
@@ -59,7 +61,7 @@ test('package is valid', async (t) => {
|
|
|
59
61
|
},
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
await t.notThrowsAsync(() => verifyPkg());
|
|
64
|
+
await t.notThrowsAsync(() => verifyPkg(cwd));
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
test('package is invalid', async (t) => {
|
|
@@ -72,7 +74,7 @@ test('package is invalid', async (t) => {
|
|
|
72
74
|
},
|
|
73
75
|
});
|
|
74
76
|
|
|
75
|
-
await t.throwsAsync(() => verifyPkg(), {
|
|
77
|
+
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
76
78
|
instanceOf: SemanticReleaseError,
|
|
77
79
|
code: 'EINVALIDPKG',
|
|
78
80
|
});
|
|
@@ -91,7 +93,7 @@ test('package is missing name', async (t) => {
|
|
|
91
93
|
},
|
|
92
94
|
});
|
|
93
95
|
|
|
94
|
-
await t.throwsAsync(() => verifyPkg(), {
|
|
96
|
+
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
95
97
|
instanceOf: SemanticReleaseError,
|
|
96
98
|
code: 'ENOPKGNAME',
|
|
97
99
|
});
|
|
@@ -110,7 +112,7 @@ test('package is missing publisher', async (t) => {
|
|
|
110
112
|
},
|
|
111
113
|
});
|
|
112
114
|
|
|
113
|
-
await t.throwsAsync(() => verifyPkg(), {
|
|
115
|
+
await t.throwsAsync(() => verifyPkg(cwd), {
|
|
114
116
|
instanceOf: SemanticReleaseError,
|
|
115
117
|
code: 'ENOPUBLISHER',
|
|
116
118
|
});
|