From 296d1338b51efc71a9259e5cdac7559be6f46d6f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 1 Apr 2026 02:16:21 +0000 Subject: [PATCH 1/3] chore: migrate workspace to vite plus Co-authored-by: Julius Marminge --- .changeset/clever-rings-double.md | 7 + .config/.oxfmtrc.json | 3 - .github/setup/action.yml | 10 +- .github/workflows/ci.yml | 17 +- .github/workflows/release-canary.yaml | 10 +- .github/workflows/release.yml | 14 +- .gitignore | 1 + .oxfmtrc.json | 1 + .config/.oxlintrc.json => .oxlintrc.json | 5 +- .vite-hooks/pre-commit | 1 + AGENTS.md | 88 ++++++ README.md | 16 +- bun.lock | 381 +++++++++-------------- package.json | 27 +- packages/core/package.json | 6 +- packages/core/test/smoke-arktype.test.ts | 2 +- packages/core/test/smoke-valibot.test.ts | 2 +- packages/core/test/smoke-zod3.test.ts | 2 +- packages/core/test/smoke-zod4.test.ts | 2 +- packages/core/vite.config.ts | 18 ++ packages/nextjs/package.json | 6 +- packages/nextjs/test/smoke.test.ts | 2 +- packages/nextjs/vite.config.ts | 29 ++ packages/nuxt/package.json | 6 +- packages/nuxt/vite.config.ts | 18 ++ scripts/vp-build-entry.ts | 4 + vite.config.ts | 49 +++ 27 files changed, 418 insertions(+), 309 deletions(-) create mode 100644 .changeset/clever-rings-double.md delete mode 100644 .config/.oxfmtrc.json create mode 100644 .oxfmtrc.json rename .config/.oxlintrc.json => .oxlintrc.json (89%) create mode 100755 .vite-hooks/pre-commit create mode 100644 AGENTS.md create mode 100644 packages/core/vite.config.ts create mode 100644 packages/nextjs/vite.config.ts create mode 100644 packages/nuxt/vite.config.ts create mode 100644 scripts/vp-build-entry.ts create mode 100644 vite.config.ts diff --git a/.changeset/clever-rings-double.md b/.changeset/clever-rings-double.md new file mode 100644 index 00000000..82b88fd1 --- /dev/null +++ b/.changeset/clever-rings-double.md @@ -0,0 +1,7 @@ +--- +"@t3-oss/env-core": patch +"@t3-oss/env-nextjs": patch +"@t3-oss/env-nuxt": patch +--- + +Migrate the monorepo to Vite+ by switching root workflows to `vp`, rewriting Vitest imports to `vite-plus/test`, and moving library packaging config into package-local `vite.config.ts` files. diff --git a/.config/.oxfmtrc.json b/.config/.oxfmtrc.json deleted file mode 100644 index c8717300..00000000 --- a/.config/.oxfmtrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ignorePatterns": [] -} diff --git a/.github/setup/action.yml b/.github/setup/action.yml index 1c4359a9..a7e7d6d8 100644 --- a/.github/setup/action.yml +++ b/.github/setup/action.yml @@ -1,15 +1,13 @@ name: Setup Workflow -description: Composite action that sets up bun and installs dependencies +description: Composite action that sets up Vite+ and installs dependencies runs: using: "composite" steps: - - uses: actions/setup-node@v6 + - uses: voidzero-dev/setup-vp@v1 with: - node-version-file: package.json - + cache: true - uses: oven-sh/setup-bun@v2 with: bun-version-file: package.json - - - run: bun install + - run: vp install shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77a11a15..856db4fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ concurrency: env: FORCE_COLOR: 3 - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} jobs: check: @@ -23,19 +21,18 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - uses: ./.github/setup - - run: bun turbo build --filter=@t3-oss/env* - - run: bun lint - - run: bun fmt --check + - run: vp check + - run: vp build sherif: runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v6 - - uses: oven-sh/setup-bun@v2 + - uses: voidzero-dev/setup-vp@v1 with: - bun-version-file: package.json - - run: bunx sherif@1.9.0 + cache: true + - run: vp dlx sherif@1.9.0 test: runs-on: ubuntu-latest @@ -43,5 +40,5 @@ jobs: - name: Checkout repo uses: actions/checkout@v6 - uses: ./.github/setup - - run: bun run build --filter=@t3-oss/env* - - run: bun run test + - run: vp build + - run: vp test diff --git a/.github/workflows/release-canary.yaml b/.github/workflows/release-canary.yaml index 00c4c9bb..5b910803 100644 --- a/.github/workflows/release-canary.yaml +++ b/.github/workflows/release-canary.yaml @@ -7,8 +7,7 @@ on: - main env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} + FORCE_COLOR: 3 jobs: release: @@ -25,17 +24,16 @@ jobs: - name: Checkout repo uses: actions/checkout@v6 - uses: ./.github/setup - - run: bun lint - - run: bun fmt --check + - run: vp check - name: Build - run: bun run build + run: vp run build - name: Authenticate to npm run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc - name: Publish - run: bun run scripts/canary.ts + run: bun scripts/canary.ts - name: Create a new comment notifying of the new canary version uses: actions/github-script@v8 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf8f0343..3d738fe3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,10 +4,6 @@ on: branches: - main -env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - jobs: release: name: Release @@ -23,9 +19,9 @@ jobs: - uses: ./.github/setup - name: Build - run: bun run build + run: vp run build - - run: bun add -g npm@latest + - run: vp env exec --node 24 npm install -g npm@latest # Using custom token `MY_GITHUB_TOKEN` with more access to avoid rate limiting - name: Create Release @@ -34,8 +30,8 @@ jobs: with: commit: "chore(release): 📦 version packages" title: "chore(release): 📦 version packages" - publish: bun run scripts/publish.ts - version: bun run scripts/version.ts + publish: bun scripts/publish.ts + version: bun scripts/version.ts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_CONFIG_PROVENANCE: true @@ -46,7 +42,7 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" git checkout changeset-release/main - bun fmt + vp fmt . --write git add . # Check if there are staged changes before committing and pushing if ! git diff --staged --quiet; then diff --git a/.gitignore b/.gitignore index 780905ec..067cc63e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ dist .next .nuxt .output +.vite-build .turbo .vercel .DS_Store diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1 @@ +{} diff --git a/.config/.oxlintrc.json b/.oxlintrc.json similarity index 89% rename from .config/.oxlintrc.json rename to .oxlintrc.json index 4385f6ad..79e5c57f 100644 --- a/.config/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,5 +1,5 @@ { - "$schema": "../node_modules/oxlint/configuration_schema.json", + "ignorePatterns": [".vite-build/**"], "plugins": ["typescript", "import"], "categories": { "correctness": "warn", @@ -8,6 +8,9 @@ "env": { "builtin": true }, + "options": { + "reportUnusedDisableDirectives": "error" + }, "rules": { "eslint/prefer-rest-params": "warn", "eslint/no-case-declarations": "warn", diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commit new file mode 100755 index 00000000..85fb65b4 --- /dev/null +++ b/.vite-hooks/pre-commit @@ -0,0 +1 @@ +vp staged diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..adfdf836 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,88 @@ + + +# 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