semantic-release-vsce 6.0.3 → 6.0.4
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/index.js +5 -3
- package/lib/prepare.js +5 -7
- package/lib/publish.js +2 -2
- package/lib/utils.js +2 -2
- package/lib/verify-ovsx-auth.js +2 -2
- package/lib/{verify-pkg.js → verify-package.js} +3 -3
- package/lib/verify-target.js +2 -1
- package/lib/verify-vsce-auth.js +5 -5
- package/lib/verify.js +2 -2
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import path from 'node:path';
|
|
4
4
|
import { prepare as vscePrepare } from './lib/prepare.js';
|
|
5
5
|
import { publish as vscePublish } from './lib/publish.js';
|
|
6
6
|
import { verify as vsceVerify } from './lib/verify.js';
|
|
@@ -60,7 +60,7 @@ export async function publish(
|
|
|
60
60
|
|
|
61
61
|
if (pluginConfig?.publishPackagePath) {
|
|
62
62
|
// Expand glob
|
|
63
|
-
const glob =
|
|
63
|
+
const { glob } = await import('glob');
|
|
64
64
|
packagePath = await glob(pluginConfig.publishPackagePath, { cwd });
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -68,5 +68,7 @@ export async function publish(
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function getPackageRoot(pluginConfig, cwd) {
|
|
71
|
-
return pluginConfig.packageRoot
|
|
71
|
+
return pluginConfig.packageRoot
|
|
72
|
+
? path.join(cwd, pluginConfig.packageRoot)
|
|
73
|
+
: cwd;
|
|
72
74
|
}
|
package/lib/prepare.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
import { readJson } from 'fs-extra/esm';
|
|
5
|
-
import
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
import process from 'node:process';
|
|
7
7
|
import { isOvsxPublishEnabled, isTargetEnabled } from './utils.js';
|
|
8
8
|
|
|
@@ -25,12 +25,10 @@ export async function prepare(version, packageVsix, logger, cwd) {
|
|
|
25
25
|
if (typeof packageVsix === 'string') {
|
|
26
26
|
packagePath = packageVsix;
|
|
27
27
|
} else {
|
|
28
|
-
const { name } = await readJson(join(cwd, './package.json'));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
packagePath = `${name}-${version}.vsix`;
|
|
33
|
-
}
|
|
28
|
+
const { name } = await readJson(path.join(cwd, './package.json'));
|
|
29
|
+
packagePath = isTargetEnabled()
|
|
30
|
+
? `${name}-${process.env.VSCE_TARGET}-${version}.vsix`
|
|
31
|
+
: `${name}-${version}.vsix`;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
logger.log(`Packaging version ${version} to ${packagePath}`);
|
package/lib/publish.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
import { readJson } from 'fs-extra/esm';
|
|
5
|
-
import
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
import process from 'node:process';
|
|
7
7
|
import {
|
|
8
8
|
isAzureCredentialEnabled,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from './utils.js';
|
|
13
13
|
|
|
14
14
|
export async function publish(version, packagePath, logger, cwd) {
|
|
15
|
-
const { publisher, name } = await readJson(join(cwd, './package.json'));
|
|
15
|
+
const { publisher, name } = await readJson(path.join(cwd, './package.json'));
|
|
16
16
|
|
|
17
17
|
const options = ['publish'];
|
|
18
18
|
|
package/lib/utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function environmentToBoolean(name) {
|
|
6
6
|
return process.env[name] === 'true' || process.env[name] === '1';
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export function isOvsxPublishEnabled() {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function isAzureCredentialEnabled() {
|
|
14
|
-
return
|
|
14
|
+
return environmentToBoolean('VSCE_AZURE_CREDENTIAL');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function isVscePublishEnabled() {
|
package/lib/verify-ovsx-auth.js
CHANGED
|
@@ -16,9 +16,9 @@ export async function verifyOvsxAuth(logger, cwd) {
|
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
18
|
await execa('ovsx', ['verify-pat'], { preferLocal: true, cwd });
|
|
19
|
-
} catch (
|
|
19
|
+
} catch (error) {
|
|
20
20
|
throw new SemanticReleaseError(
|
|
21
|
-
`Invalid ovsx personal access token. Additional information:\n\n${
|
|
21
|
+
`Invalid ovsx personal access token. Additional information:\n\n${error}`,
|
|
22
22
|
'EINVALIDOVSXPAT',
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import SemanticReleaseError from '@semantic-release/error';
|
|
4
4
|
import { pathExists, readJson } from 'fs-extra/esm';
|
|
5
|
-
import
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
|
|
7
|
-
export async function
|
|
8
|
-
const packagePath = join(cwd, './package.json');
|
|
7
|
+
export async function verifyPackage(cwd) {
|
|
8
|
+
const packagePath = path.join(cwd, './package.json');
|
|
9
9
|
|
|
10
10
|
if (!(await pathExists(packagePath))) {
|
|
11
11
|
throw new SemanticReleaseError(
|
package/lib/verify-target.js
CHANGED
|
@@ -17,7 +17,8 @@ export async function verifyTarget() {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (process.env.VSCE_TARGET !== 'universal') {
|
|
20
|
-
const
|
|
20
|
+
const vscePackage = await import('@vscode/vsce/out/package.js');
|
|
21
|
+
const targets = vscePackage.Targets;
|
|
21
22
|
|
|
22
23
|
// Throw if the target is not supported
|
|
23
24
|
if (!targets.has(process.env.VSCE_TARGET)) {
|
package/lib/verify-vsce-auth.js
CHANGED
|
@@ -23,16 +23,16 @@ export async function verifyVsceAuth(logger, cwd) {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const vsceArguments = ['verify-pat'];
|
|
27
27
|
if (azureCredential) {
|
|
28
|
-
|
|
28
|
+
vsceArguments.push('--azure-credential');
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
|
-
await execa('vsce',
|
|
33
|
-
} catch (
|
|
32
|
+
await execa('vsce', vsceArguments, { preferLocal: true, cwd });
|
|
33
|
+
} catch (error) {
|
|
34
34
|
throw new SemanticReleaseError(
|
|
35
|
-
`Invalid vsce personal access token or azure credential. Additional information:\n\n${
|
|
35
|
+
`Invalid vsce personal access token or azure credential. Additional information:\n\n${error}`,
|
|
36
36
|
'EINVALIDVSCEPAT',
|
|
37
37
|
);
|
|
38
38
|
}
|
package/lib/verify.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import SemanticReleaseError from '@semantic-release/error';
|
|
4
4
|
import { isOvsxPublishEnabled, isVscePublishEnabled } from './utils.js';
|
|
5
5
|
import { verifyOvsxAuth } from './verify-ovsx-auth.js';
|
|
6
|
-
import {
|
|
6
|
+
import { verifyPackage } from './verify-package.js';
|
|
7
7
|
import { verifyTarget } from './verify-target.js';
|
|
8
8
|
import { verifyVsceAuth } from './verify-vsce-auth.js';
|
|
9
9
|
|
|
10
10
|
export async function verify(pluginConfig, { logger, cwd }) {
|
|
11
|
-
await
|
|
11
|
+
await verifyPackage(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": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "semantic-release plugin to package and publish VS Code extensions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"c8": "^10.1.3",
|
|
67
67
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
68
68
|
"eslint": "^9.12.0",
|
|
69
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
69
70
|
"esmock": "^2.6.9",
|
|
70
71
|
"husky": "^9.0.11",
|
|
71
72
|
"installed-check": "^9.0.0",
|