Skip to content

Scripts & Development Workflow

Scripts Overview

Development

CommandDescription
pnpm devStart both main extension and Webview editor in watch mode
pnpm main:devStart main extension Webpack watch mode only
pnpm editor:devStart Webview editor Vite watch mode only
pnpm i18n:devWatch locales/ directory changes, auto-recompile plugin's own i18n files

Build

CommandDescription
pnpm buildFull build: clean dist → compile i18n → Webpack bundle → Vite build Webview → post-process
pnpm main:buildWebpack bundle main extension only, outputs extension.js
pnpm editor:buildVite build Webview editor only, outputs to res/editor/
pnpm i18n:buildCompile plugin's own i18n translation files
pnpm vsce:packFull build + package as .vsix file

Testing

CommandDescription
pnpm testRun unit tests (equivalent to test:unit)
pnpm test:unitRun unit tests under test/unit/ using ts-mocha
pnpm test:updateRun unit tests and update all snapshots
pnpm test:e2eRun E2E tests under test/e2e/ in real VS Code environment
pnpm test:e2e:updateRun E2E tests and update all snapshots
pnpm test:fixtureRun string extraction fixture integration tests (only runs reliably in GitHub Actions; may fail locally due to VS Code instance timing issues)

Release

CommandDescription
pnpm releaseFull release flow: build → bump patch version → package vsix
pnpm release:patchBump patch version with standard-version and push tags
pnpm release:minorBump minor version with standard-version and push tags

Others

CommandDescription
pnpm lintESLint check
pnpm lint:fixESLint auto-fix
pnpm docs:devStart documentation site dev server
pnpm docs:buildBuild documentation site

Daily Development Workflow

1. Start Development Environment

bash
pnpm dev

Then press F5 in VS Code to launch the Extension Development Host.

2. Test After Code Changes

bash
pnpm test:unit

# If snapshot-related logic changed, update snapshots
pnpm test:update

3. Package and Install Locally

bash
pnpm vsce:pack

# Install to current IDE
code --install-extension ./i18n-ally-next-*.vsix --force

4. Submitting a Pull Request

When submitting a PR, please ensure you use the provided Pull Request template and meet the following requirements:

  1. AI Assistance: Clearly state the proportion of AI-generated/assisted code.
  2. Type: Specify whether the PR is a fix (bug fix) or feat (new feature).
  3. Examples & Tests:
    • If adding a new framework or feature, provide relevant examples and unit/e2e tests.
    • If fixing a bug, add a reproducible fixture in examples/by-fixtures/issue-<n> and a corresponding E2E test in test/e2e/fixtures/issue-<n>.
  4. Documentation: Update the relevant documentation in docs/ if your PR changes any user-facing features or developer guidelines.

5. AI PR Review (GitHub Copilot)

We recommend using GitHub Copilot to assist in the PR code review workflow.

After submitting a Pull Request, maintainers can assign Copilot as a reviewer to automatically analyze the PR, ensure it meets our contribution guidelines, and check for any potential issues.

6. Release a New Version

bash
pnpm release

Environment Variables

VariableValuesDescription
I18N_ALLY_ENVproduction / development / testControls build mode and runtime behavior
CHAI_JEST_SNAPSHOT_UPDATE_ALLtrueWhen set, running tests will auto-update all snapshots

Released under the MIT License.