@shipstatic/ship 2.2.0-beta.6 → 2.2.0-beta.8

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 CHANGED
@@ -48,6 +48,7 @@ const ship = new Ship({ token: 'ship-...' });
48
48
  ```bash
49
49
  ship ./dist # Deploy (shortcut)
50
50
  ship ./dist --domain www.example.com # Deploy and serve it there
51
+ ship ./dist --ttl 1h # Expires in an hour
51
52
  ship ./dist --label production --label v1.0.0 # Deploy with labels
52
53
  ship deployments list
53
54
  ship deployments list --limit 20 # Page size; a hint shows the next cursor
@@ -106,7 +107,7 @@ ship.domains.set('www.münchen.de'); // → Unicode supported
106
107
  ### Tokens
107
108
 
108
109
  ```bash
109
- ship tokens create --ttl 3600 --label ci
110
+ ship tokens create --ttl 30d --label ci # Or 3600, 90s, 1h — one grammar
110
111
  ship tokens list
111
112
  ship tokens get <token>
112
113
  ship tokens delete <token>
@@ -153,6 +154,27 @@ open https://$(ship ./dist -q)
153
154
  ship deployments list -q | xargs -I{} ship deployments delete {} -q
154
155
  ```
155
156
 
157
+ ### Ephemeral deployments
158
+
159
+ ```bash
160
+ ship ./dist --ttl 1h # gone in an hour
161
+ ship ./dist --ttl 7d # a week-long preview
162
+ ship ./dist --ttl 3600 # bare seconds work too
163
+ ```
164
+
165
+ The platform reclaims the deployment when the time is up. Seconds, or a
166
+ `<n><unit>` duration (`s`/`m`/`h`/`d`) — the same grammar `ship tokens create
167
+ --ttl` uses. Bounded at one year.
168
+
169
+ Two rules, both refused before anything uploads. It **needs a token**: an
170
+ anonymous deployment already expires on the platform's own schedule, so there
171
+ is no deployer to choose a different one. And it **cannot be combined with
172
+ `--domain`**: a domain is a commitment and a deadline is its opposite, so the
173
+ API refuses to point a domain at a deployment that expires.
174
+
175
+ To keep something longer, deploy it again — there is no way to extend a
176
+ deployment's life, and no way to shorten it after the fact.
177
+
156
178
  `--domain` is the same two calls as one command:
157
179
 
158
180
  ```bash
@@ -192,6 +214,7 @@ Available on `ship <path>` and `ship deployments upload`:
192
214
  | `--domain <domain>` | Serve this deployment at that domain — creates or repoints it. Needs a token |
193
215
  | `--label <label>` | Add label (repeatable) |
194
216
  | `--password <password>` | Password-protect this deployment (6–128 chars) |
217
+ | `--ttl <duration>` | Expire this deployment after that long — `3600`, `90s`, `30m`, `1h`, `7d`. Needs a token; cannot be combined with `--domain` |
195
218
  | `--no-path-detect` | Disable automatic path optimization |
196
219
  | `--no-spa-detect` | Disable automatic SPA detection |
197
220
 
