@camozdevelopment/velar
v1.0.2
Published
CLI tool for Velar deployment platform
Maintainers
Readme
Velar CLI
Command-line interface for deploying static sites to Velar.
Installation
Global Installation (Recommended)
npm install -g @camozdevelopment/velarLocal Development
cd cli
npm install
npm run build
npm linkCommands
velar login
Authenticate with Velar and generate an access token.
velar loginThe token is saved to ~/.velar/config.json.
Example:
$ velar login
✔ Successfully authenticated!
Token: abc123def4...
Token saved to ~/.velar/config.jsonvelar deploy
Deploy your static site.
velar deploy [options]Options:
-d, --dir <directory>- Specify build output directory-n, --name <name>- Custom project name--skip-build- Skip the build step
Examples:
Deploy with auto-detection:
$ velar deploy
🚀 Velar Deploy
Project: my-app
Output: dist
Size: 2.5 MB
✔ Package created
✔ Deployment successful!
✓ Deployment Complete
Details:
Deployment ID: xyz789
Files: 42
Total Size: 2.5 MB
🌐 Your site is live at:
https://my-app.velardev.appSpecify output directory:
velar deploy --dir buildCustom project name:
velar deploy --name my-awesome-appSkip build step:
velar deploy --skip-buildvelar list / velar ls
List all your deployed projects.
velar listExample:
$ velar list
📦 Your Projects
my-app
ID: proj_abc123
Subdomain: my-app
URL: https://my-app.velardev.app
Created: 1/1/2024, 12:00:00 PM
portfolio
ID: proj_def456
Subdomain: portfolio
URL: https://portfolio.velardev.app
Created: 1/2/2024, 3:30:00 PMvelar rollback
Rollback to a previous deployment.
velar rollback <project-id> <deployment-id>Example:
$ velar rollback proj_abc123 dep_xyz789
✔ Rollback successful!
Deployment dep_xyz789 is now active.Configuration
The CLI stores configuration in ~/.velar/config.json:
{
"token": "your-auth-token",
"apiUrl": "https://velardev.app"
}Custom API URL
Set a custom API URL:
export VELAR_API_URL=https://api.myvelar.com
velar deployBuild Detection
The CLI automatically detects your build output directory by looking for:
out(Next.js export)dist(Vite, Rollup, Parcel)build(Create React App, Vue CLI)public(Static sites).next(Next.js)
If no output directory is found, it will attempt to run your build command.
Build Command Detection
Looks for these scripts in package.json:
buildprodproduction
Example package.json:
{
"scripts": {
"dev": "vite",
"build": "vite build"
}
}The CLI will automatically run npm run build.
Project Name
The CLI determines the project name by:
- Using
--nameflag if provided - Reading
namefrompackage.json - Using current directory name as fallback
Names are sanitized to be subdomain-safe:
- Lowercase only
- Alphanumeric and hyphens
- No consecutive hyphens
Examples:
My App→my-appmy_awesome_project→my-awesome-projectHello World!!!→hello-world
File Exclusions
The following patterns are never uploaded:
node_modules/.git/.env,.env.local.DS_Store,Thumbs.db*.log
Only your build output is uploaded, keeping deployments fast and efficient.
Environment Variables
VELAR_API_URL
Override the default API URL.
export VELAR_API_URL=https://staging.velardev.appError Handling
"Not authenticated"
Run velar login to generate a new token.
"Could not detect build output directory"
Specify the directory manually:
velar deploy --dir dist"Build failed"
Your build command failed. Check the output for errors, fix them, and try again.
"Deployment exceeds maximum size"
Your deployment is too large (>100MB). Reduce the size:
- Optimize images
- Remove unnecessary files
- Enable gzip compression
- Split large assets
"Too many requests"
You've hit the rate limit. Wait a minute and try again.
Development
Project Structure
cli/
├── src/
│ ├── commands/ # Command implementations
│ │ ├── login.ts
│ │ ├── deploy.ts
│ │ ├── list.ts
│ │ └── rollback.ts
│ ├── lib/ # Utilities
│ │ ├── api.ts # API client
│ │ ├── config.ts # Config management
│ │ ├── build.ts # Build detection
│ │ └── zip.ts # Zip creation
│ └── index.ts # Entry point
├── package.json
└── tsconfig.jsonBuilding
npm run buildCompiles TypeScript to dist/.
Local Testing
npm link
velar --helpPublishing
npm version patch
npm publishAdvanced Usage
CI/CD Integration
Store your token as a secret and use it in CI:
GitHub Actions:
- name: Deploy to Velar
env:
VELAR_TOKEN: ${{ secrets.VELAR_TOKEN }}
run: |
echo '{"token":"$VELAR_TOKEN","apiUrl":"https://velardev.app"}' > ~/.velar/config.json
velar deploy --skip-buildGitLab CI:
deploy:
script:
- echo '{"token":"'$VELAR_TOKEN'","apiUrl":"https://velardev.app"}' > ~/.velar/config.json
- velar deploy --skip-buildCustom Workflows
Deploy specific directory:
npm run build
velar deploy --dir dist --skip-buildDeploy with custom name:
velar deploy --name staging-v2Troubleshooting
Check Configuration
cat ~/.velar/config.jsonVerify Token
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://velardev.app/api/projectsDebug Mode
Add console logs in the CLI code and rebuild:
console.log('Debug:', config);Clear Configuration
rm -rf ~/.velar
velar loginSecurity
- Never commit your
.velar/config.jsonto version control - Store tokens as environment variables in CI/CD
- Rotate tokens regularly
- Use different tokens for different environments
Changelog
v1.0.0
- Initial release
- Login, deploy, list, rollback commands
- Automatic build detection
- Progress indicators
- Error handling
Support
For issues or questions:
- GitHub Issues: github.com/velar/velar
- Documentation: velardev.app/docs
Built with ❤️ for developers
