@rushstack/heft-vscode-extension-plugin 0.1.0 → 0.2.0

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/heft-plugin.json CHANGED
@@ -1,10 +1,38 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json",
3
-
4
3
  "taskPlugins": [
5
4
  {
6
5
  "pluginName": "vscode-extension-package-plugin",
7
- "entryPoint": "./lib/VSCodeExtensionPackagePlugin.js"
6
+ "entryPoint": "./lib/VSCodeExtensionPackagePlugin.js",
7
+ "parameterScope": "package"
8
+ },
9
+ {
10
+ "pluginName": "vscode-extension-publish-plugin",
11
+ "entryPoint": "./lib/VSCodeExtensionPublishPlugin.js",
12
+ "parameterScope": "publish-vsix",
13
+ "parameters": [
14
+ {
15
+ "longName": "--vsix-path",
16
+ "parameterKind": "string",
17
+ "argumentName": "RELATIVE_PATH",
18
+ "description": "Use this parameter to control which VSIX file will be used for publishing.",
19
+ "required": true
20
+ },
21
+ {
22
+ "longName": "--manifest-path",
23
+ "parameterKind": "string",
24
+ "argumentName": "RELATIVE_PATH",
25
+ "description": "Use this parameter to control which manifest file will be used for publishing.",
26
+ "required": true
27
+ },
28
+ {
29
+ "longName": "--signature-path",
30
+ "parameterKind": "string",
31
+ "argumentName": "RELATIVE_PATH",
32
+ "description": "Use this parameter to control which signature file will be used for publishing.",
33
+ "required": true
34
+ }
35
+ ]
8
36
  }
9
37
  ]
10
38
  }
@@ -11,6 +11,11 @@ interface IVSCodeExtensionPackagePluginOptions {
11
11
  * If a directory is provided, the VSIX file will be named based on the extension's `package.json` name and version.
12
12
  */
13
13
  vsixPath: string;
14
+ /**
15
+ * The path where the generated manifest file will be saved.
16
+ * This manifest is used for signing the VS Code extension.
17
+ */
18
+ manifestPath: string;
14
19
  }
15
20
  export default class VSCodeExtensionPackagePlugin implements IHeftTaskPlugin<IVSCodeExtensionPackagePluginOptions> {
16
21
  apply(heftTaskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, pluginOptions: IVSCodeExtensionPackagePluginOptions): void;
@@ -1 +1 @@
1
- {"version":3,"file":"VSCodeExtensionPackagePlugin.d.ts","sourceRoot":"","sources":["../src/VSCodeExtensionPackagePlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAMzB,UAAU,oCAAoC;IAC5C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,MAAM,CAAC,OAAO,OAAO,4BACnB,YAAW,eAAe,CAAC,oCAAoC,CAAC;IAEzD,KAAK,CACV,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,oCAAoC,GAClD,IAAI;CA4CR"}
1
+ {"version":3,"file":"VSCodeExtensionPackagePlugin.d.ts","sourceRoot":"","sources":["../src/VSCodeExtensionPackagePlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAKzB,UAAU,oCAAoC;IAC5C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,CAAC,OAAO,OAAO,4BACnB,YAAW,eAAe,CAAC,oCAAoC,CAAC;IAEzD,KAAK,CACV,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,oCAAoC,GAClD,IAAI;CAgDR"}
@@ -35,45 +35,40 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  };
36
36
  })();
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- const node_core_library_1 = require("@rushstack/node-core-library");
39
38
  const path = __importStar(require("node:path"));
40
- const terminal_1 = require("@rushstack/terminal");
39
+ const util_1 = require("./util");
41
40
  const PLUGIN_NAME = 'vscode-extension-package-plugin';
