semantic-release-vsce 6.0.2 → 6.0.3

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.
Files changed (2) hide show
  1. package/index.js +72 -0
  2. package/package.json +2 -1
package/index.js ADDED
@@ -0,0 +1,72 @@
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-vsce",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "semantic-release plugin to package and publish VS Code extensions",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,6 +22,7 @@
22
22
  ],
23
23
  "exports": "./index.js",
24
24
  "files": [
25
+ "index.js",
25
26
  "lib/**/*.js"
26
27
  ],
27
28
  "scripts": {