Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .changeset/clever-rings-double.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 0 additions & 3 deletions .config/.oxfmtrc.json

This file was deleted.

34 changes: 0 additions & 34 deletions .config/turbo.jsonc

This file was deleted.

10 changes: 4 additions & 6 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 7 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ concurrency:

env:
FORCE_COLOR: 3
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}

jobs:
check:
Expand All @@ -23,25 +21,24 @@ 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
steps:
- 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
10 changes: 4 additions & 6 deletions .github/workflows/release-canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
- main

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: 3

jobs:
release:
Expand All @@ -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
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
branches:
- main

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

jobs:
release:
name: Release
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dist
.next
.nuxt
.output
.turbo
.vite-build
.vercel
.DS_Store

Expand Down
1 change: 1 addition & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 4 additions & 1 deletion .config/.oxlintrc.json → .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../node_modules/oxlint/configuration_schema.json",
"ignorePatterns": [".vite-build/**"],
"plugins": ["typescript", "import"],
"categories": {
"correctness": "warn",
Expand All @@ -8,6 +8,9 @@
"env": {
"builtin": true
},
"options": {
"reportUnusedDisableDirectives": "error"
},
"rules": {
"eslint/prefer-rest-params": "warn",
"eslint/no-case-declarations": "warn",
Expand Down
1 change: 1 addition & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vp staged
88 changes: 88 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!--VITE PLUS START-->

# 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 <command> --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 <script>`. For example, if you have a custom `dev` script that runs multiple services concurrently, run it with `vp run dev`, not `vp dev` (which always starts Vite's dev server).
- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. They must not be installed directly. You cannot upgrade these tools by installing their latest versions. Always use Vite+ commands.
- **Use Vite+ wrappers for one-off binaries:** Use `vp dlx` instead of package-manager-specific `dlx`/`npx` commands.
- **Import JavaScript modules from `vite-plus`:** Instead of importing from `vite` or `vitest`, all modules should be imported from the project's `vite-plus` dependency. For example, `import { defineConfig } from 'vite-plus';` or `import { expect, test, vi } from 'vite-plus/test';`. You must not install `vitest` to import test utilities.
- **Type-Aware Linting:** There is no need to install `oxlint-tsgolint`, `vp lint --type-aware` works out of the box.

## CI Integration

For GitHub Actions, consider using [`voidzero-dev/setup-vp`](https://github.com/voidzero-dev/setup-vp) to replace separate `actions/setup-node`, package-manager setup, cache, and install steps with a single action.

```yaml
- uses: voidzero-dev/setup-vp@v1
with:
cache: true
- run: vp check
- run: vp test
```

## Review Checklist for Agents

- [ ] Run `vp install` after pulling remote changes and before getting started.
- [ ] Run `vp check` and `vp test` to validate changes.
<!--VITE PLUS END-->
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export const GET = (req: Request) => {

## Contributing

This project uses [Bun](https://bun.sh) as its package manager. To install:
This project uses [Vite+](https://viteplus.dev) as its unified toolchain and Bun as the package manager declared in `packageManager`.

```sh
# Linux & macOS
curl -fsSL https://bun.sh/install | bash
curl -fsSL https://vite.plus | bash

# Windows
powershell -c "irm bun.sh/install.ps1 | iex"
powershell -c "irm https://vite.plus/ps1 | iex"
```

To get started, clone the repo:
Expand All @@ -113,7 +113,7 @@ Then, install the project dependencies:

```sh
cd t3-env
bun i
vp install
```

Checkout a feature branch for the change you're about to make:
Expand All @@ -127,15 +127,15 @@ Implement your changes, then submit a [Pull Request](https://docs.github.com/en/
### General Guidelines

- When developing changes, checkout a feature branch. **DO NOT** create pull requests from your main branch as these are sometimes protected from maintainer edits.
- Start the build watchers using `bun run dev`. This will recompile the necessary packages whenever you make changes.
- Start the build watchers using `vp run dev`. Vite Task runs the package builds recursively in workspace dependency order whenever you make changes.
- Make as many changes as possible in the [core](./packages/core) package, re-export framework specific code from the respective package.
- Add tests (both runtime and types) to verify your changes.
- Add a changeset using `bun changeset` to ensure your changes trigger a release with appropriate changelog.
- Add a changeset using `vp exec changeset` to ensure your changes trigger a release with appropriate changelog.

### When it's time to commit

- Run the linters using `bun lint` (`bun lint:fix` to fix auto-fixable issues)
- Run the tests using `bun run test`. Alternatively, you can use the test explorer in VSCode to target individual tests.
- Run static checks using `vp check` (`vp run lint:fix` to apply lint and formatting fixes)
- Run the tests using `vp test`. Alternatively, you can use the test explorer in VSCode to target individual tests.
- Commit with whatever commit message you want. We squash PRs so the individual commit messages does not matter.
- For bug fixes, it's a good practise to first add a failing regression test in one commit, and then implement the fix in another. This helps the review process as it's easy to see what was failing before, and how it succeeded after your change.
- Add a pull request description explaining your changes. Link any relevant issues (e.g. by including `Closes #123` in the description).
Expand Down
Loading
Loading