@@ -255,6 +278,7 @@ own `signal` (`AbortSignal.timeout(ms)`), which is never retried past.
255
278
  ship.deploy(input, {
256
279
  labels?: string[],
257
280
  password?: string, // Password-protect the deployment (6–128 chars)
281
+ ttl?: number, // Seconds until it expires (needs a token; max 1 year)
258
282
  signal?: AbortSignal, // Abort to cancel the deploy
259
283
  pathDetect?: boolean, // Auto-optimize paths (default: true)
260
284
  spaDetect?: boolean, // Auto-detect SPA (default: true)
@@ -262,6 +286,17 @@ ship.deploy(input, {
262
286
  });
263
287
  ```
264
288
 
289
+ #### Expiring deployments
290
+
291
+ Pass `ttl` in **seconds** and the platform reclaims the deployment when the time is up — 1 second to one year. The wire carries the duration and the API stamps `expires` against its own clock, so the answer says when:
292
+
293
+ ```typescript
294
+ const result = await ship.deploy('./dist', { ttl: 3600 });
295
+ // result.expires → unix seconds, one hour after result.created
296
+ ```
297
+
298
+ Needs a credential — an anonymous deployment already expires on the platform's own schedule. And a deployment carrying a ttl cannot be linked to a domain: the API refuses, which is what stops a domain pointing at something that is about to be reclaimed. There is no way to extend or shorten a deployment after the fact; redeploy instead.
299
+
265
300
  #### Password protection
266
301
 
267
302
  Pass `password` (6–128 characters) to gate the deployment behind a prompt. Visitors are asked for the password before they can view the site, including on any custom domains pointing at it. To remove protection, redeploy without a password.
@@ -295,12 +330,17 @@ const deployment = await ship.deploy([
295
330
  ### Events
296
331
 
297
332
  ```javascript
298
- ship.on('request', (url, init) => {});
299
- ship.on('response', (response, url) => {});
300
- ship.on('error', (error, url) => {});
333
+ ship.on('request', (url, init) => {}); // once per attempt
334
+ ship.on('retry', (error, url, attempt) => {}); // an attempt failed, another is coming
335
+ ship.on('response', (response, url) => {}); // the call succeeded
336
+ ship.on('error', (error, url) => {}); // the call failed, terminally
301
337
  ship.off('request', handler);
302
338
  ```
303
339
 
340
+ One call emits `retry* (error | response)` — every failure is announced, and
341
+ the event name says whether it ended the call. `attempt` counts from 1, so it
342
+ names both the attempt that failed and which retry is happening.
343
+
304
344
  ### Custom fetch
305
345
 
306
346
  Pass `fetch` to override the transport function used for every API call. Defaults to `globalThis.fetch`. Useful for wrapping requests with tracing, retries, or request signing, and for injecting a Cloudflare service-binding `Fetcher` from a Worker so calls reach a sibling Worker in-process instead of through the public hostname.
@@ -335,9 +375,10 @@ try {
335
375
  } catch (error) {
336
376
  if (isShipError(error)) {
337
377
  error.isAuthError(); // semantic category
338
- error.isNetworkError(); // semantic category
378
+ error.isNetworkError(); // semantic category — nothing was exchanged
339
379
  error.isClientError(); // semantic category (Business | Config | File | Validation)
340
380
  error.type === ErrorType.Validation; // specific-type check
381
+ error.type === ErrorType.Timeout; // a deadline expired — inside isNetworkError()
341
382
  error.status === 429; // status check
342
383
  }
343
384
  }
package/SKILL.md CHANGED
@@ -43,6 +43,27 @@ Without credentials, deployments are public and expire in 3 days. **Always show
43
43
 
44
44
  The deployment ID **is** the URL hostname. Use the full ID (e.g. `happy-cat-abc1234.shipstatic.com`) as the argument to all other commands. The site lives at `https://<deployment>`.
45
45
 
46
+ ### Deployments that clean themselves up
47
+
48
+ ```bash
49
+ ship ./dist --ttl 1h # gone in an hour
50
+ ship ./dist --ttl 7d # a week-long preview
51
+ ```
52
+
53
+ For a preview nobody needs to keep — a draft, a diff, a one-off render. The
54
+ platform reclaims it when the time is up, so nothing accumulates in the user's
55
+ account and nobody has to remember to delete it. Seconds or a `<n><unit>`
56
+ duration (`s`/`m`/`h`/`d`), up to a year.
57
+
58
+ **It needs a token.** Without one the deploy is anonymous and already expires
59
+ in 3 days on the platform's own schedule — there is no deployer to choose a
60
+ different lifetime, and the CLI refuses before uploading anything. **It cannot
61
+ be combined with `--domain`**, because a domain must not point at something
62
+ about to be reclaimed.
63
+
64
+ The response's `expires` is the answer, in unix seconds — read it there rather
65
+ than computing it, since the platform stamps it against its own clock.
66
+
46
67
  ### Parsing output
47
68
 
48
69
  ```bash
@@ -238,6 +259,7 @@ List commands return `{"<resource>s": [...], "cursor": null}`. A non-null `curso
238
259
  ```bash
239
260
  ship ./dist # Deploy (shortcut)
240
261
  ship ./dist --domain <name> # Deploy and serve it at that domain
262
+ ship ./dist --ttl 1h # Expires in an hour (needs a token)
241
263
  ship deployments upload <path> # Deploy (explicit)
242
264
  ship deployments list # List all
243
265
  ship deployments get <deployment> # Details
@@ -265,7 +287,7 @@ ship domains delete <name> # Delete
265
287
  ship whoami # Account info
266
288
  ship ping # Connectivity check
267
289
  ship tokens create # New deploy token (shown once)
268
- ship tokens create --ttl 3600 # With expiry (seconds)
290
+ ship tokens create --ttl 30d # With expiry — 3600, 90s, 1h, 30d
269
291
  ship tokens list # List tokens
270
292
  ship tokens get <token> # Details for one token
271
293
  ship tokens delete <token> # Delete (revokes immediately)
@@ -281,6 +303,7 @@ ship tokens delete <token> # Delete (revokes immediately)
281
303
  | `--domain <domain>` | Deploy and serve it there — creates or repoints. Needs a token |
282
304
  | `--label <label>` | Set label (repeatable, replaces all) |
283
305
  | `--password <pwd>` | Password-protect deployment (6–128 chars) |
306
+ | `--ttl <duration>` | Expire after that long — `3600`, `90s`, `1h`, `7d`. Needs a token; not with `--domain` |
284
307
  | `--no-path-detect` | Skip build output auto-detection |
285
308
  | `--no-spa-detect` | Skip SPA rewrite auto-configuration |
286
309
  | `--no-color` | Disable colors |
@@ -295,6 +318,8 @@ ship tokens delete <token> # Delete (revokes immediately)
295
318
  | `not found` | No such resource | Verify the ID/name |
296
319
  | `path does not exist` | Bad deploy path | Check file/directory |
297
320
  | `invalid domain name` | Not a subdomain | Use `www.example.com`, not `example.com` |
321
+ | `--ttl sets an expiry, which needs a token` | `--ttl` without credentials | Set an API key, or drop `--ttl` |
322
+ | `--ttl and --domain cannot be combined` | Both flags given | A domain cannot point at an expiring deployment — pick one |
298
323
  | `<resource> limit reached` | Plan caps hit (deployments, domains) | Suggest upgrading the plan; do not retry |
299
324
  | `Account has been deleted` / `Account terminated` | Account is gone | Stop; the account cannot deploy |
300
325
  | `DNS information is only available for external domains` | DNS op on internal domain | Only custom domains need DNS |
@@ -5,7 +5,7 @@ Their copyright notices travel with that copy, and are reproduced here in
5
5
  full. This file is GENERATED from the build's own metafile — edit the
6
6
  bundle, not this list.
7
7
 
8
- ## @shipstatic/types 2.7.0-beta.2
8
+ ## @shipstatic/types 2.7.0-beta.4
9
9
 
10
10
  License: MIT
11
11
 
@@ -160,62 +160,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
160
160
  THE SOFTWARE.
161
161
  ```
162
162
 
163
- ## form-data-encoder 4.1.0
164
-
165
- License: MIT
166
-
167
- ```
168
- The MIT License (MIT)
169
-
170
- Copyright (c) 2021-present Nick K.
171
-
172
- Permission is hereby granted, free of charge, to any person obtaining a copy
173
- of this software and associated documentation files (the "Software"), to deal
174
- in the Software without restriction, including without limitation the rights
175
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
176
- copies of the Software, and to permit persons to whom the Software is
177
- furnished to do so, subject to the following conditions:
178
-
179
- The above copyright notice and this permission notice shall be included in all
180
- copies or substantial portions of the Software.
181
-
182
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
183
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
185
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
186
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
187
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
188
- SOFTWARE.
189
- ```
190
-
191
- ## formdata-node 6.0.3
192
-
193
- License: MIT
194
-
195
- ```
196
- The MIT License (MIT)
197
-
198
- Copyright (c) 2017-present Nick K.
199
-
200
- Permission is hereby granted, free of charge, to any person obtaining a copy
201
- of this software and associated documentation files (the "Software"), to deal
202
- in the Software without restriction, including without limitation the rights
203
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
204
- copies of the Software, and to permit persons to whom the Software is
205
- furnished to do so, subject to the following conditions:
206
-
207
- The above copyright notice and this permission notice shall be included in all
208
- copies or substantial portions of the Software.
209
-
210
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
211
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
212
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
213
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
214
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
215
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
216
- SOFTWARE.
217
- ```
218
-
219
163
  ## junk 4.0.1
220
164
 
221
165
  License: MIT