semantic-release-vsce 5.4.0 → 5.5.1
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 +33 -28
- package/lib/prepare.js +1 -1
- package/lib/utils.js +3 -1
- package/lib/verify-target.js +11 -9
- package/package.json +3 -3
- package/test/prepare.test.js +30 -0
- package/test/verify-target.test.js +10 -0
package/README.md
CHANGED
|
@@ -90,11 +90,11 @@ Which `.vsix` file (or files) to publish. This controls what value will be used
|
|
|
90
90
|
|
|
91
91
|
### Environment variables
|
|
92
92
|
|
|
93
|
-
| Variable | Description
|
|
94
|
-
| ------------- |
|
|
95
|
-
| `VSCE_PAT` | **Required** (unless `publish` is set to `false`). The personal access token to publish the extension to Visual Studio Marketplace
|
|
96
|
-
| `VSCE_TARGET` | _Optional_. The target to use when packaging or publishing the extension (used as `vsce package --target ${VSCE_TARGET}`). See [the platform-specific example](#platform-specific-on-github-actions)
|
|
97
|
-
| `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX
|
|
93
|
+
| Variable | Description |
|
|
94
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `VSCE_PAT` | **Required** (unless `publish` is set to `false`). The personal access token to publish the extension to Visual Studio Marketplace |
|
|
96
|
+
| `VSCE_TARGET` | _Optional_. The target to use when packaging or publishing the extension (used as `vsce package --target ${VSCE_TARGET}`). When set to `universal`, behave as if `VSCE_TARGET` was not set (i.e. build the universal/generic `vsix`). See [the platform-specific example](#platform-specific-on-github-actions) |
|
|
97
|
+
| `OVSX_PAT` | _Optional_. The personal access token to push to OpenVSX |
|
|
98
98
|
|
|
99
99
|
### Publishing to OpenVSX
|
|
100
100
|
|
|
@@ -209,63 +209,64 @@ jobs:
|
|
|
209
209
|
matrix:
|
|
210
210
|
include:
|
|
211
211
|
- os: windows-latest
|
|
212
|
-
|
|
213
|
-
arch: x64
|
|
212
|
+
target: win32-x64
|
|
214
213
|
npm_config_arch: x64
|
|
215
214
|
- os: windows-latest
|
|
216
|
-
|
|
217
|
-
arch: ia32
|
|
215
|
+
target: win32-ia32
|
|
218
216
|
npm_config_arch: ia32
|
|
219
217
|
- os: windows-latest
|
|
220
|
-
|
|
221
|
-
arch: arm64
|
|
218
|
+
target: win32-arm64
|
|
222
219
|
npm_config_arch: arm
|
|
223
220
|
- os: ubuntu-latest
|
|
224
|
-
|
|
225
|
-
arch: x64
|
|
221
|
+
target: linux-x64
|
|
226
222
|
npm_config_arch: x64
|
|
227
223
|
- os: ubuntu-latest
|
|
228
|
-
|
|
229
|
-
arch: arm64
|
|
224
|
+
target: linux-arm64
|
|
230
225
|
npm_config_arch: arm64
|
|
231
226
|
- os: ubuntu-latest
|
|
232
|
-
|
|
233
|
-
arch: armhf
|
|
227
|
+
target: linux-armhf
|
|
234
228
|
npm_config_arch: arm
|
|
235
229
|
- os: ubuntu-latest
|
|
236
|
-
|
|
237
|
-
arch: x64
|
|
230
|
+
target: alpine-x64
|
|
238
231
|
npm_config_arch: x64
|
|
239
232
|
- os: macos-latest
|
|
240
|
-
|
|
241
|
-
arch: x64
|
|
233
|
+
target: darwin-x64
|
|
242
234
|
npm_config_arch: x64
|
|
243
235
|
- os: macos-latest
|
|
244
|
-
|
|
245
|
-
arch: arm64
|
|
236
|
+
target: darwin-arm64
|
|
246
237
|
npm_config_arch: arm64
|
|
238
|
+
- os: ubuntu-latest
|
|
239
|
+
target: universal
|
|
247
240
|
runs-on: ${{ matrix.os }}
|
|
248
241
|
steps:
|
|
249
242
|
- uses: actions/checkout@v3
|
|
243
|
+
|
|
250
244
|
- uses: actions/setup-node@v3
|
|
251
245
|
with:
|
|
252
246
|
node-version: 16
|
|
253
|
-
|
|
247
|
+
|
|
248
|
+
- if: matrix.target != 'universal'
|
|
249
|
+
name: Install dependencies (with binaries)
|
|
250
|
+
run: npm ci
|
|
254
251
|
env:
|
|
255
252
|
npm_config_arch: ${{ matrix.npm_config_arch }}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
|
|
254
|
+
- if: matrix.target == 'universal'
|
|
255
|
+
name: Install dependencies (without binaries)
|
|
256
|
+
run: npm ci
|
|
257
|
+
|
|
259
258
|
- run: npx semantic-release --extends ./package.release.config.js
|
|
260
259
|
env:
|
|
260
|
+
VSCE_TARGET: ${{ matrix.target }}
|
|
261
261
|
# All tokens are required since semantic-release needs to validate them
|
|
262
262
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
263
263
|
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
264
264
|
# In case you want to publish to OpenVSX
|
|
265
265
|
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
|
266
|
+
|
|
266
267
|
- uses: actions/upload-artifact@v3
|
|
267
268
|
with:
|
|
268
|
-
name: ${{
|
|
269
|
+
name: ${{ matrix.target }}
|
|
269
270
|
path: '*.vsix'
|
|
270
271
|
|
|
271
272
|
release:
|
|
@@ -273,11 +274,15 @@ jobs:
|
|
|
273
274
|
needs: build
|
|
274
275
|
steps:
|
|
275
276
|
- uses: actions/checkout@v3
|
|
277
|
+
|
|
276
278
|
- uses: actions/setup-node@v3
|
|
277
279
|
with:
|
|
278
280
|
node-version: 16
|
|
281
|
+
|
|
279
282
|
- run: npm ci
|
|
283
|
+
|
|
280
284
|
- uses: actions/download-artifact@v3
|
|
285
|
+
|
|
281
286
|
- run: npx semantic-release --extends ./publish.release.config.js
|
|
282
287
|
env:
|
|
283
288
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/lib/prepare.js
CHANGED
package/lib/utils.js
CHANGED
package/lib/verify-target.js
CHANGED
|
@@ -15,15 +15,17 @@ module.exports = async () => {
|
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
if (process.env.VSCE_TARGET !== 'universal') {
|
|
19
|
+
const targets = require('@vscode/vsce/out/package').Targets;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
// Throw if the target is not supported
|
|
22
|
+
if (!targets.has(process.env.VSCE_TARGET)) {
|
|
23
|
+
throw new SemanticReleaseError(
|
|
24
|
+
`Unsupported vsce target: ${
|
|
25
|
+
process.env.VSCE_TARGET
|
|
26
|
+
}. Available targets: ${Object.values(targets).join(', ')}`,
|
|
27
|
+
'EUNSUPPORTEDVSCETARGET'
|
|
28
|
+
);
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release-vsce",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.1",
|
|
4
4
|
"description": "semantic-release plugin to package and publish VS Code extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"execa": "^5.0.0",
|
|
53
53
|
"fs-extra": "^11.1.0",
|
|
54
54
|
"glob": "^8.0.3",
|
|
55
|
-
"ovsx": "^0.
|
|
55
|
+
"ovsx": "^0.7.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"semantic-release": ">=18"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"husky": "^8.0.2",
|
|
70
70
|
"lint-staged": "^13.0.3",
|
|
71
71
|
"nyc": "^15.1.0",
|
|
72
|
-
"prettier": "2.8.
|
|
72
|
+
"prettier": "2.8.1",
|
|
73
73
|
"proxyquire": "^2.1.3",
|
|
74
74
|
"semantic-release": "^19.0.2",
|
|
75
75
|
"sinon": "^15.0.0"
|
package/test/prepare.test.js
CHANGED
|
@@ -157,3 +157,33 @@ test('packageVsix when target is set', async (t) => {
|
|
|
157
157
|
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
158
158
|
]);
|
|
159
159
|
});
|
|
160
|
+
|
|
161
|
+
test('packageVsix when target is set to universal', async (t) => {
|
|
162
|
+
const { execaStub } = t.context.stubs;
|
|
163
|
+
const name = 'test';
|
|
164
|
+
|
|
165
|
+
const prepare = proxyquire('../lib/prepare', {
|
|
166
|
+
execa: execaStub,
|
|
167
|
+
'fs-extra': {
|
|
168
|
+
readJson: sinon.stub().returns({
|
|
169
|
+
name,
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const version = '1.0.0';
|
|
175
|
+
const packagePath = `${name}-${version}.vsix`;
|
|
176
|
+
|
|
177
|
+
sinon.stub(process, 'env').value({
|
|
178
|
+
VSCE_TARGET: 'universal',
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const result = await prepare(version, true, logger, cwd);
|
|
182
|
+
|
|
183
|
+
t.deepEqual(result, packagePath);
|
|
184
|
+
t.deepEqual(execaStub.getCall(0).args, [
|
|
185
|
+
'vsce',
|
|
186
|
+
['package', version, '--no-git-tag-version', '--out', packagePath],
|
|
187
|
+
{ stdio: 'inherit', preferLocal: true, cwd },
|
|
188
|
+
]);
|
|
189
|
+
});
|
|
@@ -53,3 +53,13 @@ test('VSCE_TARGET is unsupported', async (t) => {
|
|
|
53
53
|
code: 'EUNSUPPORTEDVSCETARGET',
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
+
|
|
57
|
+
test('VSCE_TARGET is universal', async (t) => {
|
|
58
|
+
sinon.stub(process, 'env').value({
|
|
59
|
+
VSCE_TARGET: 'universal',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const verifyTarget = require('../lib/verify-target');
|
|
63
|
+
|
|
64
|
+
await t.notThrowsAsync(() => verifyTarget());
|
|
65
|
+
});
|