UNPKG

vitesse-dependency-scripts

Version:

Automated toolkit for managing dependencies with pnpm catalogs in Vue/Vite projects

337 lines (256 loc) β€’ 9.45 kB
# Which Script Should I Use? πŸ€” Quick guide to help you choose the right script for your needs. --- ## 🎯 Quick Decision Tree ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ What do you need to do? β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ NEW PROJECT UPDATE EXISTING β”‚ β”‚ β–Ό β–Ό β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ auto-update- β”‚ β”‚ β”‚ full.js β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Updates deps in β”‚ β”‚ β”‚ current project β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Do you needβ”‚ β”‚ LATEST β”‚ β”‚ versions? β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”΄β”€β”€β”€β” YES NO β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ ⭐ create- β”‚ β”‚ create- β”‚ β”‚ project- β”‚ β”‚ vitesse- β”‚ β”‚ instant.js β”‚ β”‚ project.js β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ RECOMMENDED! β”‚ β”‚ Basic setup β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ“Š Feature Comparison | Feature | create-project-instant.js ⚑ | create-vitesse-project.js | auto-update-full.js | |---------|------------------------------|---------------------------|---------------------| | **Creates new project** | βœ… | βœ… | ❌ | | **Updates existing project** | ❌ | ❌ | βœ… | | **Fetches latest npm versions** | βœ… Real-time | βœ… | βœ… Real-time | | **Enhanced console output** | ⭐ YES | Basic | Basic | | **Shows progress in real-time** | ⭐ YES | Basic | ⚠️ Limited | | **Displays timing** | ⭐ YES | ❌ | ❌ | | **Better error handling** | ⭐ YES | Basic | Basic | | **Skip detection** | ⭐ Detailed | Basic | Basic | | **Creates backups** | ❌ (new project) | ❌ (new project) | βœ… | | **Best for** | ⭐ New projects | Basic new projects | Existing projects | --- ## πŸš€ The Three Scripts Explained ### 1. ⚑ create-project-instant.js (RECOMMENDED for new projects) **What it does:** - Creates a new Vitesse project from scratch - Fetches the LATEST version of every package in real-time - Updates workspace catalogs with latest versions - Updates package.json with catalog references - Installs all dependencies - Shows beautiful, detailed progress **When to use:** - βœ… Starting a brand new project - βœ… You want the absolute latest versions - βœ… You want a polished user experience - βœ… You want to see detailed progress **Command:** ```bash node create-project-instant.js my-awesome-app ``` **Example output:** ``` πŸš€ Creating new Vitesse project: my-awesome-app πŸ“₯ Cloning Vitesse template... βœ… Project created at ./my-awesome-app πŸ“ Updating pnpm-workspace.yaml with latest versions... πŸ“¦ Processing 'frontend' catalog (20 packages)... πŸ” Fetching @casl/ability... ^6.7.1 βœ… @casl/ability: ^6.7.1 ... ⏱️ Total time: 52.1s πŸŽ‰ PROJECT READY! ``` --- ### 2. πŸ“¦ create-vitesse-project.js (Basic) **What it does:** - Creates a new Vitesse project from scratch - Fetches latest versions and adds dependencies - Updates workspace and package.json - Installs dependencies - Simpler, more basic output **When to use:** - βœ… Starting a new project - βœ… You're okay with basic console output - βœ… You don't need detailed progress **Command:** ```bash node create-vitesse-project.js my-app ``` **Difference from instant:** - Less detailed console output - No timing information - No enhanced progress indicators - Same functionality, simpler presentation --- ### 3. πŸ”„ auto-update-full.js (For existing projects) **What it does:** - Updates an EXISTING project - Fetches latest versions from npm - Updates pnpm-workspace.yaml - Updates package.json with catalog references - Runs pnpm install - Creates backups before modifying **When to use:** - βœ… You already have a project - βœ… You want to update to latest versions - βœ… You want to add new dependencies - βœ… You need backups of your files **Command:** ```bash node auto-update-full.js ``` **Important:** Run this FROM your project directory or the dependency-scripts folder. --- ## πŸ’‘ Common Scenarios ### Scenario 1: "I'm starting a brand new project" **Use:** `create-project-instant.js` ⚑ ```bash cd dependency-scripts node create-project-instant.js my-new-project cd ../my-new-project pnpm dev ``` **Why?** You get the best experience with latest versions and detailed progress. --- ### Scenario 2: "I'm starting a new project but I don't care about fancy output" **Use:** `create-vitesse-project.js` ```bash cd dependency-scripts node create-vitesse-project.js my-project cd ../my-project pnpm dev ``` **Why?** Simpler output, same result. --- ### Scenario 3: "I have an existing project and want to update dependencies" **Use:** `auto-update-full.js` ```bash cd dependency-scripts node auto-update-full.js ``` **Why?** This is designed specifically for updating existing projects. --- ### Scenario 4: "I have an existing project and want to add NEW dependencies" **Use:** `auto-update-full.js` 1. First, add the packages to the `DEPENDENCIES` object in the script 2. Then run: ```bash cd dependency-scripts node auto-update-full.js ``` --- ### Scenario 5: "I just want to test packages without the catalog system" **Use:** `install-missing-deps.sh` ```bash cd dependency-scripts ./install-missing-deps.sh ``` **Why?** Direct install, no catalog configuration. --- ## 🎨 Visual Comparison ### create-project-instant.js ⚑ ``` ╔═════════════════════════════════════════════╗ β•‘ πŸ•οΈ Vitesse Instant Project Creator β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• πŸš€ Creating new Vitesse project... πŸ“ Updating pnpm-workspace.yaml... πŸ“¦ Processing 'frontend' catalog (20 packages)... πŸ” Fetching @casl/ability... ^6.7.1 βœ… @casl/ability: ^6.7.1 ... ⏱️ Total time: 52.1s ═══════════════════════════════════════════════ πŸŽ‰ PROJECT READY! πŸŽ‰ ═══════════════════════════════════════════════ ``` ### create-vitesse-project.js ``` πŸš€ Creating new Vitesse project: my-app πŸ“₯ Cloning Vitesse template... βœ… Project created at ./my-app πŸ“ Updating pnpm-workspace.yaml... βœ… Workspace file updated! πŸ“ Updating package.json... βœ… Added 33 catalog references πŸ“¦ Installing dependencies... βœ… Dependencies installed successfully! πŸŽ‰ Project setup complete! ``` ### auto-update-full.js ``` πŸš€ Complete Auto Update - Workspace & Package.json πŸ“¦ Backups created: - pnpm-workspace.yaml.backup.1697123456789 - package.json.backup.1697123456789 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ“₯ Processing 'frontend' catalog... πŸ” Fetching @casl/ability... βœ… Adding to workspace: @casl/ability: ^6.7.1 ... ✨ Files updated successfully! πŸ“¦ Installing dependencies with pnpm... βœ… All done! ``` --- ## πŸ† Recommendations ### For Most Users **Use `create-project-instant.js`** when creating new projects. It provides: - βœ… Best user experience - βœ… Detailed progress - βœ… Latest versions - βœ… Clear feedback - βœ… Timing information ### For Advanced Users If you prefer simplicity and don't need fancy output, use `create-vitesse-project.js`. ### For Existing Projects Always use `auto-update-full.js` - it's the only one designed for updates. --- ## πŸ“ Summary | I want to... | Use this script | |--------------|-----------------| | Create a new project with best experience | `create-project-instant.js` ⭐ | | Create a new project (basic) | `create-vitesse-project.js` | | Update an existing project | `auto-update-full.js` | | Add new deps to existing project | `auto-update-full.js` | | Test packages without catalogs | `install-missing-deps.sh` | | Only update workspace file | `auto-update-catalog.js` | --- ## πŸ”— Learn More - [INSTANT-CREATE-README.md](./INSTANT-CREATE-README.md) - Detailed guide for create-project-instant.js - [CREATE-PROJECT-README.md](./CREATE-PROJECT-README.md) - Guide for create-vitesse-project.js - [AUTO-UPDATE-README.md](./AUTO-UPDATE-README.md) - Guide for auto-update-full.js - [README.md](./README.md) - Main documentation --- ## πŸ’¬ Still Confused? **Rule of thumb:** - **New project?** β†’ `create-project-instant.js` ⚑ - **Existing project?** β†’ `auto-update-full.js` That's it! πŸŽ‰