Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,13 @@ updates:
update-types:
- minor
- patch
# Group TypeScript-related packages
typescript:
patterns:
- "typescript"
- "@types/*"
update-types:
- minor
- patch
# Group webpack and build tools
build-tools:
patterns:
- "webpack*"
- "*-loader"
- "ts-loader"
update-types:
- minor
- patch
# Group testing packages
testing:
patterns:
- "@vscode/test-*"
- "mocha"
- "glob"
update-types:
- minor
- patch
# Group ESLint and linting packages
linting:
patterns:
- "eslint"
- "eslint-*"
- "@eslint/*"
- "@typescript-eslint/*"
- "typescript-eslint"
update-types:
- minor
- patch
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: test-compile"
"preLaunchTask": "npm: compile:test"
},
{
"name": "Run Web Extension",
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pnpm test
pnpm test:web

# Compile tests only
pnpm test-compile
pnpm compile:test
```

## Running Tests
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Thank you for your interest in contributing to the Prettier VS Code extension! F
```bash
pnpm install # Install dependencies
pnpm compile # Build for development (esbuild + type checking)
pnpm compile:test # Compile tests only
pnpm watch # Build and watch for changes
pnpm lint # Run ESLint
pnpm prettier # Format code with Prettier
pnpm test # Run tests
pnpm test-compile # Compile tests only
```

### Running the Extension
Expand Down
93 changes: 46 additions & 47 deletions docs/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,98 +16,97 @@ Publishing is automated via GitHub Actions. When you push a tag starting with `v
- Write access to the repository
- `MARKETPLACE_TOKEN` secret configured in GitHub (for automated publishing)

## Release Commands

All releases are handled through the `pnpm release` command:

```bash
# Patch release (bug fixes): 11.0.0 → 11.0.1
pnpm release patch

# Minor release (new features): 11.0.0 → 11.1.0
pnpm release minor

# Major release (breaking changes): 11.0.0 → 12.0.0
pnpm release major

# Preview release: 11.0.0 → 11.1.0-preview.1
pnpm release preview
```

## Version Types

| Type | Example | When to Use |
| ---------- | ------------------- | --------------------------------- |
| Major | `11.0.0` → `12.0.0` | Breaking changes |
| Minor | `11.0.0` → `11.1.0` | New features, backward compatible |
| Patch | `11.0.0` → `11.0.1` | Bug fixes |
| Prerelease | `12.0.0-preview.1` | Testing before stable release |
| Type | Command | Example |
| ------- | ---------------------- | ----------------------------- |
| Major | `pnpm release major` | `11.0.0` → `12.0.0` |
| Minor | `pnpm release minor` | `11.0.0` → `11.1.0` |
| Patch | `pnpm release patch` | `11.0.0` → `11.0.1` |
| Preview | `pnpm release preview` | `11.0.0` → `11.1.0-preview.1` |

## Publishing a Stable Release

### 1. Update the Changelog

Add your changes under the `[unreleased]` section in `CHANGELOG.md` as you make changes:
Add your changes under the `[Unreleased]` section in `CHANGELOG.md` as you make changes:

```markdown
## [unreleased]
## [Unreleased]

- Added new feature X
- Fixed bug Y
```

### 2. Bump the Version

Run one of these commands depending on the release type:
### 2. Run the Release Command

```bash
# Patch release (bug fixes): 11.0.0 → 11.0.1
npm version patch

# Minor release (new features): 11.0.0 → 11.1.0
npm version minor

# Major release (breaking changes): 11.0.0 → 12.0.0
npm version major
pnpm release patch # or minor, major
```

This automatically:

1. Updates `version` in `package.json`
2. Runs the `version` script which updates `CHANGELOG.md` (converts `[unreleased]` to the new version number)
3. Stages both `package.json` and `CHANGELOG.md`
1. Calculates the new version number
2. Updates `version` in `package.json`
3. Updates `CHANGELOG.md` (converts `[Unreleased]` to the new version)
4. Creates a git commit with message `v<version>`
5. Creates a git tag `v<version>`
6. Pushes the commit and tag to origin (via `postversion` script)
6. Pushes the commit and tag to origin

The GitHub Actions workflow will then automatically:

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

## Publishing a Prerelease
## Publishing a Preview Release

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

### 1. Bump to a Prerelease Version
### Creating a Preview

```bash
# First prerelease for a new major version: 11.0.0 → 12.0.0-preview.0
npm version premajor

# First prerelease for a new minor version: 11.0.0 → 11.1.0-preview.0
npm version preminor

# First prerelease for a patch: 11.0.0 → 11.0.1-preview.0
npm version prepatch
# First preview (from stable): 11.0.0 → 11.1.0-preview.1
pnpm release preview

# Increment existing prerelease: 12.0.0-preview.012.0.0-preview.1
npm version prerelease
# Subsequent previews: 11.1.0-preview.111.1.0-preview.2
pnpm release preview
```

> The `.npmrc` file configures `preview` as the default prerelease identifier.

> **Note:** The version script automatically skips changelog updates for prereleases. The `[unreleased]` section is preserved until the final stable release.

The commit and tag are automatically pushed. The workflow detects prerelease tags (containing `-preview`, `-beta`, `-alpha`, or `-rc`) and:
The workflow detects preview tags and:

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

### 2. Promote to Stable
### Promoting to Stable

When ready to release the stable version:

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

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

## Manual Publishing (Emergency)

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

# Fix version and re-tag (will push automatically)
npm version 12.0.0
# Re-run the release
pnpm release minor # or appropriate type
```
24 changes: 21 additions & 3 deletions esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import path from "path";
const production = process.argv.includes("--production");
const watch = process.argv.includes("--watch");

// Clean dist directory (skip in watch mode)
if (!watch) {
if (fs.existsSync("dist")) {
fs.rmSync("dist", { recursive: true, force: true });
}
}

const extensionPackage = JSON.parse(
fs.readFileSync(new URL("./package.json", import.meta.url), "utf-8"),
);
Expand Down Expand Up @@ -47,7 +54,11 @@ const browserAliasPlugin = {
},
};

// Node extension configuration

/**
* Node extension configuration
* @type {import('esbuild').BuildOptions}
*/
const nodeConfig = {
entryPoints: ["src/extension.ts"],
bundle: true,
Expand Down Expand Up @@ -89,7 +100,11 @@ const browserShimsPlugin = {
},
};

// Browser/web extension configuration

/**
* Browser/web extension configurationn
* @type {import('esbuild').BuildOptions}
*/
const browserConfig = {
entryPoints: ["src/extension.ts"],
bundle: true,
Expand Down Expand Up @@ -122,7 +137,10 @@ const browserConfig = {
],
};

// Web test bundle configuration
/**
* Web test bundle configuration
* @type {import('esbuild').BuildOptions}
*/
const webTestConfig = {
entryPoints: ["src/test/web/suite/index.ts"],
bundle: true,
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,19 @@
"main": "./dist/extension",
"browser": "./dist/web-extension",
"scripts": {
"clean": "node ./scripts/clean.mjs",
"compile:test": "tsc -p ./ && node esbuild.mjs",
"check-types": "tsc --noEmit",
"chrome": "pnpm compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. .",
"compile": "pnpm check-types && node esbuild.mjs",
"lint": "eslint src *.mjs scripts",
"pretest": "pnpm test-compile && node scripts/install-fixtures.mjs",
"pretest": "pnpm compile:test && node scripts/install-fixtures.mjs",
"prettier": "prettier --write .",
"compile": "pnpm check-types && node esbuild.mjs",
"check-types": "tsc --noEmit",
"watch": "pnpm run --parallel watch:esbuild watch:tsc",
"release": "node ./scripts/release.mjs",
"test:web": "pnpm compile:test && node ./out/test/web/runTests.js",
"test": "node ./out/test/runTests.js",
"watch:esbuild": "node esbuild.mjs --watch",
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
"test-compile": "pnpm clean && tsc -p ./ && pnpm compile",
"test": "node ./out/test/runTests.js",
"version": "node ./scripts/version.mjs && git add CHANGELOG.md",
"postversion": "git push origin main --tags",
"chrome": "pnpm compile && vscode-test-web --browserType=chromium --extensionDevelopmentPath=. .",
"test:web": "pnpm test-compile && node ./out/test/web/runTests.js"
"watch": "pnpm run --parallel watch:esbuild watch:tsc"
},
"devDependencies": {
"@eslint/js": "^9.28.0",
Expand All @@ -110,7 +108,7 @@
"process": "^0.11.10",
"sinon": "^17.0.1",
"tmp": "^0.2.3",
"typescript": "^4.6.3",
"typescript": "^5.9.3",
"typescript-eslint": "^8.33.0",
"util": "^0.12.4"
},
Expand Down
Loading