@zerodeploy/cli 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +44 -584
  2. package/dist/cli.js +155 -17
  3. package/package.json +1 -1
  4. package/dist/index.js +0 -6915
package/README.md CHANGED
@@ -34,402 +34,35 @@ Your site will be live at `https://my-website.zerodeploy.app`
34
34
 
35
35
  ## Commands
36
36
 
37
- ### Authentication
38
-
39
- #### `zerodeploy login`
40
-
41
- Authenticate with GitHub OAuth. Opens your browser for authentication.
42
-
43
- ```bash
44
- zerodeploy login
45
- ```
46
-
47
- #### `zerodeploy logout`
48
-
49
- Clear stored authentication token.
50
-
51
- ```bash
52
- zerodeploy logout
53
- ```
54
-
55
- #### `zerodeploy whoami`
56
-
57
- Display current logged-in user information.
58
-
59
- ```bash
60
- zerodeploy whoami
61
- ```
62
-
63
- #### `zerodeploy usage`
64
-
65
- Display current usage and plan limits with visual progress bars.
66
-
67
- ```bash
68
- zerodeploy usage
69
- ```
70
-
71
- **Options:**
72
- - `--json` - Output as JSON for scripting
73
-
74
- ### Organizations
75
-
76
- #### `zerodeploy org list`
77
-
78
- List all organizations you have access to.
79
-
80
- ```bash
81
- zerodeploy org list
82
- ```
83
-
84
- #### `zerodeploy org create <name>`
85
-
86
- Create a new organization.
87
-
88
- ```bash
89
- zerodeploy org create "My Company"
90
- ```
91
-
92
- #### `zerodeploy org delete <orgSlug>`
93
-
94
- Delete an organization (must have no sites).
95
-
96
- ```bash
97
- zerodeploy org delete my-company
98
- ```
99
-
100
- ### Sites
101
-
102
- #### `zerodeploy site list <orgSlug>`
103
-
104
- List all sites in an organization.
105
-
106
- ```bash
107
- zerodeploy site list my-company
108
- ```
109
-
110
- #### `zerodeploy site create <orgSlug> <name>`
111
-
112
- Create a new site in an organization. The subdomain is auto-generated from the name.
113
-
114
- **Options:**
115
- - `--repo <owner/repo>` - Link to a GitHub repository
116
-
117
- ```bash
118
- # Create a site
119
- zerodeploy site create my-company "My Website"
120
-
121
- # Create a site linked to a GitHub repo
122
- zerodeploy site create my-company "Dashboard" --repo company/monorepo
123
- ```
124
-
125
- Your site will be available at `https://<subdomain>.zerodeploy.app`
126
-
127
- #### `zerodeploy site rename <siteSlug> <newName> --org <orgSlug>`
128
-
129
- Rename a site's display name.
130
-
131
- ```bash
132
- zerodeploy site rename my-website "New Website Name" --org my-company
133
- ```
134
-
135
- Note: This changes the display name, not the slug or subdomain.
136
-
137
- #### `zerodeploy site link <orgSlug> <siteSlug> <repo>`
138
-
139
- Link a site to a GitHub repository.
140
-
141
- ```bash
142
- zerodeploy site link my-company dashboard company/monorepo
143
- ```
144
-
145
- #### `zerodeploy site unlink <orgSlug> <siteSlug>`
146
-
147
- Remove the GitHub repository link from a site.
148
-
149
- ```bash
150
- zerodeploy site unlink my-company dashboard
151
- ```
152
-
153
- #### `zerodeploy site subdomain <orgSlug> <siteSlug> <subdomain>`
154
-
155
- Update the subdomain for a site.
156
-
157
- ```bash
158
- zerodeploy site subdomain my-company my-website new-subdomain
159
- ```
160
-
161
- After updating, your site will be accessible at `https://new-subdomain.zerodeploy.app`.
162
-
163
- #### `zerodeploy site delete <siteSlug> --org <orgSlug>`
164
-
165
- Delete a site and all its deployments.
166
-
167
- **Options:**
168
- - `--force` - Skip confirmation prompt
169
-
170
- ```bash
171
- zerodeploy site delete my-website --org my-company
172
- ```
173
-
174
- ### Deployment
175
-
176
- #### `zerodeploy deploy [siteSlug] [options]`
177
-
178
- Deploy a directory to a site. If using a `zerodeploy.json` config file, site and org can be omitted.
179
-
180
- **Options:**
181
- - `--org <orgSlug>` - Organization slug (required, or from config)
182
- - `--dir <directory>` - Directory to deploy (default: auto-detect)
183
- - `--build` - Run build command before deploying
184
- - `--no-build` - Skip build step
185
- - `--build-command <cmd>` - Custom build command
186
- - `--install` - Run install command before building
187
- - `--preview` - Deploy without setting as current (preview only)
188
- - `--no-verify` - Skip deployment verification
189
- - `--no-auto-rollback` - Disable automatic rollback on verification failure
190
-
191
- **CI/CD Options:**
192
- - `--pr <number>` - PR number
193
- - `--pr-title <title>` - PR title
194
- - `--commit <sha>` - Commit SHA
195
- - `--branch <branch>` - Branch name
196
- - `--github-output` - Output deployment info in GitHub Actions format
197
-
198
- ```bash
199
- # Deploy specific directory
200
- zerodeploy deploy my-website --org my-company --dir ./dist
201
-
202
- # Auto-detect build directory
203
- zerodeploy deploy my-website --org my-company
204
-
205
- # Build and deploy
206
- zerodeploy deploy my-website --org my-company --build
207
-
208
- # Install dependencies, build, and deploy
209
- zerodeploy deploy my-website --org my-company --install --build
210
-
211
- # Deploy as preview (doesn't go live)
212
- zerodeploy deploy my-website --org my-company --preview
213
- ```
214
-
215
- Output:
216
- ```
217
- Deploying: ./dist
218
- Found 42 files (1.2 MB)
219
- Uploading...
220
- Finalizing...
221
- Verifying...
222
-
223
- Deployment successful!
224
- URL: https://my-website.zerodeploy.app (verified)
225
- Preview: https://abc12345-my-website.zerodeploy.app
226
- ```
227
-
228
- #### `zerodeploy deploy promote <deploymentId>`
229
-
230
- Promote a preview deployment to production.
231
-
232
- ```bash
233
- # Promote using short ID (first 8 chars)
234
- zerodeploy deploy promote abc12345
235
-
236
- # Or use full deployment ID
237
- zerodeploy deploy promote 019b1234-5678-90ab-cdef-1234567890ab
238
- ```
239
-
240
- #### `zerodeploy deployments list <siteSlug> --org <orgSlug>`
241
-
242
- List deployment history for a site.
243
-
244
- ```bash
245
- zerodeploy deployments list my-website --org my-company
246
- ```
247
-
248
- **Options:**
249
- - `--limit <number>` - Number of deployments to show (default: 10)
250
-
251
- #### `zerodeploy rollback <siteSlug> --org <orgSlug>`
252
-
253
- Rollback to a previous deployment.
254
-
255
- ```bash
256
- # Rollback to the previous deployment
257
- zerodeploy rollback my-website --org my-company
258
-
259
- # Rollback to a specific deployment
260
- zerodeploy rollback my-website --org my-company --to 019b1230
261
- ```
262
-
263
- ### Deploy Tokens
264
-
265
- Deploy tokens allow CI/CD systems to authenticate without using your personal credentials.
266
-
267
- #### `zerodeploy token create <name> --org <org> --site <site>`
268
-
269
- Create a deploy token for CI/CD.
270
-
271
- ```bash
272
- zerodeploy token create "GitHub Actions" --org my-company --site my-website
273
- ```
274
-
275
- Save the token securely - it will only be shown once.
276
-
277
- #### `zerodeploy token list --org <org> --site <site>`
278
-
279
- List deploy tokens for a site.
280
-
281
- ```bash
282
- zerodeploy token list --org my-company --site my-website
283
- ```
284
-
285
- #### `zerodeploy token delete <tokenId> --org <org> --site <site>`
286
-
287
- Delete a deploy token.
288
-
289
- ```bash
290
- zerodeploy token delete 019b1234 --org my-company --site my-website
291
- ```
292
-
293
- ### Custom Domains
294
-
295
- Connect your own domain to any ZeroDeploy site with automatic SSL.
296
-
297
- #### `zerodeploy domain add <domain> --org <org> --site <site>`
298
-
299
- Add a custom domain to a site. Returns DNS verification instructions.
300
-
301
- ```bash
302
- zerodeploy domain add www.example.com --org my-company --site my-website
303
- ```
304
-
305
- #### `zerodeploy domain verify <domain> --org <org> --site <site>`
306
-
307
- Verify domain ownership after adding the TXT record to your DNS.
308
-
309
- ```bash
310
- zerodeploy domain verify www.example.com --org my-company --site my-website
311
- ```
312
-
313
- #### `zerodeploy domain list --org <org> --site <site>`
314
-
315
- List all custom domains for a site.
316
-
317
- ```bash
318
- zerodeploy domain list --org my-company --site my-website
319
- ```
320
-
321
- #### `zerodeploy domain remove <domain> --org <org> --site <site>`
322
-
323
- Remove a custom domain from a site.
324
-
325
- ```bash
326
- zerodeploy domain remove www.example.com --org my-company --site my-website
327
- ```
328
-
329
- #### `zerodeploy domain redirect <domain> --org <org> --site <site> --mode <mode>`
330
-
331
- Set redirect mode for a custom domain. This allows automatic redirects between www and apex (non-www) domains.
332
-
333
- **Options:**
334
- - `--mode <mode>` - Redirect mode: `none`, `www_to_apex`, or `apex_to_www`
335
-
336
- ```bash
337
- # Redirect www.example.com to example.com
338
- zerodeploy domain redirect example.com --org my-company --site my-website --mode www_to_apex
339
-
340
- # Redirect example.com to www.example.com
341
- zerodeploy domain redirect www.example.com --org my-company --site my-website --mode apex_to_www
342
-
343
- # Disable redirects
344
- zerodeploy domain redirect example.com --org my-company --site my-website --mode none
345
- ```
346
-
347
- **Custom Domain Setup:**
348
-
349
- 1. Add the domain: `zerodeploy domain add www.example.com --org my-org --site my-site`
350
- 2. Add the TXT record to your DNS (shown in output)
351
- 3. Verify ownership: `zerodeploy domain verify www.example.com --org my-org --site my-site`
352
- 4. Add the CNAME record to your DNS (shown in output)
353
- 5. Your site is now live at `https://www.example.com`
354
-
355
- ### Forms
356
-
357
- Collect form submissions from your static sites without a backend. Get email notifications when forms are submitted.
358
-
359
- #### `zerodeploy form list --org <org> --site <site>`
360
-
361
- List all forms for a site with submission counts.
362
-
363
- ```bash
364
- zerodeploy form list --org my-company --site my-website
365
- ```
366
-
367
- #### `zerodeploy form export <name> --org <org> --site <site>`
368
-
369
- Export form submissions as CSV.
370
-
371
- **Options:**
372
- - `-o, --output <file>` - Output file path (default: `<name>-submissions.csv`)
373
-
374
- ```bash
375
- # Export to default file
376
- zerodeploy form export contact --org my-company --site my-website
377
-
378
- # Export to custom file
379
- zerodeploy form export contact --org my-company --site my-website -o leads.csv
380
- ```
381
-
382
- #### `zerodeploy form delete <name> --org <org> --site <site>`
383
-
384
- Delete a form and all its submissions.
385
-
386
- **Options:**
387
- - `--force` - Skip confirmation prompt
388
-
389
- ```bash
390
- zerodeploy form delete contact --org my-company --site my-website
391
- ```
392
-
393
- #### `zerodeploy form notify <name> --org <org> --site <site>`
394
-
395
- Configure email notifications for form submissions.
396
-
397
- **Options:**
398
- - `--email <email>` - Email address to receive notifications
399
- - `--disable` - Disable email notifications
400
-
401
- ```bash
402
- # Enable notifications
403
- zerodeploy form notify contact --org my-company --site my-website --email alerts@example.com
404
-
405
- # Disable notifications
406
- zerodeploy form notify contact --org my-company --site my-website --disable
407
- ```
408
-
409
- ### Account
410
-
411
- #### `zerodeploy account email <email>`
412
-
413
- Set or update your email address for deployment notifications.
414
-
415
- ```bash
416
- zerodeploy account email you@example.com
417
- ```
418
-
419
- #### `zerodeploy account delete`
420
-
421
- Permanently delete your account and all associated data.
422
-
423
- **Options:**
424
- - `--force` - Skip confirmation prompts
425
-
426
- ```bash
427
- zerodeploy account delete
428
- ```
429
-
430
- **Warning:** This permanently deletes your account, all organizations, sites, deployments, and custom domains.
431
-
432
- ## Configuration File
37
+ | Command | Description |
38
+ |---------|-------------|
39
+ | `login` | Authenticate with GitHub OAuth |
40
+ | `logout` | Clear stored authentication token |
41
+ | `whoami` | Display current logged-in user |
42
+ | `usage` | Show current usage and plan limits |
43
+ | `org list/create/delete` | Manage organizations |
44
+ | `site list/create/delete/rename` | Manage sites |
45
+ | `site stats` | View site traffic analytics |
46
+ | `site subdomain` | Change site subdomain |
47
+ | `deploy` | Deploy a directory to a site |
48
+ | `deploy promote` | Promote a preview deployment to production |
49
+ | `deployments list/show/logs` | View deployment history and logs |
50
+ | `rollback` | Roll back to a previous deployment |
51
+ | `domain add/verify/list/remove` | Manage custom domains |
52
+ | `domain redirect` | Set www/apex redirect mode |
53
+ | `token create/list/delete` | Manage API and deploy tokens |
54
+ | `form list/export/delete/notify` | Manage form submissions |
55
+ | `billing usage/bills/adjustments` | View billing information |
56
+ | `account email/delete` | Manage account settings |
57
+ | `init` | Create `zerodeploy.json` config file |
58
+ | `update` | Update CLI to the latest version |
59
+ | `inspect` | Output command metadata as JSON |
60
+
61
+ Most data-returning commands support `--json` for machine-readable output.
62
+
63
+ For detailed documentation on each command, see the [CLI Reference](https://zerodeploy.dev/docs/cli).
64
+
65
+ ## Configuration
433
66
 
434
67
  Create a `zerodeploy.json` in your project root:
435
68
 
@@ -437,27 +70,6 @@ Create a `zerodeploy.json` in your project root:
437
70
  zerodeploy init --org my-company --site my-website
438
71
  ```
439
72
 
440
- The CLI auto-detects your framework and creates an appropriate config:
441
-
442
- ```json
443
- {
444
- "org": "my-company",
445
- "site": "my-website",
446
- "dir": "dist",
447
- "build": "npm run build"
448
- }
449
- ```
450
-
451
- **Config Options:**
452
-
453
- | Field | Description |
454
- |-------|-------------|
455
- | `org` | Organization slug |
456
- | `site` | Site slug |
457
- | `dir` | Build output directory |
458
- | `build` | Build command (used with `--build` flag) |
459
- | `install` | Install command (used with `--install` flag) |
460
-
461
73
  Then deploy with just:
462
74
 
463
75
  ```bash
@@ -465,183 +77,31 @@ zerodeploy deploy # deploy only
465
77
  zerodeploy deploy --build # build + deploy
466
78
  ```
467
79
 
468
- CLI flags always take precedence over config values.
469
-
470
- ## Deployed Sites
471
-
472
- ### URLs
473
-
474
- Each site gets a production URL based on its subdomain:
475
-
476
- ```
477
- https://<subdomain>.zerodeploy.app
478
- ```
479
-
480
- ### Preview URLs
481
-
482
- Every deployment also gets a unique preview URL that remains accessible even after new deployments:
483
-
484
- ```
485
- https://<deploymentId>-<subdomain>.zerodeploy.app
486
- ```
487
-
488
- Preview URLs use the first 8 characters of the deployment ID. Useful for:
489
- - Reviewing changes before promoting to production
490
- - Sharing specific versions with stakeholders
491
- - Comparing different deployments
80
+ ## CI/CD
492
81
 
493
- ### SPA Support
82
+ For GitHub-based CI/CD, use the [GitHub App integration](https://zerodeploy.dev/docs/github) which auto-deploys on push and creates preview deployments for PRs — no configuration needed.
494
83
 
495
- ZeroDeploy automatically handles SPA (Single Page Application) routing:
496
- - Requests without file extensions fall back to `index.html`
497
- - Works with React Router, Vue Router, and other client-side routers
498
-
499
- ### Caching
500
-
501
- Cache headers are set automatically:
502
- - **HTML files**: Always revalidate for fresh content
503
- - **Hashed assets** (e.g., `main.abc123.js`): Cached for 1 year
504
- - **Other assets**: Cached for 1 hour with background revalidation
505
-
506
- ## CI/CD Integration
507
-
508
- ### GitHub Actions
509
-
510
- **1. Create a deploy token:**
84
+ For other CI/CD systems, create a deploy token and set the `ZERODEPLOY_TOKEN` environment variable:
511
85
 
512
86
  ```bash
513
- zerodeploy token create "GitHub Actions" --org my-company --site my-website
514
- ```
515
-
516
- **2. Add the token to your repository secrets** as `ZERODEPLOY_TOKEN`
517
-
518
- **3. Create `.github/workflows/deploy.yml`:**
87
+ zerodeploy token create "CI Deploy" --org my-company --site my-website
519
88
 
520
- ```yaml
521
- name: Deploy
522
- on:
523
- push:
524
- branches: [main]
525
-
526
- jobs:
527
- deploy:
528
- runs-on: ubuntu-latest
529
- steps:
530
- - uses: actions/checkout@v4
531
- - uses: actions/setup-node@v4
532
- with:
533
- node-version: '20'
534
- - run: npm ci
535
- - run: npm run build
536
- - name: Deploy
537
- env:
538
- ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
539
- run: npx @zerodeploy/cli deploy my-site --org my-org
540
- ```
541
-
542
- **PR Preview workflow:**
543
-
544
- ```yaml
545
- name: PR Preview
546
- on:
547
- pull_request:
548
-
549
- jobs:
550
- preview:
551
- runs-on: ubuntu-latest
552
- steps:
553
- - uses: actions/checkout@v4
554
- - uses: actions/setup-node@v4
555
- with:
556
- node-version: '20'
557
- - run: npm ci
558
- - run: npm run build
559
- - name: Deploy Preview
560
- env:
561
- ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
562
- run: |
563
- npx @zerodeploy/cli deploy my-site \
564
- --org my-org \
565
- --pr ${{ github.event.pull_request.number }} \
566
- --pr-title "${{ github.event.pull_request.title }}" \
567
- --commit ${{ github.sha }} \
568
- --branch ${{ github.head_ref }} \
569
- --github-output
89
+ # Then in your CI pipeline:
90
+ npx @zerodeploy/cli deploy my-site --org my-org
570
91
  ```
571
92
 
572
- The `--github-output` flag exports deployment info as GitHub Actions outputs:
573
- - `deployment_id` - The deployment ID
574
- - `deployment_url` - The production URL
575
- - `preview_url` - The unique preview URL
576
-
577
- ### Other CI/CD Systems
578
-
579
- ZeroDeploy works with any CI/CD system. Set the `ZERODEPLOY_TOKEN` environment variable and run the deploy command:
93
+ ## Updating
580
94
 
581
95
  ```bash
582
- # Works with npm, yarn, pnpm, or bun
583
- npx @zerodeploy/cli deploy my-site --org my-org
584
- yarn dlx @zerodeploy/cli deploy my-site --org my-org
585
- pnpm dlx @zerodeploy/cli deploy my-site --org my-org
586
- bunx @zerodeploy/cli deploy my-site --org my-org
96
+ zerodeploy update
587
97
  ```
588
98
 
589
- ## Framework Auto-Detection
590
-
591
- The CLI automatically detects your framework and uses the appropriate build command and output directory:
592
-
593
- | Framework | Build Command | Output Dir |
594
- |-----------|---------------|------------|
595
- | Vite | `npm run build` | `dist/` |
596
- | Next.js | `npm run build` | `out/` |
597
- | Create React App | `npm run build` | `build/` |
598
- | Vue CLI | `npm run build` | `dist/` |
599
- | Nuxt | `npm run build` | `dist/` |
600
- | Astro | `npm run build` | `dist/` |
601
- | SvelteKit | `npm run build` | `build/` |
602
- | Gatsby | `npm run build` | `public/` |
603
- | Remix | `npm run build` | `public/build/` |
604
- | Parcel | `npm run build` | `dist/` |
605
-
606
- **Auto-detected directories (fallback):**
607
- If no framework is detected, the CLI looks for: `dist/`, `build/`, `out/`, `public/`
608
-
609
- **Ignored files:**
610
- The following are automatically excluded from deployments:
611
- - `node_modules/`
612
- - `.git/`
613
- - `.env`, `.env.*` files
614
- - Hidden files starting with `.`
615
-
616
- ## Environment Variables
617
-
618
- | Variable | Description |
619
- |----------|-------------|
620
- | `ZERODEPLOY_TOKEN` | Authentication token (for CI/CD) |
621
- | `ZERODEPLOY_API_URL` | Custom API URL (defaults to production) |
622
-
623
- ## Troubleshooting
624
-
625
- ### "Not logged in"
626
-
627
- Run `zerodeploy login` to authenticate.
628
-
629
- ### "Org not found"
630
-
631
- Use the correct org slug (lowercase, hyphenated). Check with `zerodeploy org list`.
632
-
633
- ### "Site not found"
634
-
635
- Use the correct site and org slugs. Check with `zerodeploy site list <orgSlug>`.
636
-
637
- ### "No build directory found"
638
-
639
- Either:
640
- - Specify the directory with `--dir ./path/to/build`
641
- - Run with `--build` to build first
642
- - Ensure your project has a `dist/`, `build/`, `out/`, or `public/` directory
99
+ The CLI checks for updates automatically after each command (once per day) and shows a banner if a new version is available.
643
100
 
644
- ## Links
101
+ ## Documentation
645
102
 
646
- - [Documentation](https://zerodeploy.dev/docs)
647
- - [Support](https://zerodeploy.dev/support)
103
+ - [Quick Start](https://zerodeploy.dev/docs/quickstart)
104
+ - [CLI Reference](https://zerodeploy.dev/docs/cli)
105
+ - [Custom Domains](https://zerodeploy.dev/docs/cli/domain)
106
+ - [GitHub Integration](https://zerodeploy.dev/docs/github)
107
+ - [Redirects & Rewrites](https://zerodeploy.dev/docs/redirects)