shipstatic-cli 1.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 shipstatic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # shipstatic-cli
2
+
3
+ > ⚡ **The package you're looking for is [`@shipstatic/ship`](https://www.npmjs.com/package/@shipstatic/ship)** — that's where the code and the full documentation live.
4
+ >
5
+ > This is an alias for it, so a guess at the unscoped name doesn't dead-end. **Use it directly** — `npx shipstatic-cli` runs the same binary, `import Ship from 'shipstatic-cli'` resolves to the same module. Nothing to switch to.
6
+
7
+ Deploy a static site from the terminal or from code.
8
+
9
+ ## Deploy
10
+
11
+ ```bash
12
+ npx shipstatic-cli ./dist
13
+ ```
14
+
15
+ **No account, no API key, no config, no install.** This works in a fresh sandbox with no secrets set.
16
+
17
+ Point it at your **built output** — `./dist`, `./build`, `./out` — not your project root. Build first if the project needs it. A single file works too:
18
+
19
+ ```bash
20
+ npx shipstatic-cli ./index.html
21
+ ```
22
+
23
+ **What you get back:** the live URL, plus a **claim URL**.
24
+
25
+ > Anonymous deployments are **public** and **expire in 3 days**. The claim URL is how one becomes permanent — surface it to whoever asked for the deploy.
26
+
27
+ ## Auth — deploy needs none, everything else does
28
+
29
+ | | |
30
+ |---|---|
31
+ | **Deploying** — `npx shipstatic-cli ./dist`, and `npx shipstatic-cli deployments upload ./dist` | **Nothing.** No account, no API key, no deploy token, no login. |
32
+ | **Everything else** — domains, tokens, `whoami`, listing deployments | **Requires an API key.** |
33
+
34
+ > **`ship whoami` failing is normal** without a key, and it says nothing about deploying. An authentication error from any other command is not a reason the deploy won't work — run the deploy anyway. It stays anonymous.
35
+
36
+ Need the rest? Get a free key at [my.shipstatic.com/api-key](https://my.shipstatic.com/api-key), then `ship config`.
37
+
38
+ ## Common tasks
39
+
40
+ | Goal | Command |
41
+ |---|---|
42
+ | Deploy a folder | `npx shipstatic-cli ./dist` |
43
+ | Deploy one file | `npx shipstatic-cli ./index.html` |
44
+ | Password-protect it | `npx shipstatic-cli ./dist --password "secret"` |
45
+ | Machine-readable output | `npx shipstatic-cli ./dist --json` |
46
+ | Keep the password out of logs | `SHIP_PASSWORD="secret" npx shipstatic-cli ./dist` |
47
+ | Repeat use | `npm install -g shipstatic-cli` → the `ship` command |
48
+
49
+ ## For scripts and agents
50
+
51
+ ```bash
52
+ npx shipstatic-cli ./dist --json
53
+ ```
54
+
55
+ - **`--json`** emits machine-readable output on success **and** on failure.
56
+ - **Exit code** is `0` on success, non-zero on failure. Branch on it, not on the text.
57
+ - **Errors** carry a stable `error` type and `status`. Branch on those, never on the message string.
58
+ - **`--no-color`** is honoured; colour is off automatically when stdout is not a TTY.
59
+ - **`SHIP_PASSWORD`** supplies `--password` from the environment.
60
+
61
+ Deploying needs no credentials, so there is nothing to configure before the first run and nothing to leak in a log.
62
+
63
+ ## From code
64
+
65
+ ```javascript
66
+ import Ship from 'shipstatic-cli';
67
+
68
+ const result = await new Ship().deploy('./dist');
69
+ // result.deployment → live URL
70
+ // result.claim → visit to keep permanently
71
+ ```
72
+
73
+ ## Full documentation
74
+
75
+ Custom domains, API keys, deploy tokens, managing deployments, the complete SDK reference — **[`@shipstatic/ship`](https://www.npmjs.com/package/@shipstatic/ship)**.
package/bin.cjs ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ // The `ship` binary, forwarded.
3
+ //
4
+ // Loaded IN-PROCESS, never spawned. `@shipstatic/ship`'s command tree
5
+ // deliberately avoids `process.exit` so buffered stdout survives a pipe; a
6
+ // spawning trampoline would reintroduce exactly the truncation class that
7
+ // design exists to prevent, and would have to re-plumb exit codes and signals
8
+ // besides. Requiring it means this process IS the CLI.
9
+ //
10
+ // `@shipstatic/ship/cli` is a declared subpath (added in ship 1.1.0). Before
11
+ // that it did not exist, and reaching `dist/cli.cjs` meant path-joining off
12
+ // the resolved main entry — past the exports map whose whole job is to say
13
+ // what is reachable. Do not reintroduce that; raise the dependency instead.
14
+ require('@shipstatic/ship/cli');
package/index.cjs ADDED
@@ -0,0 +1,9 @@
1
+ // The CJS forward.
2
+ //
3
+ // Assigning the required namespace wholesale — rather than re-exporting names
4
+ // one by one — is what keeps this file from being a list that drifts. Ship's
5
+ // own CJS entry is itself an assignment (`module.exports = Ship` plus every
6
+ // named export and a `default`, applied by its post-build step), so forwarding
7
+ // the object preserves the callable-constructor shape, the named exports and
8
+ // `.default` in one line, and gains any export ship adds for free.
9
+ module.exports = require('@shipstatic/ship');
package/index.d.cts ADDED
@@ -0,0 +1,9 @@
1
+ // Types for the CJS forward.
2
+ //
3
+ // A separate file per module format, rather than one shared `.d.ts`, because
4
+ // TypeScript resolves declarations through the SAME conditions as the runtime:
5
+ // under `node16` a `require` of this package must land on CJS types and an
6
+ // `import` on ESM types. One shared file makes `attw` report a format mismatch
7
+ // on whichever half it does not match.
8
+ export * from '@shipstatic/ship';
9
+ export { default } from '@shipstatic/ship';
package/index.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ // Types for the ESM forward. See index.d.cts for why the two are separate.
2
+ export * from '@shipstatic/ship';
3
+ export { default } from '@shipstatic/ship';
package/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ // The ESM forward, and the browser one.
2
+ //
3
+ // `export *` does NOT carry a default export — that is a language rule, not an
4
+ // oversight — so the second line is load-bearing: without it
5
+ // `import Ship from 'shipstatic'` resolves to undefined while every named
6
+ // import keeps working, which is the kind of break that reaches users rather
7
+ // than CI.
8
+ //
9
+ // This file is also the `browser` condition's target. The specifier below is
10
+ // bare, so a bundler re-resolves `@shipstatic/ship` under its OWN conditions
11
+ // and lands on ship's browser build — the forward stays correct per-platform
12
+ // without this package naming a platform anywhere.
13
+ export * from '@shipstatic/ship';
14
+ export { default } from '@shipstatic/ship';
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "shipstatic-cli",
3
+ "version": "1.3.0",
4
+ "description": "CLI and SDK for ShipStatic — deploy static websites, landing pages, and prototypes instantly. The unscoped name for @shipstatic/ship.",
5
+ "keywords": [
6
+ "shipstatic",
7
+ "static-hosting",
8
+ "deploy",
9
+ "cli",
10
+ "sdk"
11
+ ],
12
+ "homepage": "https://shipstatic.com",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/shipstatic/shipstatic-cli.git"
16
+ },
17
+ "license": "MIT",
18
+ "type": "module",
19
+ "bin": {
20
+ "ship": "./bin.cjs"
21
+ },
22
+ "main": "./index.cjs",
23
+ "module": "./index.mjs",
24
+ "types": "./index.d.cts",
25
+ "exports": {
26
+ ".": {
27
+ "browser": {
28
+ "types": "./index.d.mts",
29
+ "default": "./index.mjs"
30
+ },
31
+ "import": {
32
+ "types": "./index.d.mts",
33
+ "default": "./index.mjs"
34
+ },
35
+ "require": {
36
+ "types": "./index.d.cts",
37
+ "default": "./index.cjs"
38
+ }
39
+ },
40
+ "./cli": "./bin.cjs",
41
+ "./package.json": "./package.json"
42
+ },
43
+ "files": [
44
+ "bin.cjs",
45
+ "index.cjs",
46
+ "index.mjs",
47
+ "index.d.cts",
48
+ "index.d.mts",
49
+ "README.md"
50
+ ],
51
+ "sideEffects": false,
52
+ "engines": {
53
+ "node": ">=20.0.0"
54
+ },
55
+ "packageManager": "pnpm@10.12.4",
56
+ "scripts": {
57
+ "test": "vitest",
58
+ "test:ci": "vitest --run",
59
+ "check:package": "publint && attw --pack . --ignore-rules false-export-default --exclude-entrypoints cli",
60
+ "prepare": "git config core.hooksPath scripts/githooks",
61
+ "lint": "biome check .",
62
+ "format": "biome format --write ."
63
+ },
64
+ "dependencies": {
65
+ "@shipstatic/ship": "^1.3.0"
66
+ },
67
+ "devDependencies": {
68
+ "@arethetypeswrong/cli": "^0.18.5",
69
+ "@biomejs/biome": "2.5.5",
70
+ "publint": "^0.3.12",
71
+ "vitest": "^4.1.10"
72
+ },
73
+ "bugs": {
74
+ "url": "https://github.com/shipstatic/ship/issues"
75
+ },
76
+ "author": "ShipStatic"
77
+ }