Skip to content

Commit 7d550cb

Browse files
committed
updated release process
1 parent 8c1c527 commit 7d550cb

File tree

7 files changed

+280
-103
lines changed

7 files changed

+280
-103
lines changed

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/publishing.md

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,98 +16,97 @@ Publishing is automated via GitHub Actions. When you push a tag starting with `v
1616
- Write access to the repository
1717
- `MARKETPLACE_TOKEN` secret configured in GitHub (for automated publishing)
1818

19+
## Release Commands
20+
21+
All releases are handled through the `pnpm release` command:
22+
23+
```bash
24+
# Patch release (bug fixes): 11.0.0 → 11.0.1
25+
pnpm release patch
26+
27+
# Minor release (new features): 11.0.0 → 11.1.0
28+
pnpm release minor
29+
30+
# Major release (breaking changes): 11.0.0 → 12.0.0
31+
pnpm release major
32+
33+
# Preview release: 11.0.0 → 11.1.0-preview.1
34+
pnpm release preview
35+
```
36+
1937
## Version Types
2038

21-
| Type | Example | When to Use |
22-
| ---------- | ------------------- | --------------------------------- |
23-
| Major | `11.0.0``12.0.0` | Breaking changes |
24-
| Minor | `11.0.0``11.1.0` | New features, backward compatible |
25-
| Patch | `11.0.0``11.0.1` | Bug fixes |
26-
| Prerelease | `12.0.0-preview.1` | Testing before stable release |
39+
| Type | Command | Example |
40+
| ------- | ---------------------- | ----------------------------- |
41+
| Major | `pnpm release major` | `11.0.0``12.0.0` |
42+
| Minor | `pnpm release minor` | `11.0.0``11.1.0` |
43+
| Patch | `pnpm release patch` | `11.0.0``11.0.1` |
44+
| Preview | `pnpm release preview` | `11.0.0``11.1.0-preview.1` |
2745

2846
## Publishing a Stable Release
2947

3048
### 1. Update the Changelog
3149

32-
Add your changes under the `[unreleased]` section in `CHANGELOG.md` as you make changes:
50+
Add your changes under the `[Unreleased]` section in `CHANGELOG.md` as you make changes:
3351

3452
```markdown
35-
## [unreleased]
53+
## [Unreleased]
3654

3755
- Added new feature X
3856
- Fixed bug Y
3957
```
4058

41-
### 2. Bump the Version
42-
43-
Run one of these commands depending on the release type:
59+
### 2. Run the Release Command
4460

4561
```bash
46-
# Patch release (bug fixes): 11.0.0 → 11.0.1
47-
npm version patch
48-
49-
# Minor release (new features): 11.0.0 → 11.1.0
50-
npm version minor
51-
52-
# Major release (breaking changes): 11.0.0 → 12.0.0
53-
npm version major
62+
pnpm release patch # or minor, major
5463
```
5564

5665
This automatically:
5766

58-
1. Updates `version` in `package.json`
59-
2. Runs the `version` script which updates `CHANGELOG.md` (converts `[unreleased]` to the new version number)
60-
3. Stages both `package.json` and `CHANGELOG.md`
67+
1. Calculates the new version number
68+
2. Updates `version` in `package.json`
69+
3. Updates `CHANGELOG.md` (converts `[Unreleased]` to the new version)
6170
4. Creates a git commit with message `v<version>`
6271
5. Creates a git tag `v<version>`
63-
6. Pushes the commit and tag to origin (via `postversion` script)
72+
6. Pushes the commit and tag to origin
6473

6574
The GitHub Actions workflow will then automatically:
6675

6776
- Build the extension
6877
- Create a GitHub Release with auto-generated notes
6978
- Publish to the VS Code Marketplace
7079

71-
## Publishing a Prerelease
80+
## Publishing a Preview Release
7281

73-
Prereleases allow testing new features before a stable release. VS Code users can opt-in to receive prerelease versions.
82+
Preview releases allow testing new features before a stable release. VS Code users can opt-in to receive preview versions.
7483

75-
### 1. Bump to a Prerelease Version
84+
### Creating a Preview
7685

7786
```bash
78-
# First prerelease for a new major version: 11.0.0 → 12.0.0-preview.0
79-
npm version premajor
80-
81-
# First prerelease for a new minor version: 11.0.0 → 11.1.0-preview.0
82-
npm version preminor
83-
84-
# First prerelease for a patch: 11.0.0 → 11.0.1-preview.0
85-
npm version prepatch
87+
# First preview (from stable): 11.0.0 → 11.1.0-preview.1
88+
pnpm release preview
8689

