semantic-release-vsce 6.0.0 → 6.0.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.
- package/package.json +5 -2
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -14
- package/.github/workflows/ci.yaml +0 -53
- package/.github/workflows/dependabot-auto-merge.yaml +0 -22
- package/.github/workflows/validate-pr-title.yaml +0 -16
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -3
- package/eslint.config.js +0 -7
- package/index.js +0 -72
- package/release.config.js +0 -74
- package/test/index.test.js +0 -320
- package/test/prepare.test.js +0 -208
- package/test/publish.test.js +0 -367
- package/test/verify-ovsx-auth.test.js +0 -64
- package/test/verify-pkg.test.js +0 -110
- package/test/verify-target.test.js +0 -68
- package/test/verify-vsce-auth.test.js +0 -168
- package/test/verify.test.js +0 -243
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release-vsce",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "semantic-release plugin to package and publish VS Code extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
"vscode",
|
|
21
21
|
"vsce"
|
|
22
22
|
],
|
|
23
|
-
"
|
|
23
|
+
"exports": "./index.js",
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/**/*.js"
|
|
26
|
+
],
|
|
24
27
|
"scripts": {
|
|
25
28
|
"lint": "prettier --check . && eslint . && installed-check --ignore-dev",
|
|
26
29
|
"test": "c8 ava",
|
package/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
github: [felipecrs]
|
package/.github/dependabot.yml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: npm
|
|
4
|
-
directory: /
|
|
5
|
-
schedule:
|
|
6
|
-
interval: daily
|
|
7
|
-
open-pull-requests-limit: 100
|
|
8
|
-
- package-ecosystem: github-actions
|
|
9
|
-
directory: /
|
|
10
|
-
schedule:
|
|
11
|
-
interval: daily
|
|
12
|
-
open-pull-requests-limit: 100
|
|
13
|
-
commit-message:
|
|
14
|
-
prefix: ci
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
name: ci
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
- next
|
|
8
|
-
pull_request:
|
|
9
|
-
branches:
|
|
10
|
-
- master
|
|
11
|
-
- next
|
|
12
|
-
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
test:
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
|
|
20
|
-
strategy:
|
|
21
|
-
matrix:
|
|
22
|
-
node-version:
|
|
23
|
-
- 20
|
|
24
|
-
- 22
|
|
25
|
-
|
|
26
|
-
steps:
|
|
27
|
-
- uses: actions/checkout@v4
|
|
28
|
-
- uses: volta-cli/action@v4
|
|
29
|
-
with:
|
|
30
|
-
node-version: ${{ matrix.node-version }}
|
|
31
|
-
- run: npm ci
|
|
32
|
-
- run: npm test
|
|
33
|
-
|
|
34
|
-
release:
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
|
|
37
|
-
needs: test
|
|
38
|
-
|
|
39
|
-
permissions:
|
|
40
|
-
contents: write # to be able to publish a GitHub release
|
|
41
|
-
issues: write # to be able to comment on released issues
|
|
42
|
-
pull-requests: write # to be able to comment on released pull requests
|
|
43
|
-
id-token: write # to enable use of OIDC for npm provenance
|
|
44
|
-
|
|
45
|
-
steps:
|
|
46
|
-
- uses: actions/checkout@v4
|
|
47
|
-
- uses: volta-cli/action@v4
|
|
48
|
-
- run: npm ci
|
|
49
|
-
- run: npm audit signatures
|
|
50
|
-
- run: npx semantic-release
|
|
51
|
-
env:
|
|
52
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
53
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: dependabot-auto-merge
|
|
2
|
-
on: pull_request
|
|
3
|
-
|
|
4
|
-
permissions:
|
|
5
|
-
contents: write
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
dependabot-auto-merge:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
if: github.actor == 'dependabot[bot]'
|
|
11
|
-
steps:
|
|
12
|
-
- name: Get Dependabot metadata
|
|
13
|
-
id: metadata
|
|
14
|
-
uses: dependabot/fetch-metadata@v2
|
|
15
|
-
with:
|
|
16
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
-
- name: Enable auto-merge for Dependabot PRs
|
|
18
|
-
if: steps.metadata.outputs.dependency-type == 'direct:development' && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch')
|
|
19
|
-
run: gh pr merge --auto --squash "$PR_URL"
|
|
20
|
-
env:
|
|
21
|
-
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
22
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: validate-pr-title
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request_target:
|
|
5
|
-
types:
|
|
6
|
-
- opened
|
|
7
|
-
- edited
|
|
8
|
-
- synchronize
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
validate-pr-title:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: amannn/action-semantic-pull-request@v5
|
|
15
|
-
env:
|
|
16
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/.husky/pre-commit
DELETED
package/.prettierrc
DELETED
package/eslint.config.js
DELETED
package/index.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { prepare as vscePrepare } from './lib/prepare.js';
|
|
5
|
-
import { publish as vscePublish } from './lib/publish.js';
|
|
6
|
-
import { verify as vsceVerify } from './lib/verify.js';
|
|
7
|
-
|
|
8
|
-
let verified = false;
|
|
9
|
-
let prepared = false;
|
|
10
|
-
let packagePath;
|
|
11
|
-
|
|
12
|
-
export async function verifyConditions(pluginConfig, { logger, cwd }) {
|
|
13
|
-
cwd = getPackageRoot(pluginConfig, cwd);
|
|
14
|
-
await vsceVerify(pluginConfig, { logger, cwd });
|
|
15
|
-
verified = true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function prepare(
|
|
19
|
-
pluginConfig,
|
|
20
|
-
{ nextRelease: { version }, logger, cwd },
|
|
21
|
-
) {
|
|
22
|
-
cwd = getPackageRoot(pluginConfig, cwd);
|
|
23
|
-
if (!verified) {
|
|
24
|
-
await vsceVerify(pluginConfig, { logger, cwd });
|
|
25
|
-
verified = true;
|
|
26
|
-
}
|
|
27
|
-
packagePath = await vscePrepare(
|
|
28
|
-
version,
|
|
29
|
-
pluginConfig.packageVsix,
|
|
30
|
-
logger,
|
|
31
|
-
cwd,
|
|
32
|
-
);
|
|
33
|
-
prepared = true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function publish(
|
|
37
|
-
pluginConfig,
|
|
38
|
-
{ nextRelease: { version }, logger, cwd },
|
|
39
|
-
) {
|
|
40
|
-
cwd = getPackageRoot(pluginConfig, cwd);
|
|
41
|
-
if (!verified) {
|
|
42
|
-
await vsceVerify(pluginConfig, { logger, cwd });
|
|
43
|
-
verified = true;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!prepared) {
|
|
47
|
-
// BC: prior to semantic-release v15 prepare was part of publish
|
|
48
|
-
packagePath = await vscePrepare(
|
|
49
|
-
version,
|
|
50
|
-
pluginConfig.packageVsix,
|
|
51
|
-
logger,
|
|
52
|
-
cwd,
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// If publishing is disabled, return early.
|
|
57
|
-
if (pluginConfig?.publish === false) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (pluginConfig?.publishPackagePath) {
|
|
62
|
-
// Expand glob
|
|
63
|
-
const glob = (await import('glob')).glob;
|
|
64
|
-
packagePath = await glob(pluginConfig.publishPackagePath, { cwd });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return vscePublish(version, packagePath, logger, cwd);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function getPackageRoot(pluginConfig, cwd) {
|
|
71
|
-
return pluginConfig.packageRoot ? join(cwd, pluginConfig.packageRoot) : cwd;
|
|
72
|
-
}
|
package/release.config.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import('semantic-release').GlobalConfig}
|
|
3
|
-
*/
|
|
4
|
-
export default {
|
|
5
|
-
plugins: [
|
|
6
|
-
[
|
|
7
|
-
'@semantic-release/commit-analyzer',
|
|
8
|
-
{
|
|
9
|
-
releaseRules: [
|
|
10
|
-
{
|
|
11
|
-
type: 'perf',
|
|
12
|
-
release: 'patch',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: 'refactor',
|
|
16
|
-
release: 'patch',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
type: 'build',
|
|
20
|
-
scope: 'deps',
|
|
21
|
-
release: 'patch',
|
|
22
|
-
},
|
|
23
|
-
// https://github.com/semantic-release/commit-analyzer/issues/413#issuecomment-1465299187
|
|
24
|
-
{
|
|
25
|
-
breaking: true,
|
|
26
|
-
release: 'major',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
[
|
|
32
|
-
'@semantic-release/release-notes-generator',
|
|
33
|
-
{
|
|
34
|
-
presetConfig: {
|
|
35
|
-
types: [
|
|
36
|
-
{
|
|
37
|
-
type: 'feat',
|
|
38
|
-
section: 'Features',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'fix',
|
|
42
|
-
section: 'Bug Fixes',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: 'perf',
|
|
46
|
-
section: 'Performance Improvements',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'revert',
|
|
50
|
-
section: 'Reverts',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: 'refactor',
|
|
54
|
-
section: 'Code Refactoring',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'build',
|
|
58
|
-
scope: 'deps',
|
|
59
|
-
section: 'Dependencies',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
'@semantic-release/npm',
|
|
66
|
-
[
|
|
67
|
-
'@semantic-release/github',
|
|
68
|
-
{
|
|
69
|
-
addReleases: 'bottom',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
],
|
|
73
|
-
preset: 'conventionalcommits',
|
|
74
|
-
};
|
package/test/index.test.js
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import avaTest from 'ava';
|
|
2
|
-
import esmock from 'esmock';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { fake, stub } from 'sinon';
|
|
5
|
-
|
|
6
|
-
// Run tests serially to avoid env pollution
|
|
7
|
-
const test = avaTest.serial;
|
|
8
|
-
|
|
9
|
-
const semanticReleasePayload = {
|
|
10
|
-
nextRelease: {
|
|
11
|
-
version: '1.0.0',
|
|
12
|
-
},
|
|
13
|
-
logger: {
|
|
14
|
-
log: fake(),
|
|
15
|
-
},
|
|
16
|
-
cwd: process.cwd(),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const pluginConfig = {
|
|
20
|
-
packageVsix: 'test.vsix',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
test.beforeEach((t) => {
|
|
24
|
-
t.context.stubs = {
|
|
25
|
-
verifyVsceStub: stub().resolves(),
|
|
26
|
-
vscePublishStub: stub().resolves(),
|
|
27
|
-
vscePrepareStub: stub().resolves(),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test.afterEach((t) => {
|
|
32
|
-
Object.keys(t.context.stubs).forEach((key) => {
|
|
33
|
-
t.context.stubs[key].resetHistory();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('verifyConditions', async (t) => {
|
|
38
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
39
|
-
const { verifyConditions } = await esmock('../index.js', {
|
|
40
|
-
'../lib/verify.js': {
|
|
41
|
-
verify: verifyVsceStub,
|
|
42
|
-
},
|
|
43
|
-
'../lib/prepare.js': {
|
|
44
|
-
prepare: vscePrepareStub,
|
|
45
|
-
},
|
|
46
|
-
'../lib/publish.js': {
|
|
47
|
-
publish: vscePublishStub,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
await verifyConditions(pluginConfig, semanticReleasePayload);
|
|
52
|
-
|
|
53
|
-
t.true(
|
|
54
|
-
verifyVsceStub.calledOnceWith(pluginConfig, {
|
|
55
|
-
logger: semanticReleasePayload.logger,
|
|
56
|
-
cwd: semanticReleasePayload.cwd,
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('prepare and unverified', async (t) => {
|
|
62
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
63
|
-
const { prepare } = await esmock('../index.js', {
|
|
64
|
-
'../lib/verify.js': {
|
|
65
|
-
verify: verifyVsceStub,
|
|
66
|
-
},
|
|
67
|
-
'../lib/prepare.js': {
|
|
68
|
-
prepare: vscePrepareStub,
|
|
69
|
-
},
|
|
70
|
-
'../lib/publish.js': {
|
|
71
|
-
publish: vscePublishStub,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
await prepare(pluginConfig, semanticReleasePayload);
|
|
76
|
-
|
|
77
|
-
t.true(
|
|
78
|
-
verifyVsceStub.calledOnceWith(pluginConfig, {
|
|
79
|
-
logger: semanticReleasePayload.logger,
|
|
80
|
-
cwd: semanticReleasePayload.cwd,
|
|
81
|
-
}),
|
|
82
|
-
);
|
|
83
|
-
t.deepEqual(vscePrepareStub.getCall(0).args, [
|
|
84
|
-
semanticReleasePayload.nextRelease.version,
|
|
85
|
-
pluginConfig.packageVsix,
|
|
86
|
-
semanticReleasePayload.logger,
|
|
87
|
-
semanticReleasePayload.cwd,
|
|
88
|
-
]);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('prepare and verified', async (t) => {
|
|
92
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
93
|
-
const { prepare, verifyConditions } = await esmock('../index.js', {
|
|
94
|
-
'../lib/verify.js': {
|
|
95
|
-
verify: verifyVsceStub,
|
|
96
|
-
},
|
|
97
|
-
'../lib/prepare.js': {
|
|
98
|
-
prepare: vscePrepareStub,
|
|
99
|
-
},
|
|
100
|
-
'../lib/publish.js': {
|
|
101
|
-
publish: vscePublishStub,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
await verifyConditions(pluginConfig, semanticReleasePayload);
|
|
106
|
-
await prepare(pluginConfig, semanticReleasePayload);
|
|
107
|
-
|
|
108
|
-
t.true(verifyVsceStub.calledOnce);
|
|
109
|
-
t.deepEqual(vscePrepareStub.getCall(0).args, [
|
|
110
|
-
semanticReleasePayload.nextRelease.version,
|
|
111
|
-
pluginConfig.packageVsix,
|
|
112
|
-
semanticReleasePayload.logger,
|
|
113
|
-
semanticReleasePayload.cwd,
|
|
114
|
-
]);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test('publish that is unverified and unprepared', async (t) => {
|
|
118
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
119
|
-
const { publish } = await esmock('../index.js', {
|
|
120
|
-
'../lib/verify.js': {
|
|
121
|
-
verify: verifyVsceStub,
|
|
122
|
-
},
|
|
123
|
-
'../lib/prepare.js': {
|
|
124
|
-
prepare: vscePrepareStub,
|
|
125
|
-
},
|
|
126
|
-
'../lib/publish.js': {
|
|
127
|
-
publish: vscePublishStub,
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
await publish(pluginConfig, semanticReleasePayload);
|
|
132
|
-
|
|
133
|
-
t.true(verifyVsceStub.calledOnce);
|
|
134
|
-
t.true(vscePrepareStub.calledOnce);
|
|
135
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
136
|
-
semanticReleasePayload.nextRelease.version,
|
|
137
|
-
undefined,
|
|
138
|
-
semanticReleasePayload.logger,
|
|
139
|
-
semanticReleasePayload.cwd,
|
|
140
|
-
]);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('publish that is verified but unprepared', async (t) => {
|
|
144
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
145
|
-
const { publish, verifyConditions } = await esmock('../index.js', {
|
|
146
|
-
'../lib/verify.js': {
|
|
147
|
-
verify: verifyVsceStub,
|
|
148
|
-
},
|
|
149
|
-
'../lib/prepare.js': {
|
|
150
|
-
prepare: vscePrepareStub,
|
|
151
|
-
},
|
|
152
|
-
'../lib/publish.js': {
|
|
153
|
-
publish: vscePublishStub,
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
await verifyConditions(pluginConfig, semanticReleasePayload);
|
|
158
|
-
await publish(pluginConfig, semanticReleasePayload);
|
|
159
|
-
|
|
160
|
-
t.true(verifyVsceStub.calledOnce);
|
|
161
|
-
t.true(vscePrepareStub.calledOnce);
|
|
162
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
163
|
-
semanticReleasePayload.nextRelease.version,
|
|
164
|
-
undefined,
|
|
165
|
-
semanticReleasePayload.logger,
|
|
166
|
-
semanticReleasePayload.cwd,
|
|
167
|
-
]);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
test('publish that is already verified & prepared', async (t) => {
|
|
171
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
172
|
-
const { prepare, publish, verifyConditions } = await esmock('../index.js', {
|
|
173
|
-
'../lib/verify.js': {
|
|
174
|
-
verify: verifyVsceStub,
|
|
175
|
-
},
|
|
176
|
-
'../lib/prepare.js': {
|
|
177
|
-
prepare: vscePrepareStub,
|
|
178
|
-
},
|
|
179
|
-
'../lib/publish.js': {
|
|
180
|
-
publish: vscePublishStub,
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
await verifyConditions(pluginConfig, semanticReleasePayload);
|
|
185
|
-
const packagePath = await prepare(pluginConfig, semanticReleasePayload);
|
|
186
|
-
await publish(pluginConfig, semanticReleasePayload);
|
|
187
|
-
|
|
188
|
-
t.true(verifyVsceStub.calledOnce);
|
|
189
|
-
t.true(vscePrepareStub.calledOnce);
|
|
190
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
191
|
-
semanticReleasePayload.nextRelease.version,
|
|
192
|
-
packagePath,
|
|
193
|
-
semanticReleasePayload.logger,
|
|
194
|
-
semanticReleasePayload.cwd,
|
|
195
|
-
]);
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
test('it does not publish the package if publishing is disabled', async (t) => {
|
|
199
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
200
|
-
const { prepare, publish, verifyConditions } = await esmock('../index.js', {
|
|
201
|
-
'../lib/verify.js': {
|
|
202
|
-
verify: verifyVsceStub,
|
|
203
|
-
},
|
|
204
|
-
'../lib/prepare.js': {
|
|
205
|
-
prepare: vscePrepareStub,
|
|
206
|
-
},
|
|
207
|
-
'../lib/publish.js': {
|
|
208
|
-
publish: vscePublishStub,
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
await verifyConditions(
|
|
213
|
-
{ ...pluginConfig, publish: false },
|
|
214
|
-
semanticReleasePayload,
|
|
215
|
-
);
|
|
216
|
-
await prepare({ ...pluginConfig, publish: false }, semanticReleasePayload);
|
|
217
|
-
await publish({ ...pluginConfig, publish: false }, semanticReleasePayload);
|
|
218
|
-
|
|
219
|
-
t.true(vscePublishStub.notCalled);
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
test('it can publish when `OVSX_PAT` is present but `VSCE_PAT` is missing', async (t) => {
|
|
223
|
-
const token = 'abc123';
|
|
224
|
-
stub(process, 'env').value({
|
|
225
|
-
OVSX_PAT: token,
|
|
226
|
-
});
|
|
227
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
228
|
-
const { prepare, publish, verifyConditions } = await esmock('../index.js', {
|
|
229
|
-
'../lib/verify.js': {
|
|
230
|
-
verify: verifyVsceStub,
|
|
231
|
-
},
|
|
232
|
-
'../lib/prepare.js': {
|
|
233
|
-
prepare: vscePrepareStub,
|
|
234
|
-
},
|
|
235
|
-
'../lib/publish.js': {
|
|
236
|
-
publish: vscePublishStub,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
await verifyConditions({ ...pluginConfig }, semanticReleasePayload);
|
|
241
|
-
await prepare({ ...pluginConfig }, semanticReleasePayload);
|
|
242
|
-
await publish({ ...pluginConfig }, semanticReleasePayload);
|
|
243
|
-
|
|
244
|
-
t.true(verifyVsceStub.calledOnce);
|
|
245
|
-
t.true(vscePrepareStub.calledOnce);
|
|
246
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
247
|
-
semanticReleasePayload.nextRelease.version,
|
|
248
|
-
undefined,
|
|
249
|
-
semanticReleasePayload.logger,
|
|
250
|
-
semanticReleasePayload.cwd,
|
|
251
|
-
]);
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
test('expand globs if publishPackagePath is set', async (t) => {
|
|
255
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
256
|
-
const { publish } = await esmock.p('../index.js', {
|
|
257
|
-
'../lib/verify.js': {
|
|
258
|
-
verify: verifyVsceStub,
|
|
259
|
-
},
|
|
260
|
-
'../lib/prepare.js': {
|
|
261
|
-
prepare: vscePrepareStub,
|
|
262
|
-
},
|
|
263
|
-
'../lib/publish.js': {
|
|
264
|
-
publish: vscePublishStub,
|
|
265
|
-
},
|
|
266
|
-
glob: {
|
|
267
|
-
glob: stub().resolves(['package1.vsix', 'package2.vsix']),
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
const pluginConfig = {
|
|
272
|
-
publishPackagePath: 'package*.vsix',
|
|
273
|
-
packageVsix: false,
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
await publish(pluginConfig, semanticReleasePayload);
|
|
277
|
-
|
|
278
|
-
t.true(verifyVsceStub.calledOnce);
|
|
279
|
-
t.true(vscePrepareStub.calledOnce);
|
|
280
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
281
|
-
semanticReleasePayload.nextRelease.version,
|
|
282
|
-
['package1.vsix', 'package2.vsix'],
|
|
283
|
-
semanticReleasePayload.logger,
|
|
284
|
-
semanticReleasePayload.cwd,
|
|
285
|
-
]);
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
test('publishes an extension in a non-root folder', async (t) => {
|
|
289
|
-
const { verifyVsceStub, vscePrepareStub, vscePublishStub } = t.context.stubs;
|
|
290
|
-
const { publish } = await esmock.p('../index.js', {
|
|
291
|
-
'../lib/verify.js': {
|
|
292
|
-
verify: verifyVsceStub,
|
|
293
|
-
},
|
|
294
|
-
'../lib/prepare.js': {
|
|
295
|
-
prepare: vscePrepareStub,
|
|
296
|
-
},
|
|
297
|
-
'../lib/publish.js': {
|
|
298
|
-
publish: vscePublishStub,
|
|
299
|
-
},
|
|
300
|
-
glob: {
|
|
301
|
-
glob: stub().resolves(['package1.vsix', 'package2.vsix']),
|
|
302
|
-
},
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
const pluginConfig = {
|
|
306
|
-
packageRoot: './vscode-extension',
|
|
307
|
-
};
|
|
308
|
-
const resolvedCwd = resolve(`${semanticReleasePayload.cwd}/vscode-extension`);
|
|
309
|
-
|
|
310
|
-
await publish(pluginConfig, semanticReleasePayload);
|
|
311
|
-
|
|
312
|
-
t.true(verifyVsceStub.calledOnce);
|
|
313
|
-
t.true(vscePrepareStub.calledOnce);
|
|
314
|
-
t.deepEqual(vscePublishStub.getCall(0).args, [
|
|
315
|
-
semanticReleasePayload.nextRelease.version,
|
|
316
|
-
undefined,
|
|
317
|
-
semanticReleasePayload.logger,
|
|
318
|
-
resolvedCwd,
|
|
319
|
-
]);
|
|
320
|
-
});
|