@canner-ca/cli 0.4.1 → 0.5.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 +25 -1
- package/package.json +3 -2
- package/src/cli.mjs +1305 -7
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Requires Node.js 20 or later.
|
|
|
19
19
|
## Quick start
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
# Sign in once (paste an API token from canner.ca/dashboard/
|
|
22
|
+
# Sign in once (paste an API token from canner.ca/dashboard/identity/api-keys)
|
|
23
23
|
canner login
|
|
24
24
|
|
|
25
25
|
# In your project directory, create a Canner project
|
|
@@ -76,6 +76,30 @@ canner deploy --follow
|
|
|
76
76
|
| `canner domains verify <hostname\|id> [--slug X]` | Re-check DNS and provision TLS. |
|
|
77
77
|
| `canner domains rm <hostname\|id> [--slug X]` | Detach a custom domain. |
|
|
78
78
|
|
|
79
|
+
### Databases
|
|
80
|
+
|
|
81
|
+
| Command | What it does |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `canner db [list] [--slug X]` | List the project's databases (the primary is injected as `DATABASE_URL`). |
|
|
84
|
+
| `canner db init [--pg 17\|18]` | Provision the project's primary database. |
|
|
85
|
+
| `canner db create <name> [--pg 17\|18]` | Add another database (paid plans). Injected as `DATABASE_URL_<NAME>`. |
|
|
86
|
+
| `canner db info [<name>] [--reveal]` / `canner db url [<name>]` | Connection details. The password is hidden unless `--reveal` (and is `null` in `--json`). |
|
|
87
|
+
| `canner db export [<name>] [--format custom\|plain] [--out FILE]` | Dump a database and download it. `custom` restores with `pg_restore`, `plain` is gzipped SQL. Every plan. |
|
|
88
|
+
| `canner db import <file> [--to <name>] [--replace]` | Restore a `pg_dump --format=custom` file (max 500 MB). The database must be empty unless `--replace`, which snapshots it first. Atomic: on failure nothing changes. |
|
|
89
|
+
| `canner db migrate-in --from <url>\|--from-env VAR [--to <name>] [--replace]` | Stream a database in from any publicly reachable Postgres server. Nothing is stored; the URL is used once. Use `--from -` to type it instead of putting a password in your shell history. |
|
|
90
|
+
| `canner db migrate-out --to-url <url>\|--to-env VAR [--from <name>] --yes` | Stream a database out to another server. |
|
|
91
|
+
| `canner db copy <from> <to> [--to-project SLUG] [--replace]` | Copy one database into another you own. |
|
|
92
|
+
| `canner db rm <name> --yes` · `canner db pg-version <name> <17\|18> --yes` | Delete an additional database · move it to another Postgres version. |
|
|
93
|
+
| `canner db ops [<id>]` | Recent operations, or one operation's status. |
|
|
94
|
+
| `canner db external [<name>]` | Show external-access status: host, port, allowlist. |
|
|
95
|
+
| `canner db external <name> --enable --allow CIDR [--allow CIDR ...]` | Turn on public access, restricted to the given IPs/CIDRs (repeatable). `--allow-all --yes` opens it to the whole internet — not recommended. |
|
|
96
|
+
| `canner db external <name> --disable` | Turn public access off. Always allowed, even on a downgraded plan. |
|
|
97
|
+
| `canner db rotate <name> --yes` | Rotate the database's password. Redeploy to pick up the new `DATABASE_URL`. |
|
|
98
|
+
|
|
99
|
+
Export, import, migrate and copy run on Canner. The CLI starts the operation and
|
|
100
|
+
shows progress; add `--no-wait` to return immediately and check with `canner db ops <id>`.
|
|
101
|
+
Boolean flags (`--replace`, `--yes`, `--no-wait`) can appear anywhere.
|
|
102
|
+
|
|
79
103
|
## JSON output
|
|
80
104
|
|
|
81
105
|
Add `--json` to any command for machine-readable output — tables and progress lines are suppressed and a single JSON value is printed to stdout, so the result pipes straight into `jq` or an agent. Errors are written to stderr as `{"error":"..."}` with a non-zero exit code. With `--json`, `deploy --follow` does **not** stream the build log (it would corrupt the JSON); poll `canner deployments <id> --json` for the terminal status instead.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canner-ca/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Canner deploy CLI — git push from any terminal, no GitHub required",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "node src/cli.mjs",
|
|
15
|
-
"
|
|
15
|
+
"test": "node test/run.mjs",
|
|
16
|
+
"prepublishOnly": "node -e \"const s=require('fs').readFileSync('src/cli.mjs','utf8'); if(s.includes('\\r')){console.error('src/cli.mjs has CRLF line endings; publish it with LF (see .gitattributes).');process.exit(1)}\" && npm test"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"tar": "^7.4.3"
|