42
- const vsceBasePackagePath = require.resolve('@vscode/vsce/package.json');
43
- const vsceScript = path.resolve(vsceBasePackagePath, '../vsce');
44
41
  class VSCodeExtensionPackagePlugin {
45
42
  apply(heftTaskSession, heftConfiguration, pluginOptions) {
46
43
  heftTaskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions) => {
47
- var _a, _b;
48
- const { unpackedFolderPath, vsixPath } = pluginOptions;
44
+ const { unpackedFolderPath, vsixPath, manifestPath } = pluginOptions;
45
+ const { buildFolderPath } = heftConfiguration;
49
46
  const { logger: { terminal } } = heftTaskSession;
50
- terminal.writeLine(`Using VSCE script: ${vsceScript}`);
47
+ terminal.writeLine(`Using VSCE script: ${util_1.vsceScriptPath}`);
51
48
  terminal.writeLine(`Packaging VSIX from ${unpackedFolderPath} to ${vsixPath}`);
52
- const terminalOutStream = new terminal_1.TerminalStreamWritable({
53
- terminal,
54
- severity: terminal_1.TerminalProviderSeverity.log
49
+ const packageResult = await (0, util_1.executeAndWaitAsync)(terminal, 'node', [util_1.vsceScriptPath, 'package', '--no-dependencies', '--out', path.resolve(vsixPath)], {
50
+ currentWorkingDirectory: path.resolve(buildFolderPath, unpackedFolderPath)
55
51
  });
56
- const terminalErrorStream = new terminal_1.TerminalStreamWritable({
57
- terminal,
58
- severity: terminal_1.TerminalProviderSeverity.error
59
- });
60
- const childProcess = node_core_library_1.Executable.spawn('node', [vsceScript, 'package', '--no-dependencies', '--out', `${path.resolve(vsixPath)}`], {
61
- currentWorkingDirectory: path.resolve(unpackedFolderPath),
62
- stdio: [
63
- 'ignore', // stdin
64
- 'pipe', // stdout
65
- 'pipe' // stderr
66
- ]
67
- });
68
- (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.pipe(terminalOutStream);
69
- (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.pipe(terminalErrorStream);
70
- const result = await node_core_library_1.Executable.waitForExitAsync(childProcess, {
71
- encoding: 'utf8'
72
- });
73
- if (result.exitCode !== 0) {
74
- throw new Error(`VSIX packaging failed with exit code ${result.exitCode}`);
52
+ if (packageResult.exitCode !== 0) {
53
+ throw new Error(`VSIX packaging failed with exit code ${packageResult.exitCode}`);
75
54
  }
76
55
  terminal.writeLine('VSIX successfully packaged.');
56
+ terminal.writeLine(`Generating manifest at ${manifestPath}`);
57
+ const manifestResult = await (0, util_1.executeAndWaitAsync)(terminal, 'node', [
58
+ util_1.vsceScriptPath,
59
+ 'generate-manifest',
60
+ '--packagePath',
61
+ path.resolve(vsixPath),
62
+ '--out',
63
+ path.resolve(manifestPath)
64
+ ], {
65
+ currentWorkingDirectory: buildFolderPath
66
+ });
67
+ if (manifestResult.exitCode !== 0) {
68
+ throw new Error(`Manifest generation failed with exit code ${manifestResult.exitCode}`);
69
+ }
70
+ terminal.writeLine('Manifest successfully generated.');
71
+ terminal.writeLine(`VSIX package and manifest generation completed successfully.`);
77
72
  });
78
73
  }
79
74
  }
@@ -0,0 +1,8 @@
1
+ import type { HeftConfiguration, IHeftTaskPlugin, IHeftTaskSession } from '@rushstack/heft';
2
+ interface IVSCodeExtensionPublishPluginOptions {
3
+ }
4
+ export default class VSCodeExtensionPublishPlugin implements IHeftTaskPlugin<IVSCodeExtensionPublishPluginOptions> {
5
+ apply(heftTaskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, pluginOptions: IVSCodeExtensionPublishPluginOptions): void;
6
+ }
7
+ export {};
8
+ //# sourceMappingURL=VSCodeExtensionPublishPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VSCodeExtensionPublishPlugin.d.ts","sourceRoot":"","sources":["../src/VSCodeExtensionPublishPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AAKzB,UAAU,oCAAoC;CAAG;AAQjD,MAAM,CAAC,OAAO,OAAO,4BACnB,YAAW,eAAe,CAAC,oCAAoC,CAAC;IAEzD,KAAK,CACV,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,oCAAoC,GAClD,IAAI;CAgER"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const path = __importStar(require("node:path"));
39
+ const util_1 = require("./util");
40
+ const PLUGIN_NAME = 'vscode-extension-publish-plugin';
41
+ const VSIX_PATH_PARAMETER_NAME = '--vsix-path';
42
+ const MANIFEST_PATH_PARAMETER_NAME = '--manifest-path';
43
+ const SIGNATURE_PATH_PARAMETER_NAME = '--signature-path';
44
+ class VSCodeExtensionPublishPlugin {
45
+ apply(heftTaskSession, heftConfiguration, pluginOptions) {
46
+ const vsixPathParameter = heftTaskSession.parameters.getStringParameter(VSIX_PATH_PARAMETER_NAME);
47
+ const manifestPathParameter = heftTaskSession.parameters.getStringParameter(MANIFEST_PATH_PARAMETER_NAME);
48
+ const signaturePathParameter = heftTaskSession.parameters.getStringParameter(SIGNATURE_PATH_PARAMETER_NAME);
49
+ if (!vsixPathParameter.value) {
50
+ throw new Error(`The parameter "${VSIX_PATH_PARAMETER_NAME}" is required for the VSCodeExtensionPublishPlugin.`);
51
+ }
52
+ if (!manifestPathParameter.value) {
53
+ throw new Error(`The parameter "${MANIFEST_PATH_PARAMETER_NAME}" is required for the VSCodeExtensionPublishPlugin.`);
54
+ }
55
+ if (!signaturePathParameter.value) {
56
+ throw new Error(`The parameter "${SIGNATURE_PATH_PARAMETER_NAME}" is required for the VSCodeExtensionPublishPlugin.`);
57
+ }
58
+ const vsixPath = vsixPathParameter.value;
59
+ const manifestPath = manifestPathParameter.value;
60
+ const signaturePath = signaturePathParameter.value;
61
+ heftTaskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions) => {
62
+ const { buildFolderPath } = heftConfiguration;
63
+ const { logger: { terminal } } = heftTaskSession;
64
+ terminal.writeLine(`Using VSCE script: ${util_1.vsceScriptPath}`);
65
+ terminal.writeLine(`Publishing VSIX ${vsixPath}`);
66
+ const publishResult = await (0, util_1.executeAndWaitAsync)(terminal, 'node', [
67
+ util_1.vsceScriptPath,
68
+ 'publish',
69
+ '--no-dependencies',
70
+ '--azure-credential',
71
+ '--packagePath',
72
+ path.resolve(vsixPath),
73
+ '--manifestPath',
74
+ path.resolve(manifestPath),
75
+ '--signaturePath',
76
+ path.resolve(signaturePath)
77
+ ], {
78
+ currentWorkingDirectory: path.resolve(buildFolderPath)
79
+ });
80
+ if (publishResult.exitCode !== 0) {
81
+ throw new Error(`VSIX publishing failed with exit code ${publishResult.exitCode}`);
82
+ }
83
+ terminal.writeLine('VSIX successfully published.');
84
+ });
85
+ }
86
+ }
87
+ exports.default = VSCodeExtensionPublishPlugin;
88
+ //# sourceMappingURL=VSCodeExtensionPublishPlugin.js.map
package/lib/util.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { IExecutableSpawnOptions, IWaitForExitResult } from '@rushstack/node-core-library';
2
+ import { ITerminal } from '@rushstack/terminal';
3
+ export declare function executeAndWaitAsync(terminal: ITerminal, command: string, args: string[], options?: Omit<IExecutableSpawnOptions, 'stdio'>): Promise<IWaitForExitResult<string>>;
4
+ export declare const vsceScriptPath: string;
5
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvG,OAAO,EAAoD,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAElG,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAM,GACnD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAyBrC;AAGD,eAAO,MAAM,cAAc,EAAE,MAAqD,CAAC"}
package/lib/util.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.vsceScriptPath = void 0;
39
+ exports.executeAndWaitAsync = executeAndWaitAsync;
40
+ const node_core_library_1 = require("@rushstack/node-core-library");
41
+ const path = __importStar(require("node:path"));
42
+ const terminal_1 = require("@rushstack/terminal");
43
+ async function executeAndWaitAsync(terminal, command, args, options = {}) {
44
+ var _a, _b;
45
+ const childProcess = node_core_library_1.Executable.spawn(command, args, Object.assign(Object.assign({}, options), { stdio: [
46
+ 'ignore', // stdin
47
+ 'pipe', // stdout
48
+ 'pipe' // stderr
49
+ ] }));
50
+ (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.pipe(new terminal_1.TerminalStreamWritable({
51
+ terminal,
52
+ severity: terminal_1.TerminalProviderSeverity.log
53
+ }));
54
+ (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.pipe(new terminal_1.TerminalStreamWritable({
55
+ terminal,
56
+ severity: terminal_1.TerminalProviderSeverity.error
57
+ }));
58
+ const result = await node_core_library_1.Executable.waitForExitAsync(childProcess, {
59
+ encoding: 'utf8'
60
+ });
61
+ return result;
62
+ }
63
+ const vsceBasePackagePath = require.resolve('@vscode/vsce/package.json');
64
+ exports.vsceScriptPath = path.resolve(vsceBasePackagePath, '../vsce');
65
+ //# sourceMappingURL=util.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/heft-vscode-extension-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Heft plugin for building vscode extensions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@vscode/vsce": "3.3.2",
25
- "@rushstack/terminal": "0.15.4",
26
- "@rushstack/node-core-library": "5.14.0"
25
+ "@rushstack/node-core-library": "5.14.0",
26
+ "@rushstack/terminal": "0.15.4"
27
27
  },
28
28
  "sideEffects": false,
29
29
  "scripts": {