Skip to content

Commit 7d239b6

Browse files
dev-package: generate version number from the version in the package.json (#1474)
1 parent a1a6b0f commit 7d239b6

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@
16371637
"coverage": "npm test -- --coverage",
16381638
"compile-tests": "del-cli ./assets/test/**/.build && npm run compile",
16391639
"package": "vsce package",
1640-
"dev-package": "vsce package --no-update-package-json 2.1.0-dev",
1640+
"dev-package": "tsx ./scripts/dev_package.ts",
16411641
"preview-package": "tsx ./scripts/preview_package.ts",
16421642
"tag": "./scripts/tag_release.sh $npm_package_version",
16431643
"contributors": "./scripts/generate_contributors_list.sh"

scripts/dev_package.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the VS Code Swift open source project
4+
//
5+
// Copyright (c) 2025 the VS Code Swift project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
/* eslint-disable no-console */
15+
16+
import { exec, getExtensionVersion, getRootDirectory, main } from "./lib/utilities";
17+
18+
main(async () => {
19+
const rootDirectory = getRootDirectory();
20+
const version = await getExtensionVersion();
21+
// Increment the patch version from the package.json
22+
const patch = version.patch + 1;
23+
const devVersion = `${version.major}.${version.minor}.${patch}-dev`;
24+
// Use VSCE to package the extension
25+
await exec("npx", ["vsce", "package", "--no-update-package-json", devVersion], {
26+
cwd: rootDirectory,
27+
});
28+
});

0 commit comments

Comments
 (0)