87-
# Increment existing prerelease: 12.0.0-preview.012.0.0-preview.1
88-
npm version prerelease
90+
# Subsequent previews: 11.1.0-preview.111.1.0-preview.2
91+
pnpm release preview
8992
```
9093

91-
> The `.npmrc` file configures `preview` as the default prerelease identifier.
92-
93-
> **Note:** The version script automatically skips changelog updates for prereleases. The `[unreleased]` section is preserved until the final stable release.
94-
95-
The commit and tag are automatically pushed. The workflow detects prerelease tags (containing `-preview`, `-beta`, `-alpha`, or `-rc`) and:
94+
The workflow detects preview tags and:
9695

9796
- Packages with `vsce package --pre-release`
9897
- Creates a GitHub Release marked as prerelease
9998
- Publishes to Marketplace with `vsce publish --pre-release`
10099

101-
### 2. Promote to Stable
100+
### Promoting to Stable
102101

103102
When ready to release the stable version:
104103

105104
```bash
106-
# Release the stable version: 12.0.0-preview.3 → 12.0.0
107-
npm version major # or minor/patch depending on what changed
105+
# From preview to stable: 11.1.0-preview.3 → 11.1.0
106+
pnpm release minor
108107
```
109108

110-
This will update the changelog, moving all `[unreleased]` entries to the new stable version, and push automatically.
109+
This will update the changelog (moving all `[Unreleased]` entries to the new stable version) and push automatically.
111110

112111
## Manual Publishing (Emergency)
113112

@@ -149,6 +148,6 @@ If `package.json` version doesn't match the tag:
149148
git tag -d v12.0.0
150149
git push origin :refs/tags/v12.0.0
151150

152-
# Fix version and re-tag (will push automatically)
153-
npm version 12.0.0
151+
# Re-run the release
152+
pnpm release minor # or appropriate type
154153
```

esbuild.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ import path from "path";
55
const production = process.argv.includes("--production");
66
const watch = process.argv.includes("--watch");
77

8+
// Clean output directories (skip in watch mode)
9+
if (!watch) {
10+
for (const dir of ["dist", "out"]) {
11+
if (fs.existsSync(dir)) {
12+
fs.rmSync(dir, { recursive: true, force: true });
13+
}
14+
}
15+
}
16+
817
const extensionPackage = JSON.parse(
918
fs.readFileSync(new URL("./package.json", import.meta.url), "utf-8"),
1019
);

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,19 @@
6969
"main": "./dist/extension",
7070
"browser": "./dist/web-extension",
7171
"scripts": {
72-
"clean": "node ./scripts/clean.mjs",
72+
"compile:test": "tsc -p ./ && node esbuild.mjs",
73+
"check-types": "tsc --noEmit",
74+
"chrome": "pnpm compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. .",
75+
"compile": "pnpm check-types && node esbuild.mjs",
7376
"lint": "eslint src *.mjs scripts",
7477
"pretest": "pnpm test-compile && node scripts/install-fixtures.mjs",
7578
"prettier": "prettier --write .",
76-
"compile": "pnpm check-types && node esbuild.mjs",
77-
"check-types": "tsc --noEmit",
78-
"watch": "pnpm run --parallel watch:esbuild watch:tsc",
79+
"release": "node ./scripts/release.mjs",
80+
"test:web": "pnpm test-compile && node ./out/test/web/runTests.js",
81+
"test": "node ./out/test/runTests.js",
7982
"watch:esbuild": "node esbuild.mjs --watch",
8083
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
81-
"test-compile": "pnpm clean && tsc -p ./ && pnpm compile",
82-
"test": "node ./out/test/runTests.js",
83-
"version": "node ./scripts/version.mjs && git add CHANGELOG.md",
84-
"postversion": "git push origin main --tags",
85-
"chrome": "pnpm compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. .",
86-
"test:web": "pnpm test-compile && node ./out/test/web/runTests.js"
84+
"watch": "pnpm run --parallel watch:esbuild watch:tsc"
8785
},
8886
"devDependencies": {
8987
"@eslint/js": "^9.28.0",

scripts/clean.mjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)