@zerodeploy/cli 0.1.0 → 0.1.1
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.
- package/README.md +202 -308
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# ZeroDeploy CLI
|
|
2
2
|
|
|
3
|
-
Command-line interface for deploying static sites to ZeroDeploy.
|
|
3
|
+
Command-line interface for deploying static sites and SPAs to [ZeroDeploy](https://zerodeploy.dev).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
bun install
|
|
10
|
-
|
|
11
|
-
# Link CLI globally
|
|
12
|
-
cd apps/cli && bun link
|
|
8
|
+
npm install -g @zerodeploy/cli
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @zerodeploy/cli deploy
|
|
15
|
+
```
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
@@ -24,26 +24,26 @@ zerodeploy login
|
|
|
24
24
|
zerodeploy org create "My Company"
|
|
25
25
|
|
|
26
26
|
# 3. Create a site
|
|
27
|
-
zerodeploy site create my-company "My Website"
|
|
27
|
+
zerodeploy site create my-company "My Website" --subdomain my-website
|
|
28
28
|
|
|
29
29
|
# 4. Deploy your site
|
|
30
30
|
zerodeploy deploy my-website --org my-company --dir ./dist
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
Your site will be live at `https://my-website.zerodeploy.app`
|
|
34
|
+
|
|
33
35
|
## Commands
|
|
34
36
|
|
|
35
37
|
### Authentication
|
|
36
38
|
|
|
37
39
|
#### `zerodeploy login`
|
|
38
40
|
|
|
39
|
-
Authenticate with GitHub OAuth. Opens browser for authentication
|
|
41
|
+
Authenticate with GitHub OAuth. Opens your browser for authentication.
|
|
40
42
|
|
|
41
43
|
```bash
|
|
42
44
|
zerodeploy login
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
Token is stored at `~/.zerodeploy/token`.
|
|
46
|
-
|
|
47
47
|
#### `zerodeploy logout`
|
|
48
48
|
|
|
49
49
|
Clear stored authentication token.
|
|
@@ -60,449 +60,335 @@ Display current logged-in user information.
|
|
|
60
60
|
zerodeploy whoami
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Output:
|
|
64
|
-
```
|
|
65
|
-
Logged in as:
|
|
66
|
-
Username: johndoe
|
|
67
|
-
User ID: 019b1234-5678-...
|
|
68
|
-
Admin: No
|
|
69
|
-
```
|
|
70
|
-
|
|
71
63
|
### Organizations
|
|
72
64
|
|
|
73
65
|
#### `zerodeploy org list`
|
|
74
66
|
|
|
75
|
-
List all organizations you
|
|
67
|
+
List all organizations you have access to.
|
|
76
68
|
|
|
77
69
|
```bash
|
|
78
70
|
zerodeploy org list
|
|
79
71
|
```
|
|
80
72
|
|
|
81
|
-
Output:
|
|
82
|
-
```
|
|
83
|
-
Organizations:
|
|
84
|
-
- My Company [paid] (id: 019b1234-...)
|
|
85
|
-
- Personal [paid] (id: 019b5678-...)
|
|
86
|
-
```
|
|
87
|
-
|
|
88
73
|
#### `zerodeploy org create <name>`
|
|
89
74
|
|
|
90
|
-
Create a new organization.
|
|
75
|
+
Create a new organization.
|
|
91
76
|
|
|
92
77
|
```bash
|
|
93
78
|
zerodeploy org create "My Company"
|
|
94
79
|
```
|
|
95
80
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
#### `zerodeploy org delete <orgSlug>`
|
|
82
|
+
|
|
83
|
+
Delete an organization (must have no sites).
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
zerodeploy org delete my-company
|
|
100
87
|
```
|
|
101
88
|
|
|
102
89
|
### Sites
|
|
103
90
|
|
|
104
91
|
#### `zerodeploy site list <orgSlug>`
|
|
105
92
|
|
|
106
|
-
List all sites in an organization.
|
|
93
|
+
List all sites in an organization.
|
|
107
94
|
|
|
108
95
|
```bash
|
|
109
96
|
zerodeploy site list my-company
|
|
110
97
|
```
|
|
111
98
|
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
Sites:
|
|
115
|
-
my-website My Website -> company/frontend
|
|
116
|
-
landing-page Landing Page
|
|
117
|
-
docs Documentation -> company/monorepo
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### `zerodeploy site create <orgSlug> <name> [options]`
|
|
99
|
+
#### `zerodeploy site create <orgSlug> <name> --subdomain <subdomain>`
|
|
121
100
|
|
|
122
|
-
Create a new site in an organization.
|
|
101
|
+
Create a new site in an organization.
|
|
123
102
|
|
|
124
103
|
**Options:**
|
|
104
|
+
- `--subdomain <subdomain>` - Subdomain for the site (required, globally unique)
|
|
125
105
|
- `--repo <owner/repo>` - Link to a GitHub repository
|
|
126
106
|
|
|
127
107
|
```bash
|
|
128
108
|
# Create a site
|
|
129
|
-
zerodeploy site create my-company "My Website"
|
|
109
|
+
zerodeploy site create my-company "My Website" --subdomain my-website
|
|
130
110
|
|
|
131
111
|
# Create a site linked to a GitHub repo
|
|
132
|
-
zerodeploy site create my-company "Dashboard" --repo company/monorepo
|
|
112
|
+
zerodeploy site create my-company "Dashboard" --subdomain dashboard --repo company/monorepo
|
|
133
113
|
```
|
|
134
114
|
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
Site created: Dashboard
|
|
138
|
-
ID: 019b1234-5678-...
|
|
139
|
-
Repo: company/monorepo
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
#### `zerodeploy site link <orgSlug> <siteSlug> <repo>`
|
|
143
|
-
|
|
144
|
-
Link an existing site to a GitHub repository. One repository can be linked to multiple sites (monorepo support).
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
zerodeploy site link my-company dashboard company/monorepo
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Output:
|
|
151
|
-
```
|
|
152
|
-
Site "Dashboard" linked to company/monorepo
|
|
153
|
-
```
|
|
115
|
+
Your site will be available at `https://<subdomain>.zerodeploy.app`
|
|
154
116
|
|
|
155
|
-
#### `zerodeploy site
|
|
117
|
+
#### `zerodeploy site delete <siteSlug> --org <orgSlug>`
|
|
156
118
|
|
|
157
|
-
|
|
119
|
+
Delete a site and all its deployments.
|
|
158
120
|
|
|
159
121
|
```bash
|
|
160
|
-
zerodeploy site
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Output:
|
|
164
|
-
```
|
|
165
|
-
Site "Dashboard" unlinked from GitHub repository
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### GitHub Repository Linking
|
|
169
|
-
|
|
170
|
-
Sites can be linked to GitHub repositories to enable:
|
|
171
|
-
- Tracking which repo deploys to which site
|
|
172
|
-
- Future: Automatic PR preview comments
|
|
173
|
-
- Future: GitHub webhook integration
|
|
174
|
-
|
|
175
|
-
**Monorepo support:** One repository can be linked to multiple sites:
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
company/monorepo
|
|
179
|
-
├── apps/marketing → site: marketing
|
|
180
|
-
├── apps/dashboard → site: dashboard
|
|
181
|
-
└── apps/docs → site: docs
|
|
122
|
+
zerodeploy site delete my-website --org my-company
|
|
182
123
|
```
|
|
183
124
|
|
|
184
125
|
### Deployment
|
|
185
126
|
|
|
186
127
|
#### `zerodeploy deploy <siteSlug> [options]`
|
|
187
128
|
|
|
188
|
-
Deploy a directory to a site.
|
|
189
|
-
|
|
190
|
-
**Arguments:**
|
|
191
|
-
- `siteSlug` - The site slug to deploy to
|
|
129
|
+
Deploy a directory to a site.
|
|
192
130
|
|
|
193
131
|
**Options:**
|
|
194
132
|
- `--org <orgSlug>` - Organization slug (required)
|
|
195
133
|
- `--dir <directory>` - Directory to deploy (default: auto-detect)
|
|
196
134
|
- `--build` - Run build command before deploying
|
|
197
|
-
- `--
|
|
198
|
-
- `--build-command <cmd>` - Override the build command
|
|
135
|
+
- `--build-command <cmd>` - Custom build command
|
|
199
136
|
- `--install` - Run install command before building
|
|
200
137
|
|
|
201
|
-
**CI/CD Options:**
|
|
202
|
-
- `--pr <number>` - PR number (for GitHub Actions)
|
|
203
|
-
- `--pr-title <title>` - PR title
|
|
204
|
-
- `--commit <sha>` - Commit SHA
|
|
205
|
-
- `--commit-message <message>` - Commit message
|
|
206
|
-
- `--branch <branch>` - Branch name
|
|
207
|
-
- `--github-output` - Output deployment info in GitHub Actions format
|
|
208
|
-
|
|
209
138
|
```bash
|
|
210
139
|
# Deploy specific directory
|
|
211
140
|
zerodeploy deploy my-website --org my-company --dir ./dist
|
|
212
141
|
|
|
213
|
-
# Auto-detect build directory
|
|
142
|
+
# Auto-detect build directory
|
|
214
143
|
zerodeploy deploy my-website --org my-company
|
|
215
144
|
|
|
216
|
-
# Build and deploy
|
|
145
|
+
# Build and deploy
|
|
217
146
|
zerodeploy deploy my-website --org my-company --build
|
|
218
147
|
|
|
219
|
-
# Install, build, and deploy
|
|
148
|
+
# Install dependencies, build, and deploy
|
|
220
149
|
zerodeploy deploy my-website --org my-company --install --build
|
|
221
|
-
|
|
222
|
-
# Custom build command
|
|
223
|
-
zerodeploy deploy my-website --org my-company --build-command "npm run build:prod"
|
|
224
150
|
```
|
|
225
151
|
|
|
226
152
|
Output:
|
|
227
153
|
```
|
|
228
|
-
Detected: Vite
|
|
229
|
-
|
|
230
|
-
Building...
|
|
231
|
-
> npm run build
|
|
232
|
-
|
|
233
154
|
Deploying: ./dist
|
|
234
155
|
Found 42 files (1.2 MB)
|
|
235
|
-
Created deployment: 019b1234-5678-...
|
|
236
156
|
Uploading files...
|
|
237
157
|
[100%] 42/42 files
|
|
238
158
|
|
|
239
159
|
Deployment successful!
|
|
240
|
-
URL: https://my-
|
|
241
|
-
Preview: https://
|
|
160
|
+
URL: https://my-website.zerodeploy.app
|
|
161
|
+
Preview: https://019b1234-my-website.zerodeploy.app
|
|
242
162
|
```
|
|
243
163
|
|
|
244
|
-
####
|
|
245
|
-
|
|
246
|
-
Each deployment gets a unique preview URL that remains accessible even after new deployments:
|
|
247
|
-
|
|
248
|
-
- **Production URL**: `https://site_org.zerodeploy.app` - Always serves the current deployment
|
|
249
|
-
- **Preview URL**: `https://{shortId}_site_org.zerodeploy.app` - Serves a specific deployment
|
|
164
|
+
#### `zerodeploy deployments list <siteSlug> --org <orgSlug>`
|
|
250
165
|
|
|
251
|
-
|
|
252
|
-
- Reviewing changes before promoting to production
|
|
253
|
-
- Sharing specific versions with stakeholders
|
|
254
|
-
- Rolling back by comparing different deployments
|
|
255
|
-
- PR preview deployments
|
|
256
|
-
|
|
257
|
-
#### GitHub Actions Integration
|
|
258
|
-
|
|
259
|
-
ZeroDeploy integrates with GitHub Actions for automated deployments and PR previews.
|
|
260
|
-
|
|
261
|
-
**Setup:**
|
|
262
|
-
1. Generate a token: Run `zerodeploy login` and copy the token from `~/.zerodeploy/token`
|
|
263
|
-
2. Add the token to your repository secrets as `ZERODEPLOY_TOKEN`
|
|
264
|
-
3. Copy the workflow template to `.github/workflows/deploy.yml`
|
|
265
|
-
|
|
266
|
-
**Minimal workflow:**
|
|
267
|
-
```yaml
|
|
268
|
-
name: Deploy
|
|
269
|
-
on:
|
|
270
|
-
push:
|
|
271
|
-
branches: [main]
|
|
272
|
-
|
|
273
|
-
jobs:
|
|
274
|
-
deploy:
|
|
275
|
-
runs-on: ubuntu-latest
|
|
276
|
-
steps:
|
|
277
|
-
- uses: actions/checkout@v4
|
|
278
|
-
- uses: oven-sh/setup-bun@v2
|
|
279
|
-
- run: bun install
|
|
280
|
-
- run: bun run build
|
|
281
|
-
- name: Deploy
|
|
282
|
-
env:
|
|
283
|
-
ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
|
|
284
|
-
run: bunx zerodeploy deploy my-site --org my-org
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**PR Preview workflow:**
|
|
288
|
-
```yaml
|
|
289
|
-
- name: Deploy PR Preview
|
|
290
|
-
if: github.event_name == 'pull_request'
|
|
291
|
-
env:
|
|
292
|
-
ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
|
|
293
|
-
run: |
|
|
294
|
-
zerodeploy deploy my-site \
|
|
295
|
-
--org my-org \
|
|
296
|
-
--pr ${{ github.event.pull_request.number }} \
|
|
297
|
-
--pr-title "${{ github.event.pull_request.title }}" \
|
|
298
|
-
--commit ${{ github.sha }} \
|
|
299
|
-
--branch ${{ github.head_ref }} \
|
|
300
|
-
--github-output
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
The `--github-output` flag exports deployment info as GitHub Actions outputs:
|
|
304
|
-
- `deployment_id` - The deployment ID
|
|
305
|
-
- `deployment_url` - The production URL
|
|
306
|
-
- `preview_url` - The unique preview URL
|
|
307
|
-
|
|
308
|
-
See `apps/cli/examples/github-actions/` for full workflow templates including PR comment automation
|
|
309
|
-
|
|
310
|
-
#### Framework Auto-Detection
|
|
311
|
-
|
|
312
|
-
The CLI automatically detects your framework from `package.json` and uses the appropriate build command and output directory:
|
|
313
|
-
|
|
314
|
-
| Framework | Detection | Build Command | Output Dir |
|
|
315
|
-
|-----------|-----------|---------------|------------|
|
|
316
|
-
| Vite | `vite` in deps | `npm run build` | `dist/` |
|
|
317
|
-
| Next.js | `next` in deps | `npm run build` | `out/` |
|
|
318
|
-
| Create React App | `react-scripts` in deps | `npm run build` | `build/` |
|
|
319
|
-
| Vue CLI | `@vue/cli-service` in deps | `npm run build` | `dist/` |
|
|
320
|
-
| Nuxt | `nuxt` in deps | `npm run build` | `dist/` |
|
|
321
|
-
| Astro | `astro` in deps | `npm run build` | `dist/` |
|
|
322
|
-
| SvelteKit | `@sveltejs/kit` in deps | `npm run build` | `build/` |
|
|
323
|
-
| Gatsby | `gatsby` in deps | `npm run build` | `public/` |
|
|
324
|
-
| Remix | `@remix-run/dev` in deps | `npm run build` | `public/build/` |
|
|
325
|
-
| Parcel | `parcel` in deps | `npm run build` | `dist/` |
|
|
326
|
-
|
|
327
|
-
**Auto-build behavior:**
|
|
328
|
-
- If a framework is detected but the output directory doesn't exist, the CLI automatically runs the build
|
|
329
|
-
- Use `--no-build` to skip the build step
|
|
330
|
-
- Use `--build-command` to override the detected build command
|
|
331
|
-
|
|
332
|
-
**Auto-detected directories (fallback):**
|
|
333
|
-
If no framework is detected, the CLI looks for common build output directories:
|
|
334
|
-
1. `dist/` (Vite, Rollup)
|
|
335
|
-
2. `build/` (Create React App)
|
|
336
|
-
3. `out/` (Next.js static export)
|
|
337
|
-
4. `public/` (static sites)
|
|
338
|
-
|
|
339
|
-
**Ignored files:**
|
|
340
|
-
The following are automatically excluded from deployments:
|
|
341
|
-
- `node_modules/`
|
|
342
|
-
- `.git/`
|
|
343
|
-
- `.env`, `.env.*` files
|
|
344
|
-
- Hidden files starting with `.`
|
|
345
|
-
|
|
346
|
-
#### `zerodeploy deploy list <siteSlug> --org <orgSlug>`
|
|
347
|
-
|
|
348
|
-
List all deployments for a site.
|
|
166
|
+
List deployment history for a site.
|
|
349
167
|
|
|
350
168
|
```bash
|
|
351
|
-
zerodeploy
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Output:
|
|
355
|
-
```
|
|
356
|
-
Deployments for my-company/my-website:
|
|
357
|
-
|
|
358
|
-
019b1234 ready 12/14/2025, 9:00:00 PM <- current
|
|
359
|
-
019b1230 ready 12/14/2025, 8:30:00 PM
|
|
360
|
-
019b1220 ready 12/14/2025, 8:00:00 PM
|
|
169
|
+
zerodeploy deployments list my-website --org my-company
|
|
361
170
|
```
|
|
362
171
|
|
|
363
172
|
**Options:**
|
|
364
|
-
- `--org <orgSlug>` - Organization slug (required)
|
|
365
173
|
- `--limit <number>` - Number of deployments to show (default: 10)
|
|
366
174
|
|
|
367
|
-
#### `zerodeploy
|
|
175
|
+
#### `zerodeploy rollback <siteSlug> --org <orgSlug>`
|
|
368
176
|
|
|
369
|
-
Rollback to a previous deployment.
|
|
177
|
+
Rollback to a previous deployment.
|
|
370
178
|
|
|
371
179
|
```bash
|
|
372
|
-
|
|
373
|
-
|
|
180
|
+
# Rollback to the previous deployment
|
|
181
|
+
zerodeploy rollback my-website --org my-company
|
|
374
182
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
Rolled back successfully
|
|
378
|
-
Deployment: 019b1230-5678-...
|
|
379
|
-
URL: https://my-website_my-company.zerodeploy.app
|
|
183
|
+
# Rollback to a specific deployment
|
|
184
|
+
zerodeploy rollback my-website --org my-company --to 019b1230
|
|
380
185
|
```
|
|
381
186
|
|
|
382
187
|
### Deploy Tokens
|
|
383
188
|
|
|
384
|
-
Deploy tokens allow CI/CD systems to authenticate
|
|
189
|
+
Deploy tokens allow CI/CD systems to authenticate without using your personal credentials.
|
|
385
190
|
|
|
386
191
|
#### `zerodeploy token create <name> --org <org> --site <site>`
|
|
387
192
|
|
|
388
|
-
Create a
|
|
193
|
+
Create a deploy token for CI/CD.
|
|
389
194
|
|
|
390
195
|
```bash
|
|
391
196
|
zerodeploy token create "GitHub Actions" --org my-company --site my-website
|
|
392
197
|
```
|
|
393
198
|
|
|
394
|
-
|
|
395
|
-
```
|
|
396
|
-
Deploy token created successfully!
|
|
199
|
+
Save the token securely - it will only be shown once.
|
|
397
200
|
|
|
398
|
-
|
|
399
|
-
ID: 019b1234-5678-...
|
|
400
|
-
|
|
401
|
-
Token (save this - it will not be shown again):
|
|
201
|
+
#### `zerodeploy token list --org <org> --site <site>`
|
|
402
202
|
|
|
403
|
-
|
|
203
|
+
List deploy tokens for a site.
|
|
404
204
|
|
|
405
|
-
|
|
406
|
-
|
|
205
|
+
```bash
|
|
206
|
+
zerodeploy token list --org my-company --site my-website
|
|
407
207
|
```
|
|
408
208
|
|
|
409
|
-
|
|
410
|
-
- `--org <orgSlug>` - Organization slug (required)
|
|
411
|
-
- `--site <siteSlug>` - Site slug (required)
|
|
412
|
-
|
|
413
|
-
#### `zerodeploy token list --org <org> --site <site>`
|
|
209
|
+
#### `zerodeploy token delete <tokenId> --org <org> --site <site>`
|
|
414
210
|
|
|
415
|
-
|
|
211
|
+
Delete a deploy token.
|
|
416
212
|
|
|
417
213
|
```bash
|
|
418
|
-
zerodeploy token
|
|
214
|
+
zerodeploy token delete 019b1234 --org my-company --site my-website
|
|
419
215
|
```
|
|
420
216
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
217
|
+
## Configuration File
|
|
218
|
+
|
|
219
|
+
Create a `zerodeploy.json` in your project root:
|
|
424
220
|
|
|
425
|
-
|
|
426
|
-
|
|
221
|
+
```bash
|
|
222
|
+
zerodeploy init --org my-company --site my-website
|
|
427
223
|
```
|
|
428
224
|
|
|
429
|
-
|
|
225
|
+
This creates:
|
|
430
226
|
|
|
431
|
-
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"org": "my-company",
|
|
230
|
+
"site": "my-website"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Then deploy with just:
|
|
432
235
|
|
|
433
236
|
```bash
|
|
434
|
-
zerodeploy
|
|
237
|
+
zerodeploy deploy
|
|
435
238
|
```
|
|
436
239
|
|
|
437
|
-
##
|
|
240
|
+
## Deployed Sites
|
|
438
241
|
|
|
439
|
-
|
|
440
|
-
2. **Upload files** - CLI scans directory and uploads each file as base64 to R2
|
|
441
|
-
3. **Finalize** - API marks deployment as `ready` and sets it as the current deployment
|
|
442
|
-
4. **Live** - Site is immediately accessible at the deployment URL
|
|
242
|
+
### URLs
|
|
443
243
|
|
|
444
|
-
|
|
244
|
+
Each site gets a production URL based on its subdomain:
|
|
445
245
|
|
|
446
|
-
After deployment, sites are accessible at:
|
|
447
|
-
|
|
448
|
-
**Local development:**
|
|
449
246
|
```
|
|
450
|
-
|
|
247
|
+
https://<subdomain>.zerodeploy.app
|
|
451
248
|
```
|
|
452
249
|
|
|
453
|
-
|
|
250
|
+
### Preview URLs
|
|
251
|
+
|
|
252
|
+
Every deployment also gets a unique preview URL that remains accessible even after new deployments:
|
|
253
|
+
|
|
454
254
|
```
|
|
455
|
-
https://<
|
|
255
|
+
https://<deploymentId>-<subdomain>.zerodeploy.app
|
|
456
256
|
```
|
|
457
257
|
|
|
258
|
+
Preview URLs use the first 8 characters of the deployment ID. Useful for:
|
|
259
|
+
- Reviewing changes before promoting to production
|
|
260
|
+
- Sharing specific versions with stakeholders
|
|
261
|
+
- Comparing different deployments
|
|
262
|
+
|
|
458
263
|
### SPA Support
|
|
459
264
|
|
|
460
265
|
ZeroDeploy automatically handles SPA (Single Page Application) routing:
|
|
461
266
|
- Requests without file extensions fall back to `index.html`
|
|
462
|
-
-
|
|
267
|
+
- Works with React Router, Vue Router, and other client-side routers
|
|
463
268
|
|
|
464
269
|
### Caching
|
|
465
270
|
|
|
466
|
-
|
|
467
|
-
- **HTML files**:
|
|
468
|
-
- **Hashed assets** (e.g., `main.abc123.js`):
|
|
469
|
-
- **Other assets**:
|
|
271
|
+
Cache headers are set automatically:
|
|
272
|
+
- **HTML files**: Always revalidate for fresh content
|
|
273
|
+
- **Hashed assets** (e.g., `main.abc123.js`): Cached for 1 year
|
|
274
|
+
- **Other assets**: Cached for 1 hour with background revalidation
|
|
275
|
+
|
|
276
|
+
## CI/CD Integration
|
|
277
|
+
|
|
278
|
+
### GitHub Actions
|
|
470
279
|
|
|
471
|
-
|
|
280
|
+
**1. Create a deploy token:**
|
|
472
281
|
|
|
473
|
-
|
|
282
|
+
```bash
|
|
283
|
+
zerodeploy token create "GitHub Actions" --org my-company --site my-website
|
|
284
|
+
```
|
|
474
285
|
|
|
475
|
-
|
|
286
|
+
**2. Add the token to your repository secrets** as `ZERODEPLOY_TOKEN`
|
|
476
287
|
|
|
477
|
-
|
|
288
|
+
**3. Create `.github/workflows/deploy.yml`:**
|
|
478
289
|
|
|
479
|
-
|
|
290
|
+
```yaml
|
|
291
|
+
name: Deploy
|
|
292
|
+
on:
|
|
293
|
+
push:
|
|
294
|
+
branches: [main]
|
|
480
295
|
|
|
481
|
-
|
|
296
|
+
jobs:
|
|
297
|
+
deploy:
|
|
298
|
+
runs-on: ubuntu-latest
|
|
299
|
+
steps:
|
|
300
|
+
- uses: actions/checkout@v4
|
|
301
|
+
- uses: actions/setup-node@v4
|
|
302
|
+
with:
|
|
303
|
+
node-version: '20'
|
|
304
|
+
- run: npm ci
|
|
305
|
+
- run: npm run build
|
|
306
|
+
- name: Deploy
|
|
307
|
+
env:
|
|
308
|
+
ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
|
|
309
|
+
run: npx @zerodeploy/cli deploy my-site --org my-org
|
|
310
|
+
```
|
|
482
311
|
|
|
483
|
-
|
|
484
|
-
# Point to local dev server
|
|
485
|
-
export ZERODEPLOY_API_URL=http://localhost:8787
|
|
312
|
+
**PR Preview workflow:**
|
|
486
313
|
|
|
487
|
-
|
|
488
|
-
|
|
314
|
+
```yaml
|
|
315
|
+
name: PR Preview
|
|
316
|
+
on:
|
|
317
|
+
pull_request:
|
|
318
|
+
|
|
319
|
+
jobs:
|
|
320
|
+
preview:
|
|
321
|
+
runs-on: ubuntu-latest
|
|
322
|
+
steps:
|
|
323
|
+
- uses: actions/checkout@v4
|
|
324
|
+
- uses: actions/setup-node@v4
|
|
325
|
+
with:
|
|
326
|
+
node-version: '20'
|
|
327
|
+
- run: npm ci
|
|
328
|
+
- run: npm run build
|
|
329
|
+
- name: Deploy Preview
|
|
330
|
+
env:
|
|
331
|
+
ZERODEPLOY_TOKEN: ${{ secrets.ZERODEPLOY_TOKEN }}
|
|
332
|
+
run: |
|
|
333
|
+
npx @zerodeploy/cli deploy my-site \
|
|
334
|
+
--org my-org \
|
|
335
|
+
--pr ${{ github.event.pull_request.number }} \
|
|
336
|
+
--pr-title "${{ github.event.pull_request.title }}" \
|
|
337
|
+
--commit ${{ github.sha }} \
|
|
338
|
+
--branch ${{ github.head_ref }} \
|
|
339
|
+
--github-output
|
|
489
340
|
```
|
|
490
341
|
|
|
491
|
-
|
|
342
|
+
The `--github-output` flag exports deployment info as GitHub Actions outputs:
|
|
343
|
+
- `deployment_id` - The deployment ID
|
|
344
|
+
- `deployment_url` - The production URL
|
|
345
|
+
- `preview_url` - The unique preview URL
|
|
492
346
|
|
|
493
|
-
|
|
347
|
+
### Other CI/CD Systems
|
|
348
|
+
|
|
349
|
+
ZeroDeploy works with any CI/CD system. Set the `ZERODEPLOY_TOKEN` environment variable and run the deploy command:
|
|
494
350
|
|
|
495
351
|
```bash
|
|
496
|
-
#
|
|
497
|
-
|
|
498
|
-
|
|
352
|
+
# Works with npm, yarn, pnpm, or bun
|
|
353
|
+
npx @zerodeploy/cli deploy my-site --org my-org
|
|
354
|
+
yarn dlx @zerodeploy/cli deploy my-site --org my-org
|
|
355
|
+
pnpm dlx @zerodeploy/cli deploy my-site --org my-org
|
|
356
|
+
bunx @zerodeploy/cli deploy my-site --org my-org
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Framework Auto-Detection
|
|
360
|
+
|
|
361
|
+
The CLI automatically detects your framework and uses the appropriate build command and output directory:
|
|
362
|
+
|
|
363
|
+
| Framework | Build Command | Output Dir |
|
|
364
|
+
|-----------|---------------|------------|
|
|
365
|
+
| Vite | `npm run build` | `dist/` |
|
|
366
|
+
| Next.js | `npm run build` | `out/` |
|
|
367
|
+
| Create React App | `npm run build` | `build/` |
|
|
368
|
+
| Vue CLI | `npm run build` | `dist/` |
|
|
369
|
+
| Nuxt | `npm run build` | `dist/` |
|
|
370
|
+
| Astro | `npm run build` | `dist/` |
|
|
371
|
+
| SvelteKit | `npm run build` | `build/` |
|
|
372
|
+
| Gatsby | `npm run build` | `public/` |
|
|
373
|
+
| Remix | `npm run build` | `public/build/` |
|
|
374
|
+
| Parcel | `npm run build` | `dist/` |
|
|
375
|
+
|
|
376
|
+
**Auto-detected directories (fallback):**
|
|
377
|
+
If no framework is detected, the CLI looks for: `dist/`, `build/`, `out/`, `public/`
|
|
499
378
|
|
|
500
|
-
|
|
501
|
-
|
|
379
|
+
**Ignored files:**
|
|
380
|
+
The following are automatically excluded from deployments:
|
|
381
|
+
- `node_modules/`
|
|
382
|
+
- `.git/`
|
|
383
|
+
- `.env`, `.env.*` files
|
|
384
|
+
- Hidden files starting with `.`
|
|
502
385
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
386
|
+
## Environment Variables
|
|
387
|
+
|
|
388
|
+
| Variable | Description |
|
|
389
|
+
|----------|-------------|
|
|
390
|
+
| `ZERODEPLOY_TOKEN` | Authentication token (for CI/CD) |
|
|
391
|
+
| `ZERODEPLOY_API_URL` | Custom API URL (defaults to production) |
|
|
506
392
|
|
|
507
393
|
## Troubleshooting
|
|
508
394
|
|
|
@@ -512,12 +398,20 @@ Run `zerodeploy login` to authenticate.
|
|
|
512
398
|
|
|
513
399
|
### "Org not found"
|
|
514
400
|
|
|
515
|
-
|
|
401
|
+
Use the correct org slug (lowercase, hyphenated). Check with `zerodeploy org list`.
|
|
516
402
|
|
|
517
403
|
### "Site not found"
|
|
518
404
|
|
|
519
|
-
|
|
405
|
+
Use the correct site and org slugs. Check with `zerodeploy site list <orgSlug>`.
|
|
520
406
|
|
|
521
407
|
### "No build directory found"
|
|
522
408
|
|
|
523
|
-
|
|
409
|
+
Either:
|
|
410
|
+
- Specify the directory with `--dir ./path/to/build`
|
|
411
|
+
- Run with `--build` to build first
|
|
412
|
+
- Ensure your project has a `dist/`, `build/`, `out/`, or `public/` directory
|
|
413
|
+
|
|
414
|
+
## Links
|
|
415
|
+
|
|
416
|
+
- [Documentation](https://zerodeploy.dev/docs)
|
|
417
|
+
- [Support](https://zerodeploy.dev/support)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerodeploy/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"zerodeploy": "dist/cli.js"
|
|
@@ -23,11 +23,6 @@
|
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/zerodeploy/zerodeploy.git",
|
|
29
|
-
"directory": "apps/cli"
|
|
30
|
-
},
|
|
31
26
|
"keywords": [
|
|
32
27
|
"deploy",
|
|
33
28
|
"spa",
|