diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 22b152310b..35c4552d94 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -3,13 +3,109 @@ import { defineConfig } from 'vitepress'; // https://vitepress.dev/reference/site-config export default defineConfig({ title: 'Vite+', - description: 'Vite+', + description: 'The Unified Toolchain for the Web', themeConfig: { // https://vitepress.dev/reference/default-theme-config - nav: [{ text: 'Home', link: '/' }], + nav: [ + { text: 'Home', link: '/' }, + { text: 'Get Started', link: '/guide/' }, + { + text: 'Resources', + items: [ + { text: 'Team', link: 'https://voidzero.dev/team' }, + { text: 'Blog', link: 'https://voidzero.dev/blog' }, + { text: 'Releases', link: 'https://github.com/voidzero-dev/vite-plus/releases' }, + { + items: [ + { + text: 'Awesome Vite+', + link: 'https://github.com/voidzero-dev/awesome-vite-plus', + }, + { + text: 'ViteConf', + link: 'https://viteconf.org', + }, + { + text: 'DEV Community', + link: 'https://dev.to/t/vite', + }, + { + text: 'Changelog', + link: 'https://github.com/voidzero-dev/vite-plus/releases', + }, + { + text: 'Contributing', + link: 'https://github.com/voidzero-dev/vite-plus/blob/main/CONTRIBUTING.md', + }, + ], + }, + ], + }, + ], - sidebar: [], + sidebar: { + '/guide/': [ + { + text: 'Introduction', + items: [ + { + text: 'Getting Started', + link: '/guide/', + }, + ], + }, + { + text: 'Guide', + items: [ + { + text: 'Features', + link: '/guide/features', + }, + { + text: 'Monorepo', + link: '/guide/monorepo', + }, + { + text: 'Testing', + link: '/guide/testing', + }, + { + text: 'Linting', + link: '/guide/linting', + }, + { + text: 'Formatting', + link: '/guide/formatting', + }, + { + text: 'Caching', + link: '/guide/caching', + }, + { + text: 'CLI', + link: '/guide/cli', + }, + ], + }, + ], + '/config/': [ + { + text: 'Config', + items: [ + { + text: 'Configuring Vite+', + link: '/config/', + }, + ], + }, + ], + '/changes/': [], + }, - socialLinks: [], + socialLinks: [ + { icon: 'github', link: 'https://github.com/voidzero-dev/vite-plus' }, + { icon: 'x', link: 'https://x.com/voidzerodev' }, + { icon: 'bluesky', link: 'https://bsky.app/profile/voidzero.dev' }, + ], }, }); diff --git a/docs/config/index.md b/docs/config/index.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/guide/caching.md b/docs/guide/caching.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/guide/index.md b/docs/guide/index.md new file mode 100644 index 0000000000..979d55e881 --- /dev/null +++ b/docs/guide/index.md @@ -0,0 +1,151 @@ +# Getting Started + +## Overview + +Vite+ is a unified toolchain for modern web development that extends Vite with powerful monorepo capabilities. It combines: + +- **Dev Server**: Vite's blazing-fast development experience with native ES modules and instant HMR +- **Build Tool**: Optimized production builds powered by Rolldown +- **Task Runner**: Intelligent monorepo task execution with caching and dependency resolution +- **Testing**: Built-in test runner with workspace support +- **Linting**: Integrated oxlint for fast code quality checks +- **Formatting**: Integrated oxfmt for consistent code formatting +- **Code Generation**: Scaffolding for new projects and monorepo workspaces +- **Dependency Management**: Integrated dependency management with pnpm, yarn, npm and bun(coming soon) + +All in a single, cohesive tool designed for scale, speed, and developer sanity. + +## Installation + +### Global CLI + +Add the following to your `~/.npmrc`: + +```ini +//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} +@voidzero-dev:registry=https://npm.pkg.github.com/ +``` + +Create a [classic personal access token](https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-permissions-for-package-registries) and install the global CLI: + +```bash +GITHUB_TOKEN= npm install -g @voidzero-dev/global +``` + +Using 1Password CLI: + +```bash +GITHUB_TOKEN=$(op read "op://YOUR_GITHUB_TOKEN_PATH") npm install -g @voidzero-dev/global +``` + +## Scaffolding Your First Vite+ Project + +Create a Vite+ project: + +```bash +vite gen +``` + +Follow the prompts to select your preferred framework and configuration. + +## Core Commands + +Vite+ provides built-in commands that work seamlessly in both single-package and monorepo setups: + +```bash +# Development +vite dev # Start dev server + +# Build +vite build # Build for production + +# Test +vite test # Run tests + +# Lint +vite lint # Lint code with oxlint +``` + +## Monorepo Task Execution + +Vite+ includes a powerful task runner for managing tasks across monorepo packages: + +### Run tasks recursively + +```bash +vite run build -r # Build all packages with topological ordering +vite run test -r # Test all packages +``` + +### Run tasks for specific packages + +```bash +vite run app#build web#build # Build specific packages +vite run @scope/*#test # Test all packages matching pattern +``` + +### Current package + +```bash +vite dev # Run dev script in current package +``` + +## Task Dependencies + +Tasks automatically respect dependencies: + +1. **Explicit dependencies** - Defined in `vite-task.json`: + +```json +{ + "tasks": { + "test": { + "command": "jest", + "dependsOn": ["build", "lint"] + } + } +} +``` + +2. **Implicit dependencies** - Based on `package.json` relationships when using `--topological` (default for `-r`): + - If package A depends on package B, then `A#build` automatically depends on `B#build` + +Disable topological ordering: + +```bash +vite run build -r --no-topological +``` + +## Intelligent Caching + +Vite+ caches task outputs to speed up repeated builds: + +- Automatically detects when inputs change +- Skips tasks when outputs are cached +- Shares cache across team members (when configured) + +View cache operations: + +```bash +vite run build -r --debug +``` + +## Next Steps + +- Learn more about [task configuration](/guide/tasks) +- Explore [caching strategies](/guide/caching) +- Set up [monorepo workspaces](/guide/monorepo) +- Customize [Vite+ configuration](/config/) + +## Community & Support + +Get help and stay updated: + +- [GitHub Issues](https://github.com/voidzero-dev/vite-plus/issues) +- [GitHub Discussions](https://github.com/voidzero-dev/vite-plus/discussions) + +--- + +::: tip Requirements +Vite+ requires Node.js 20.19+, 22.12+ or 24.12+ +::: diff --git a/docs/guide/monorepo.md b/docs/guide/monorepo.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/guide/tasks.md b/docs/guide/tasks.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/index.md b/docs/index.md index 764d619e01..0568245b1e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,15 +4,15 @@ layout: home hero: name: "Vite+" - text: "Vite+" - tagline: My great project tagline + text: "The Unified Toolchain for the Web" + tagline: "dev, build, test, lint, format, monorepo caching & more in a single dependency, build for scale, speed, and sanity" actions: - theme: brand - text: AAA - link: / + text: Get Started + link: /guide/ - theme: alt - text: BBB - link: / + text: GitHub + link: https://github.com/voidzero-dev/vite-plus features: - title: Feature A diff --git a/docs/package.json b/docs/package.json index 512147f774..9a1eeaa4d0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,10 +4,11 @@ "private": true, "scripts": { "dev": "vitepress dev", - "build": "vitepress build", - "preview": "vitepress preview" + "build": "vite doc build", + "preview": "vite doc preview" }, "devDependencies": { + "@voidzero-dev/vite-plus": "workspace:*", "vue": "catalog:", "vitepress": "catalog:", "oxc-minify": "catalog:" diff --git a/package.json b/package.json index 0fb823217c..af91e21adc 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "lint": "vite lint --type-aware --threads 4", "test": "vite test run && pnpm -r snap-test", "test:unit": "vite test run", + "docs:dev": "vite run vite-docs#dev", "prepare": "husky" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7279fc954e..8bc549bcd8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -316,6 +316,9 @@ importers: docs: devDependencies: + '@voidzero-dev/vite-plus': + specifier: workspace:* + version: link:../packages/cli oxc-minify: specifier: 'catalog:' version: 0.107.0