Documentation Index
Fetch the complete documentation index at: https://mintlify.com/queaxtra/zvelte/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Zvelte CLI allows you to initialize a project in your current working directory by using. (dot) as the project directory argument. This is useful when you’ve already created a directory and navigated into it, or when you want to merge the template into an existing workspace.
Basic Usage
Navigate to your desired directory and run:How It Works
When you use. as the project directory, Zvelte handles two scenarios differently:
Empty Directory
If the current directory is empty, Zvelte clones the template directly into it:Non-Empty Directory (Merge Mode)
If the current directory contains files, Zvelte uses a special merge strategy:Create Temporary Directory
Creates a temporary directory in your system’s temp folder (e.g.,
/tmp/zvelte-xxxxx).Check for Conflicts
Compares files in the template with files in your current directory to detect conflicts.
Copy or Abort
If no conflicts exist, copies template files into your directory. If conflicts are found, aborts the operation.
The merge mode is only available when using
. as the project directory. If you specify a named directory that already exists and is not empty, Zvelte will immediately abort.Conflict Detection
Zvelte performs strict conflict detection to prevent accidentally overwriting your existing files.What Counts as a Conflict
A conflict occurs when a file or directory from the template has the same name as something in your current directory:Conflict Examples
Conflict Error Message
When conflicts are detected, you’ll see:Use Cases
Fresh directory initialization
Fresh directory initialization
Create and navigate into a new directory, then initialize:This is equivalent to:
Add Zvelte template to existing workspace
Add Zvelte template to existing workspace
If you have a directory with some documentation or configuration files that don’t conflict with the template:
Monorepo package setup
Monorepo package setup
Initialize a new package in a monorepo:
Safety Features
Zvelte includes several safety mechanisms when using current directory mode:Path Validation
The current directory path is validated to prevent security issues:Temporary Directory Cleanup
The temporary directory used for conflict checking is always cleaned up:Git History Removal
The template’s.git directory is removed to ensure you can initialize your own repository:
Comparison: Named vs Current Directory
Named Directory
Command:
create my-app- Must not exist or must be empty
- Creates the directory if needed
- Fails if non-empty
- Simpler, more common
Current Directory
Command:
create .- Works in non-empty directories
- Checks for conflicts
- Merges template files
- More flexible, advanced
Best Practices
Troubleshooting
Error: Directory already exists and is not empty
Error: Directory already exists and is not empty
This error occurs when you use a named directory (not Solution: Use current directory syntax instead:
.) that already exists:Conflict error when merging
Conflict error when merging
Zvelte detected files in your directory that would be overwritten:Solution:
- Back up conflicting files:
mv package.json package.json.backup - Run create command again
- Manually merge needed content from backups
Package.json name is incorrect
Package.json name is incorrect
The package name is automatically set to your directory name:Solution: Manually edit
package.json after creation if you want a different name.