UNPKG

@orchard9ai/create-vite-vike-tauri

Version:
266 lines (193 loc) โ€ข 7.05 kB
# @orchard9ai/create-vite-vike-tauri > Create modern Vite + Vike + Tauri applications with Orchard9 design system [![npm version](https://img.shields.io/npm/v/@orchard9ai/create-vite-vike-tauri.svg)](https://www.npmjs.com/package/@orchard9ai/create-vite-vike-tauri) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) ## ๐Ÿš€ Quick Start Create a new Tauri application with a single command: ```bash npx @orchard9ai/create-vite-vike-tauri@latest ``` Or with a project name: ```bash npx @orchard9ai/create-vite-vike-tauri my-app ``` ## ๐Ÿ“‹ Prerequisites Before using this generator, ensure you have: - **Node.js** 18.0.0 or higher - **pnpm** (will be installed automatically if missing) - **Rust** 1.82.0 or higher (for Tauri) - **Platform Tools** (optional): - **macOS**: Xcode for iOS development - **All platforms**: Android Studio for Android development ## ๐ŸŽฏ Features - โšก **Vite** - Lightning fast build tool - ๐Ÿš€ **Vike** - Flexible SSR framework with multi-page routing and error pages - ๐Ÿฆ€ **Tauri 2.0** - Build smaller, faster, more secure apps - ๐ŸŽจ **Orchard9 Design System** - Pre-configured Grove themes with theme switching - ๐ŸŽฏ **TypeScript** - Type-safe by default - ๐ŸŽจ **TailwindCSS v4** - Modern CSS framework with DaisyUI-style utilities - ๐Ÿ“ฑ **Mobile Support** - iOS and Android (optional) - ๐Ÿงช **Testing Setup** - Vitest pre-configured - โ™ฟ **Accessibility** - Focus states, skip navigation, ARIA compliance - ๐Ÿ” **SEO Ready** - Interactive SEO setup with meta tags, Open Graph, Twitter Cards - ๐Ÿ”ง **Best Practices** - ESLint, Prettier, Husky ## ๐Ÿ› ๏ธ Options ### Interactive Mode Simply run the command and follow the prompts: ```bash npx @orchard9ai/create-vite-vike-tauri ``` ### Command Line Options ```bash npx @orchard9ai/create-vite-vike-tauri my-app [options] Options: --vike Add Vike SSR support --mobile Add iOS/Android support --skip-install Skip dependency installation --skip-git Skip git initialization --dry-run Preview without creating files --pnpm Use pnpm (default) --npm Use npm --yarn Use yarn -h, --help Display help -V, --version Display version ``` ## ๐Ÿ“ Generated Project Structure ``` my-app/ โ”œโ”€โ”€ src/ # Application source code โ”‚ โ”œโ”€โ”€ components/ # React components โ”‚ โ”‚ โ”œโ”€โ”€ SplashScreen.tsx # Loading splash screen โ”‚ โ”‚ โ”œโ”€โ”€ WelcomeScreen.tsx # Welcome screen โ”‚ โ”‚ โ””โ”€โ”€ Navigation.tsx # Main navigation (if Vike) โ”‚ โ”œโ”€โ”€ hooks/ # Custom React hooks โ”‚ โ”œโ”€โ”€ pages/ # Page components (if Vike) โ”‚ โ”‚ โ”œโ”€โ”€ +Layout.tsx # Root layout with theme provider โ”‚ โ”‚ โ”œโ”€โ”€ index/ # Landing page โ”‚ โ”‚ โ”œโ”€โ”€ about/ # About page โ”‚ โ”‚ โ””โ”€โ”€ terms/ # Terms page โ”‚ โ”œโ”€โ”€ stores/ # State management (Zustand) โ”‚ โ”œโ”€โ”€ styles/ # Global styles โ”‚ โ”œโ”€โ”€ utils/ # Utility functions โ”‚ โ”œโ”€โ”€ App.tsx # Main app component โ”‚ โ””โ”€โ”€ main.tsx # Application entry point โ”œโ”€โ”€ src-tauri/ # Tauri backend (Rust) โ”‚ โ”œโ”€โ”€ src/ # Rust source code โ”‚ โ”œโ”€โ”€ capabilities/ # Tauri permissions โ”‚ โ”œโ”€โ”€ icons/ # App icons โ”‚ โ”œโ”€โ”€ Cargo.toml # Rust dependencies โ”‚ โ””โ”€โ”€ tauri.conf.json # Tauri configuration โ”œโ”€โ”€ public/ # Static assets โ”œโ”€โ”€ index.html # HTML entry point โ”œโ”€โ”€ package.json # Node.js dependencies โ”œโ”€โ”€ tsconfig.json # TypeScript config โ”œโ”€โ”€ vite.config.ts # Vite configuration โ”œโ”€โ”€ tailwind.config.js # TailwindCSS config โ”œโ”€โ”€ .gitignore # Git ignore rules โ””โ”€โ”€ README.md # Project documentation ``` ## ๐Ÿƒ Development Workflow After creating your project: ```bash # Navigate to project cd my-app # Start development server pnpm tauri:dev # Run tests pnpm test # Build for production pnpm tauri:build ``` ### Mobile Development If you added mobile support: ```bash # iOS development (macOS only) pnpm tauri:ios dev # Android development pnpm tauri:android dev ``` ## ๐ŸŽจ Included Features ### Orchard9 Design System - Pre-configured Grove Light/Dark themes with automatic persistence - Theme switching with onThemeChange callbacks - TailwindCSS v4 with DaisyUI-style utilities - Comprehensive accessibility with focus-visible states - Loading state patterns and splash screen - Skip navigation for screen readers ### SEO & Performance - Interactive SEO configuration during project setup - Page-specific meta tags for title and description - Open Graph tags for social media sharing - Twitter Card support for Twitter sharing - Structured favicon and theme color setup - Custom error pages (404 and application errors) - Search engine optimization with robots meta tags ### Development Tools - **TypeScript** - Full type safety - **Vitest** - Fast unit testing - **ESLint** - Code linting - **Prettier** - Code formatting - **Husky** - Git hooks ### Tauri Features - Secure CSP configuration - Shell plugin for system operations - Logging utilities - Platform detection - Hot module replacement ## ๐Ÿ”ง Configuration ### Environment Variables Create a `.env` file for configuration: ```env VITE_API_URL=https://api.example.com VITE_APP_TITLE=My Tauri App ``` ### Tauri Configuration Edit `src-tauri/tauri.conf.json` for: - Window settings - Security policies - Bundle configuration - App metadata ## ๐Ÿ› Troubleshooting ### Common Issues 1. **Rust not found** ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` 2. **Node version too old** ```bash # Install Node 18+ via nvm nvm install 18 nvm use 18 ``` 3. **Mobile build fails** - iOS: Ensure Xcode is installed and updated - Android: Set `ANDROID_HOME` environment variable ### Debug Mode Run with debug output: ```bash DEBUG=* npx @orchard9ai/create-vite-vike-tauri my-app ``` ## ๐Ÿ“š Examples ### Basic Desktop App ```bash npx @orchard9ai/create-vite-vike-tauri desktop-app ``` ### SSR-Enabled App ```bash npx @orchard9ai/create-vite-vike-tauri ssr-app --vike ``` ### Full-Featured Mobile App ```bash npx @orchard9ai/create-vite-vike-tauri mobile-app --vike --mobile ``` ## ๐Ÿค Contributing Contributions are welcome! Please read our [Contributing Guide](../../CONTRIBUTING.md) for details. ## ๐Ÿ“„ License MIT ยฉ Orchard9 ## ๐Ÿ”— Links - [Tauri Documentation](https://tauri.app/) - [Vike Documentation](https://vike.dev/) - [Vite Documentation](https://vitejs.dev/) - [Orchard9 Design System](https://github.com/orchard9ai/design-system) --- Built with โค๏ธ by the Orchard9 team