From e8b0932b74cfd96223a89d03e6f4d400716169b7 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Tue, 24 Feb 2026 14:26:08 +0100 Subject: [PATCH 1/5] pre-release for packaging and publishing --- DEVELOPMENT.md | 19 +++++++++++++++ package.json | 3 ++- scripts/vsce-release.js | 54 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 scripts/vsce-release.js diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 30b020eb..42e8348a 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -58,6 +58,25 @@ Supported ``s are: > yarn package [--target ] ``` +## Release versioning + +This repository follows the VS Code Marketplace pre-release recommendation: + +- **Odd** minor versions (`x.1.z`, `x.3.z`, ...) are pre-releases. +- **Even** minor versions (`x.0.z`, `x.2.z`, ...) are full releases. + +To enforce this consistently, both packaging and publishing use `scripts/vsce-release.js`, which: + +- checks the current `package.json` version minor value. +- automatically adds `--pre-release` to `vsce package` and `vsce publish` for odd minor versions. + +Use the following commands: + +```sh +> yarn package [--target ] +> yarn publish [--target ] +``` + ## Developing 1. If you are developing and debugging this extension, we recommend you run the following command diff --git a/package.json b/package.json index 1c8bb2f1..1a3e4675 100644 --- a/package.json +++ b/package.json @@ -403,7 +403,8 @@ "lint": "eslint .", "test": "jest --reporters=default --reporters=./node_modules/jest-html-reporter", "all": "yarn && yarn download-tools && yarn test", - "package": "vsce package --yarn", + "package": "node ./scripts/vsce-release.js package", + "publish": "node ./scripts/vsce-release.js publish", "tpip:report": "tsx scripts/tpip-reporter --header docs/tpip-header.md docs/third-party-licenses.json TPIP.md", "lint:md": "markdownlint **/*.md -c ./.github/markdownlint.jsonc -i ./node_modules -i ./dist -i ./coverage -i ./tools", "check:links": "tsx scripts/check-links.ts -i ./node_modules/** -i ./.github/** -c ./.github/markdown-link-check.jsonc", diff --git a/scripts/vsce-release.js b/scripts/vsce-release.js new file mode 100644 index 00000000..fc60acd5 --- /dev/null +++ b/scripts/vsce-release.js @@ -0,0 +1,54 @@ +#!/usr/bin/env node + +import fs from 'node:fs'; +import path from 'node:path'; +import { spawnSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const rootPath = path.resolve(__dirname, '..'); +const packageJsonPath = path.join(rootPath, 'package.json'); + +const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); +const version = packageJson.version; + +const match = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(version); +if (!match) { + console.error(`Unsupported package.json version format: ${version}`); + process.exit(1); +} + +const minor = Number(match[2]); +const isPreReleaseChannel = minor % 2 === 1; + +const allowedCommands = new Set(['package', 'publish']); +const command = process.argv[2] ?? 'package'; + +if (!allowedCommands.has(command)) { + console.error(`Unsupported vsce command: ${command}`); + console.error('Supported commands: package, publish'); + process.exit(1); +} + +const passthroughArgs = process.argv.slice(3); +const args = [command, '--yarn', ...passthroughArgs]; + +if (isPreReleaseChannel) { + args.push('--pre-release'); +} + +console.log(`Running: vsce ${args.join(' ')}`); + +const result = spawnSync('vsce', args, { + cwd: rootPath, + stdio: 'inherit', + shell: process.platform === 'win32' +}); + +if (result.error) { + console.error(result.error.message); + process.exit(1); +} + +process.exit(result.status ?? 1); From b0023c04dd7b8984daccf0aa09515bfc78f763e1 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Tue, 24 Feb 2026 16:17:14 +0100 Subject: [PATCH 2/5] Use --yarn from command line --- DEVELOPMENT.md | 4 ++-- package.json | 4 ++-- scripts/vsce-release.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 42e8348a..f552136c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -73,8 +73,8 @@ To enforce this consistently, both packaging and publishing use `scripts/vsce-re Use the following commands: ```sh -> yarn package [--target ] -> yarn publish [--target ] +> yarn run package [--target ] +> yarn run publish [--target ] ``` ## Developing diff --git a/package.json b/package.json index 1a3e4675..522814f4 100644 --- a/package.json +++ b/package.json @@ -403,8 +403,8 @@ "lint": "eslint .", "test": "jest --reporters=default --reporters=./node_modules/jest-html-reporter", "all": "yarn && yarn download-tools && yarn test", - "package": "node ./scripts/vsce-release.js package", - "publish": "node ./scripts/vsce-release.js publish", + "package": "node ./scripts/vsce-release.js package --yarn", + "publish": "node ./scripts/vsce-release.js publish --yarn", "tpip:report": "tsx scripts/tpip-reporter --header docs/tpip-header.md docs/third-party-licenses.json TPIP.md", "lint:md": "markdownlint **/*.md -c ./.github/markdownlint.jsonc -i ./node_modules -i ./dist -i ./coverage -i ./tools", "check:links": "tsx scripts/check-links.ts -i ./node_modules/** -i ./.github/** -c ./.github/markdown-link-check.jsonc", diff --git a/scripts/vsce-release.js b/scripts/vsce-release.js index fc60acd5..cbb887b0 100644 --- a/scripts/vsce-release.js +++ b/scripts/vsce-release.js @@ -32,7 +32,7 @@ if (!allowedCommands.has(command)) { } const passthroughArgs = process.argv.slice(3); -const args = [command, '--yarn', ...passthroughArgs]; +const args = [command, ...passthroughArgs]; if (isPreReleaseChannel) { args.push('--pre-release'); From dbc47c5d0c536be48f70c20e4c27ccea69398ed4 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Tue, 24 Feb 2026 16:23:06 +0100 Subject: [PATCH 3/5] Adapted nightly --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bdeb4f64..1c3a62ec 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -164,7 +164,7 @@ jobs: - name: Create vsix package run: | - yarn package --target ${{ matrix.target }} + yarn run package --target ${{ matrix.target }} --yarn - name: Upload package uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 From 1c514f52038c0ace72c71a8a7a3446ccc1c0008a Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Tue, 24 Feb 2026 16:47:02 +0100 Subject: [PATCH 4/5] Added copyright --- scripts/vsce-release.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/vsce-release.js b/scripts/vsce-release.js index cbb887b0..74fbe59d 100644 --- a/scripts/vsce-release.js +++ b/scripts/vsce-release.js @@ -1,5 +1,23 @@ #!/usr/bin/env node +/** + * Copyright 2026 Arm Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// generated with AI + import fs from 'node:fs'; import path from 'node:path'; import { spawnSync } from 'node:child_process'; From 83309e09f1470c42cbf1a774df92a140498b9d06 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Wed, 25 Feb 2026 16:32:19 +0100 Subject: [PATCH 5/5] Removed publish command support and cleanup --- .github/workflows/ci.yml | 2 +- DEVELOPMENT.md | 3 +-- package.json | 3 +-- scripts/vsce-release.js | 20 ++++++++++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dacb95d0..2590b7c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -206,7 +206,7 @@ jobs: - name: Create vsix package run: | - yarn package --target ${{ matrix.target }} + yarn run package --target ${{ matrix.target }} --yarn - name: Upload package uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index f552136c..26738126 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -68,13 +68,12 @@ This repository follows the VS Code Marketplace pre-release recommendation: To enforce this consistently, both packaging and publishing use `scripts/vsce-release.js`, which: - checks the current `package.json` version minor value. -- automatically adds `--pre-release` to `vsce package` and `vsce publish` for odd minor versions. +- automatically adds `--pre-release` to `vsce package` for odd minor versions. Use the following commands: ```sh > yarn run package [--target ] -> yarn run publish [--target ] ``` ## Developing diff --git a/package.json b/package.json index 23161237..2d04c736 100644 --- a/package.json +++ b/package.json @@ -403,8 +403,7 @@ "lint": "eslint .", "test": "jest --reporters=default --reporters=./node_modules/jest-html-reporter", "all": "yarn && yarn download-tools && yarn test", - "package": "node ./scripts/vsce-release.js package --yarn", - "publish": "node ./scripts/vsce-release.js publish --yarn", + "package": "node ./scripts/vsce-release.js --yarn", "tpip:report": "tsx scripts/tpip-reporter --header docs/tpip-header.md docs/third-party-licenses.json TPIP.md", "lint:md": "markdownlint **/*.md -c ./.github/markdownlint.jsonc -i ./node_modules -i ./dist -i ./coverage -i ./tools", "check:links": "tsx scripts/check-links.ts -i ./node_modules/** -i ./.github/** -c ./.github/markdown-link-check.jsonc", diff --git a/scripts/vsce-release.js b/scripts/vsce-release.js index 74fbe59d..4c341fdf 100644 --- a/scripts/vsce-release.js +++ b/scripts/vsce-release.js @@ -18,6 +18,17 @@ // generated with AI +/** + * CLI usage: + * - Preferred: npm run package + * - With extra vsce flags: npm run package -- + * - Direct invocation: node ./scripts/vsce-release.js [package] [vsce-args] + * + * Notes: + * - This helper only supports the `package` command. + * - `--pre-release` is appended automatically for odd minor versions. + */ + import fs from 'node:fs'; import path from 'node:path'; import { spawnSync } from 'node:child_process'; @@ -40,16 +51,17 @@ if (!match) { const minor = Number(match[2]); const isPreReleaseChannel = minor % 2 === 1; -const allowedCommands = new Set(['package', 'publish']); -const command = process.argv[2] ?? 'package'; +const allowedCommands = new Set(['package']); +const firstArg = process.argv[2]; +const command = firstArg && !firstArg.startsWith('-') ? firstArg : 'package'; if (!allowedCommands.has(command)) { console.error(`Unsupported vsce command: ${command}`); - console.error('Supported commands: package, publish'); + console.error('Supported commands: package'); process.exit(1); } -const passthroughArgs = process.argv.slice(3); +const passthroughArgs = command === firstArg ? process.argv.slice(3) : process.argv.slice(2); const args = [command, ...passthroughArgs]; if (isPreReleaseChannel) {