semantic-release-vsce 5.0.20 → 5.1.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/README.md +5 -4
- package/index.js +7 -1
- package/lib/verify.js +5 -4
- package/package.json +1 -1
- package/test/index.test.js +15 -0
- package/test/verify.test.js +18 -0
package/README.md
CHANGED
|
@@ -62,13 +62,14 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
|
|
|
62
62
|
| Option | Type | Description |
|
|
63
63
|
| ------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
64
|
| `packageVsix` | `boolean` or `string` | If set to `true`, the plugin will generate a `.vsix` file. If is a string, it will be used as value for `--out` of `vsce package`. |
|
|
65
|
+
| `publish` | `boolean` | The plugin will publish the package unless this option is set to `false`, in which case it will only package the extension `vsix`. |
|
|
65
66
|
|
|
66
67
|
### Environment Variables
|
|
67
68
|
|
|
68
|
-
| Variable | Description
|
|
69
|
-
| ---------- |
|
|
70
|
-
| `VSCE_PAT` | **Required
|
|
71
|
-
| `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX
|
|
69
|
+
| Variable | Description |
|
|
70
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `VSCE_PAT` | _**Required**_ unless `publish` is set to `false`. The personal access token to publish the extension of VS Code Marketplace |
|
|
72
|
+
| `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX |
|
|
72
73
|
|
|
73
74
|
### Publishing to OpenVSX
|
|
74
75
|
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ let prepared = false;
|
|
|
7
7
|
let packagePath;
|
|
8
8
|
|
|
9
9
|
async function verifyConditions (pluginConfig, { logger }) {
|
|
10
|
-
await verifyVsce(logger);
|
|
10
|
+
await verifyVsce(logger, pluginConfig);
|
|
11
11
|
verified = true;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -30,6 +30,12 @@ async function publish (pluginConfig, { nextRelease: { version }, logger }) {
|
|
|
30
30
|
// BC: prior to semantic-release v15 prepare was part of publish
|
|
31
31
|
packagePath = await vscePrepare(version, pluginConfig.packageVsix, logger);
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
// If publishing is disabled, return early.
|
|
35
|
+
if (pluginConfig?.publish === false) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
return vscePublish(version, packagePath, logger);
|
|
34
40
|
}
|
|
35
41
|
|
package/lib/verify.js
CHANGED
|
@@ -2,10 +2,11 @@ const verifyPkg = require('./verify-pkg');
|
|
|
2
2
|
const verifyAuth = require('./verify-auth');
|
|
3
3
|
const verifyOvsxAuth = require('./verify-ovsx-auth');
|
|
4
4
|
|
|
5
|
-
module.exports = async logger => {
|
|
5
|
+
module.exports = async (logger, pluginConfig) => {
|
|
6
6
|
await verifyPkg();
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
if (pluginConfig?.publish !== false) {
|
|
9
|
+
await verifyAuth(logger);
|
|
10
|
+
await verifyOvsxAuth(logger);
|
|
11
|
+
}
|
|
11
12
|
};
|
package/package.json
CHANGED
package/test/index.test.js
CHANGED
|
@@ -139,3 +139,18 @@ test('publish that is already verified & prepared', async t => {
|
|
|
139
139
|
semanticReleasePayload.logger
|
|
140
140
|
]);
|
|
141
141
|
});
|
|
142
|
+
|
|
143
|
+
test('it does not publish the package if publishing is disabled', async t => {
|
|
144
|
+
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
145
|
+
const { prepare, publish, verifyConditions } = proxyquire('../index.js', {
|
|
146
|
+
'./lib/verify': verifyVsceStub,
|
|
147
|
+
'./lib/publish': vscePublishStub,
|
|
148
|
+
'./lib/prepare': vscePrepareStub
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
await verifyConditions({ ...pluginConfig, publish: false }, semanticReleasePayload);
|
|
152
|
+
await prepare({ ...pluginConfig, publish: false }, semanticReleasePayload);
|
|
153
|
+
await publish({ ...pluginConfig, publish: false }, semanticReleasePayload);
|
|
154
|
+
|
|
155
|
+
t.true(vscePublishStub.notCalled);
|
|
156
|
+
});
|
package/test/verify.test.js
CHANGED
|
@@ -32,3 +32,21 @@ test('rejects with verify-pkg', async t => {
|
|
|
32
32
|
|
|
33
33
|
await t.throwsAsync(() => verify(logger));
|
|
34
34
|
});
|
|
35
|
+
|
|
36
|
+
test('is does not verify the auth tokens if publishing is disabled', async t => {
|
|
37
|
+
const stubs = {
|
|
38
|
+
verifyPkgStub: sinon.stub().resolves(),
|
|
39
|
+
verifyAuthStub: sinon.stub().resolves(),
|
|
40
|
+
verifyOvsxAuthStub: sinon.stub().resolves()
|
|
41
|
+
};
|
|
42
|
+
const verify = proxyquire('../lib/verify', {
|
|
43
|
+
'./verify-pkg': stubs.verifyPkgStub,
|
|
44
|
+
'./verify-auth': stubs.verifyAuthStub,
|
|
45
|
+
'./verify-ovsx-auth': stubs.verifyOvsxAuthStub
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await verify(logger, { publish: false });
|
|
49
|
+
|
|
50
|
+
t.true(stubs.verifyAuthStub.notCalled);
|
|
51
|
+
t.true(stubs.verifyOvsxAuthStub.notCalled);
|
|
52
|
+
});
|