semantic-release-vsce 6.0.24 → 6.0.25
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/lib/prepare.js +8 -13
- package/lib/publish.js +24 -24
- package/lib/verify-ovsx-auth.js +11 -8
- package/lib/verify-target.js +3 -4
- package/lib/verify-vsce-auth.js +10 -11
- package/lib/verify.js +2 -2
- package/package.json +7 -8
package/lib/prepare.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import { execa } from 'execa';
|
|
4
3
|
import { readJson } from 'fs-extra/esm';
|
|
5
4
|
import path from 'node:path';
|
|
6
5
|
import process from 'node:process';
|
|
7
6
|
import { isOvsxPublishEnabled, isTargetEnabled } from './utilities.js';
|
|
7
|
+
import { createVSIX } from '@vscode/vsce';
|
|
8
8
|
|
|
9
9
|
export async function prepare(version, packageVsix, logger, cwd) {
|
|
10
10
|
if (packageVsix === false) {
|
|
@@ -33,23 +33,18 @@ export async function prepare(version, packageVsix, logger, cwd) {
|
|
|
33
33
|
|
|
34
34
|
logger.log(`Packaging version ${version} to ${packagePath}`);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/** @type {{ -readonly [K in keyof import('@vscode/vsce').IPackageOptions]: import('@vscode/vsce').IPackageOptions[K] }} */
|
|
37
|
+
const options = {
|
|
38
|
+
cwd,
|
|
38
39
|
version,
|
|
39
|
-
'--no-git-tag-version',
|
|
40
|
-
'--out',
|
|
41
40
|
packagePath,
|
|
42
|
-
|
|
41
|
+
};
|
|
42
|
+
|
|
43
43
|
if (isTargetEnabled()) {
|
|
44
|
-
options.
|
|
44
|
+
options.target = process.env.VSCE_TARGET;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
await
|
|
48
|
-
stdio: 'inherit',
|
|
49
|
-
preferLocal: true,
|
|
50
|
-
localDir: import.meta.dirname,
|
|
51
|
-
cwd,
|
|
52
|
-
});
|
|
47
|
+
await createVSIX(options);
|
|
53
48
|
|
|
54
49
|
return packagePath;
|
|
55
50
|
}
|
package/lib/publish.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import { execa } from 'execa';
|
|
4
3
|
import { readJson } from 'fs-extra/esm';
|
|
5
4
|
import path from 'node:path';
|
|
6
5
|
import process from 'node:process';
|
|
@@ -10,11 +9,23 @@ import {
|
|
|
10
9
|
isTargetEnabled,
|
|
11
10
|
isVscePublishEnabled,
|
|
12
11
|
} from './utilities.js';
|
|
12
|
+
import { publish as vscePublish } from '@vscode/vsce';
|
|
13
|
+
import { publish as ovsxPublish } from 'ovsx';
|
|
13
14
|
|
|
14
15
|
export async function publish(version, packagePath, logger, cwd) {
|
|
15
16
|
const { publisher, name } = await readJson(path.join(cwd, './package.json'));
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
/** @type {{ -readonly [K in keyof import('@vscode/vsce').IPublishOptions]: import('@vscode/vsce').IPublishOptions[K] }} */
|
|
19
|
+
const vsceOptions = {
|
|
20
|
+
cwd,
|
|
21
|
+
pat: process.env.VSCE_PAT,
|
|
22
|
+
azureCredential: isAzureCredentialEnabled(),
|
|
23
|
+
};
|
|
24
|
+
/** @type {import('ovsx').PublishOptions} */
|
|
25
|
+
const ovsxOptions = {
|
|
26
|
+
// cwd is not relevant for ovsx as we always provide packagePath
|
|
27
|
+
pat: process.env.OVSX_PAT,
|
|
28
|
+
};
|
|
18
29
|
|
|
19
30
|
let message = `Publishing version ${version}`;
|
|
20
31
|
if (packagePath) {
|
|
@@ -23,32 +34,26 @@ export async function publish(version, packagePath, logger, cwd) {
|
|
|
23
34
|
packagePath = [packagePath];
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
vsceOptions.packagePath = packagePath;
|
|
38
|
+
ovsxOptions.packagePath = packagePath;
|
|
27
39
|
message += ` from ${packagePath.join(', ')}`;
|
|
28
40
|
} else {
|
|
29
|
-
|
|
41
|
+
vsceOptions.version = version;
|
|
42
|
+
vsceOptions.gitTagVersion = false;
|
|
30
43
|
|
|
31
44
|
if (isTargetEnabled()) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
45
|
+
const target = /** @type {string} */ (process.env.VSCE_TARGET);
|
|
46
|
+
vsceOptions.targets = [target];
|
|
47
|
+
ovsxOptions.targets = [target];
|
|
48
|
+
message += ` for target ${target}`;
|
|
35
49
|
}
|
|
36
50
|
}
|
|
37
51
|
|
|
38
|
-
if (isAzureCredentialEnabled()) {
|
|
39
|
-
options.push('--azure-credential');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
52
|
const releases = [];
|
|
43
53
|
if (isVscePublishEnabled()) {
|
|
44
54
|
logger.log(message + ' to Visual Studio Marketplace');
|
|
45
55
|
|
|
46
|
-
await
|
|
47
|
-
stdio: 'inherit',
|
|
48
|
-
preferLocal: true,
|
|
49
|
-
localDir: import.meta.dirname,
|
|
50
|
-
cwd,
|
|
51
|
-
});
|
|
56
|
+
await vscePublish(vsceOptions);
|
|
52
57
|
const vsceUrl = `https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}`;
|
|
53
58
|
|
|
54
59
|
logger.log(`The new version is available at ${vsceUrl}.`);
|
|
@@ -59,15 +64,10 @@ export async function publish(version, packagePath, logger, cwd) {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
if (isOvsxPublishEnabled()) {
|
|
62
|
-
logger.log(message + 'to Open VSX Registry');
|
|
67
|
+
logger.log(message + ' to Open VSX Registry');
|
|
63
68
|
|
|
64
69
|
// When publishing to OpenVSX, packagePath will be always set
|
|
65
|
-
await
|
|
66
|
-
stdio: 'inherit',
|
|
67
|
-
preferLocal: true,
|
|
68
|
-
localDir: import.meta.dirname,
|
|
69
|
-
cwd,
|
|
70
|
-
});
|
|
70
|
+
await ovsxPublish(ovsxOptions);
|
|
71
71
|
const ovsxUrl = `https://open-vsx.org/extension/${publisher}/${name}/${version}`;
|
|
72
72
|
|
|
73
73
|
logger.log(`The new ovsx version is available at ${ovsxUrl}`);
|
package/lib/verify-ovsx-auth.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import SemanticReleaseError from '@semantic-release/error';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
4
|
import process from 'node:process';
|
|
5
|
+
import { verifyPat } from 'ovsx';
|
|
6
6
|
|
|
7
|
-
export async function verifyOvsxAuth(logger
|
|
7
|
+
export async function verifyOvsxAuth(logger) {
|
|
8
8
|
logger.log('Verifying authentication for ovsx');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const pat = process.env.OVSX_PAT;
|
|
11
|
+
|
|
12
|
+
if (!pat) {
|
|
11
13
|
throw new SemanticReleaseError(
|
|
12
14
|
'Empty ovsx personal access token (`OVSX_PAT` environment variable) specified.',
|
|
13
15
|
'EEMPTYOVSXPAT',
|
|
14
16
|
);
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
/** @type {import('ovsx').VerifyPatOptions} */
|
|
20
|
+
const options = {
|
|
21
|
+
pat,
|
|
22
|
+
};
|
|
23
|
+
|
|
17
24
|
try {
|
|
18
|
-
await
|
|
19
|
-
preferLocal: true,
|
|
20
|
-
localDir: import.meta.dirname,
|
|
21
|
-
cwd,
|
|
22
|
-
});
|
|
25
|
+
await verifyPat(options);
|
|
23
26
|
} catch (error) {
|
|
24
27
|
throw new SemanticReleaseError(
|
|
25
28
|
`Invalid ovsx personal access token. Additional information:\n\n${error}`,
|
package/lib/verify-target.js
CHANGED
|
@@ -10,15 +10,14 @@ export async function verifyTarget() {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
if (process.env.VSCE_TARGET !== 'universal') {
|
|
13
|
-
const
|
|
14
|
-
const targets = vscePackage.Targets;
|
|
13
|
+
const { Targets } = await import('@vscode/vsce/out/package.js');
|
|
15
14
|
|
|
16
15
|
// Throw if the target is not supported
|
|
17
|
-
if (!
|
|
16
|
+
if (!Targets.has(process.env.VSCE_TARGET)) {
|
|
18
17
|
throw new SemanticReleaseError(
|
|
19
18
|
`Unsupported vsce target: ${
|
|
20
19
|
process.env.VSCE_TARGET
|
|
21
|
-
}. Available targets: ${Object.values(
|
|
20
|
+
}. Available targets: ${Object.values(Targets).join(', ')}`,
|
|
22
21
|
'EUNSUPPORTEDVSCETARGET',
|
|
23
22
|
);
|
|
24
23
|
}
|
package/lib/verify-vsce-auth.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
3
|
import SemanticReleaseError from '@semantic-release/error';
|
|
4
|
-
import { execa } from 'execa';
|
|
5
4
|
import process from 'node:process';
|
|
6
5
|
import { isAzureCredentialEnabled } from './utilities.js';
|
|
6
|
+
import { verifyPat as vsceVerifyPat } from '@vscode/vsce/out/store.js';
|
|
7
|
+
|
|
8
|
+
export async function verifyVsceAuth(logger) {
|
|
9
|
+
logger.log('Verifying authentication for vsce');
|
|
7
10
|
|
|
8
|
-
export async function verifyVsceAuth(logger, cwd) {
|
|
9
11
|
const pat = process.env.VSCE_PAT;
|
|
10
12
|
const azureCredential = isAzureCredentialEnabled();
|
|
11
13
|
|
|
@@ -23,17 +25,14 @@ export async function verifyVsceAuth(logger, cwd) {
|
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// TODO: Add type definitions to `@vscode/vsce`
|
|
29
|
+
const options = {
|
|
30
|
+
pat,
|
|
31
|
+
azureCredential,
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
try {
|
|
32
|
-
await
|
|
33
|
-
preferLocal: true,
|
|
34
|
-
localDir: import.meta.dirname,
|
|
35
|
-
cwd,
|
|
36
|
-
});
|
|
35
|
+
await vsceVerifyPat(options);
|
|
37
36
|
} catch (error) {
|
|
38
37
|
throw new SemanticReleaseError(
|
|
39
38
|
`Invalid vsce personal access token or azure credential. Additional information:\n\n${error}`,
|
package/lib/verify.js
CHANGED
|
@@ -21,14 +21,14 @@ export async function verify(pluginConfig, { logger, cwd }) {
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
if (vscePublishEnabled) {
|
|
24
|
-
await verifyVsceAuth(logger
|
|
24
|
+
await verifyVsceAuth(logger);
|
|
25
25
|
} else {
|
|
26
26
|
logger.log(
|
|
27
27
|
'Skipping verification of the vsce personal access token as the `VSCE_PAT` or `VSCE_AZURE_CREDENTIAL` environment variables are not set.\n\nDid you know you can easily start publishing to Visual Studio Marketplace with `semantic-release-vsce`?\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing-to-visual-studio-marketplace',
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
if (ovsxPublishEnabled) {
|
|
31
|
-
await verifyOvsxAuth(logger
|
|
31
|
+
await verifyOvsxAuth(logger);
|
|
32
32
|
} else {
|
|
33
33
|
logger.log(
|
|
34
34
|
'Skipping verification of the ovsx personal access token as the `OVSX_PAT` environment variable is not set.\n\nDid you know you can easily start publishing to Open VSX Registry with `semantic-release-vsce`?\nLearn more at https://github.com/felipecrs/semantic-release-vsce#publishing-to-open-vsx-registry',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release-vsce",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.25",
|
|
4
4
|
"description": "semantic-release plugin to package and publish VS Code extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"lib/**/*.js"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"lint": "prettier --check . && eslint . && installed-check --
|
|
29
|
+
"lint": "prettier --check . && eslint . && installed-check --ignore-dev --ignore semantic-release",
|
|
30
30
|
"test": "c8 ava",
|
|
31
31
|
"posttest": "npm run lint",
|
|
32
32
|
"prepare": "husky"
|
|
@@ -47,13 +47,12 @@
|
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"volta": {
|
|
50
|
-
"node": "24.
|
|
51
|
-
"npm": "11.
|
|
50
|
+
"node": "24.14.0",
|
|
51
|
+
"npm": "11.11.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@semantic-release/error": "^4.0.0",
|
|
55
55
|
"@vscode/vsce": "^3.0.0",
|
|
56
|
-
"execa": "^9.5.2",
|
|
57
56
|
"fs-extra": "^11.1.0",
|
|
58
57
|
"glob": "^13.0.0",
|
|
59
58
|
"ovsx": "^0.10.0"
|
|
@@ -62,8 +61,8 @@
|
|
|
62
61
|
"semantic-release": ">=20"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
|
-
"ava": "^
|
|
66
|
-
"c8": "^
|
|
64
|
+
"ava": "^7.0.0",
|
|
65
|
+
"c8": "^11.0.0",
|
|
67
66
|
"conventional-changelog-conventionalcommits": "^9.0.0",
|
|
68
67
|
"eslint": "^9.12.0",
|
|
69
68
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
"husky": "^9.0.11",
|
|
72
71
|
"installed-check": "^10.0.0",
|
|
73
72
|
"lint-staged": "^16.0.0",
|
|
74
|
-
"neostandard": "^0.
|
|
73
|
+
"neostandard": "^0.13.0",
|
|
75
74
|
"prettier": "^3.2.5",
|
|
76
75
|
"semantic-release": "^25.0.3",
|
|
77
76
|
"sinon": "^21.0.0"
|