diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 74fe338bb..3854ccd57 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -40,19 +40,17 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Bun - uses: oven-sh/setup-bun@v2 + - name: Setup Vite+ + uses: voidzero-dev/setup-vp@v1 with: - bun-version: latest - - - name: Install - run: bun install --frozen-lockfile + node-version-file: '.nvmrc' + cache: true - name: Build for Staging - run: bun run build:staging + run: vp run build:staging - name: Build for Production - run: bun run build:prod + run: vp run build:prod - name: Authenticate to Google Cloud uses: google-github-actions/auth@v1 @@ -69,7 +67,7 @@ jobs: - name: Get version id: get_version run: | - SDK_VERSION=$(bun -e "console.log(require('./package.json').config.sdkVersion)") + SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion") if git rev-parse "$SDK_VERSION" >/dev/null 2>&1; then echo "Tag $SDK_VERSION already exists, skipping release" else diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8b8dfb47..5d5df45c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,24 +12,17 @@ jobs: - name: Checkout uses: actions/checkout@v5 - - name: Setup Node # Since Vitest uses Node apis - uses: actions/setup-node@v5 + - name: Setup Vite+ + uses: voidzero-dev/setup-vp@v1 with: node-version-file: '.nvmrc' + cache: true - - name: Bun Setup - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - - name: 'Install' - run: bun install - - - name: 'Check Build' - run: bun run build:prod + - name: Check Build + run: vp run build:prod - - name: 'Lint' - run: bun run lint + - name: Lint + run: vp run lint - - name: 'Test' - run: bun run test + - name: Test + run: vp run test diff --git a/.oxlintrc.json b/.oxlintrc.json deleted file mode 100644 index 67432f5bc..000000000 --- a/.oxlintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["typescript"], - "categories": {}, - "rules": {}, - "settings": { - "jsx-a11y": { - "polymorphicPropName": null, - "components": {}, - "attributes": {} - }, - "jsdoc": { - "ignorePrivate": false, - "ignoreInternal": false, - "ignoreReplacesDocs": true, - "overrideReplacesDocs": true, - "augmentsExtendsReplacesDocs": false, - "implementsReplacesDocs": false, - "exemptDestructuredRootsFromChecks": false, - "tagNamePreference": {} - }, - "vitest": { - "typecheck": false - } - }, - "env": { - "builtin": true - }, - "globals": {}, - "ignorePatterns": [] -} diff --git a/.prettierrc.cjs b/.prettierrc.cjs deleted file mode 100644 index 031030096..000000000 --- a/.prettierrc.cjs +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - bracketSpacing: true, - singleQuote: true, - trailingComma: 'all', -}; diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commit new file mode 100755 index 000000000..85fb65b4f --- /dev/null +++ b/.vite-hooks/pre-commit @@ -0,0 +1 @@ +vp staged diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d38391e3e..83d483f02 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,6 @@ { - "recommendations": ["esbenp.prettier-vscode", "jeff-hykin.macro-commander"] + "recommendations": [ + "jeff-hykin.macro-commander", + "void-zero.vite-plus-extension-pack" + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ee1cf0eb..086c5d58f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,10 @@ { "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", - "source.organizeImports": "always" + "source.organizeImports": "always", + "source.fixAll.oxc": "explicit" }, "editor.rename.enablePreview": false, - - // a macro to rename a variable to _variable "macros": { "rename_": [ { @@ -31,5 +30,9 @@ ] } ] - } + }, + "editor.defaultFormatter": "oxc.oxc-vscode", + "oxc.fmt.configPath": "./vite.config.ts", + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "file" } diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..f190a5234 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,76 @@ + + +# Using Vite+, the Unified Toolchain for the Web + +This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, but it invokes Vite through `vp dev` and `vp build`. + +## Vite+ Workflow + +`vp` is a global binary that handles the full development lifecycle. Run `vp help` to print a list of commands and `vp --help` for information about a specific command. + +### Start + +- create - Create a new project from a template +- migrate - Migrate an existing project to Vite+ +- config - Configure hooks and agent integration +- staged - Run linters on staged files +- install (`i`) - Install dependencies +- env - Manage Node.js versions + +### Develop + +- dev - Run the development server +- check - Run format, lint, and TypeScript type checks +- lint - Lint code +- fmt - Format code +- test - Run tests + +### Execute + +- run - Run monorepo tasks +- exec - Execute a command from local `node_modules/.bin` +- dlx - Execute a package binary without installing it as a dependency +- cache - Manage the task cache + +### Build + +- build - Build for production +- pack - Build libraries +- preview - Preview production build + +### Manage Dependencies + +Vite+ automatically detects and wraps the underlying package manager such as pnpm, npm, or Yarn through the `packageManager` field in `package.json` or package manager-specific lockfiles. + +- add - Add packages to dependencies +- remove (`rm`, `un`, `uninstall`) - Remove packages from dependencies +- update (`up`) - Update packages to latest versions +- dedupe - Deduplicate dependencies +- outdated - Check for outdated packages +- list (`ls`) - List installed packages +- why (`explain`) - Show why a package is installed +- info (`view`, `show`) - View package information from the registry +- link (`ln`) / unlink - Manage local package links +- pm - Forward a command to the package manager + +### Maintain + +- upgrade - Update `vp` itself to the latest version + +These commands map to their corresponding tools. For example, `vp dev --port 3000` runs Vite's dev server and works the same as Vite. `vp test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vp --version`. This is useful when researching documentation, features, and bugs. + +## Common Pitfalls + +- **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations. +- **Always use Vite commands to run tools:** Don't attempt to run `vp vitest` or `vp oxlint`. They do not exist. Use `vp test` and `vp lint` instead. +- **Running scripts:** Vite+ built-in commands (`vp dev`, `vp build`, `vp test`, etc.) always run the Vite+ built-in tool, not any `package.json` script of the same name. To run a custom script that shares a name with a built-in command, use `vp run