@cobberhq/cli 0.2.0 → 0.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/README.md +15 -7
- package/dist/commands/logout.js +16 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,27 +11,35 @@ npm install -g @cobberhq/cli
|
|
|
11
11
|
## Authenticate
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
cobber login
|
|
15
|
-
# or set COBBER_API_URL
|
|
14
|
+
cobber login <subdomain>
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
A browser window opens. Approve the device code and the CLI receives a long-lived token (stored at `~/.cobber/config.json`).
|
|
19
18
|
|
|
19
|
+
By default the CLI connects to `https://<subdomain>.cobberhq.com.au`. Override with `--api-base-url` or `COBBER_API_URL` for local development.
|
|
20
|
+
|
|
20
21
|
## Pull, edit, sync
|
|
21
22
|
|
|
22
23
|
```bash
|
|
23
|
-
cobber
|
|
24
|
-
cobber
|
|
25
|
-
cobber
|
|
24
|
+
cobber pull # prompts to pick a theme (or `--all`)
|
|
25
|
+
cobber pull standard # pulls just the "Standard" theme
|
|
26
|
+
cobber pull --all # pulls every theme
|
|
26
27
|
|
|
27
28
|
cd <subdomain>-themes/<slug>
|
|
28
|
-
cobber
|
|
29
|
+
cobber dev # watches for changes, opens preview URL
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
Edits propagate to the draft theme via the API; the dashboard preview reflects them immediately. Production is untouched until somebody clicks **Publish** in `/dashboard/admin/themes/:id/draft`.
|
|
32
33
|
|
|
33
34
|
```bash
|
|
34
|
-
cobber
|
|
35
|
+
cobber push # bulk sync, useful if you edited offline
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Log out
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cobber logout # removes credentials for the default org
|
|
42
|
+
cobber logout <subdomain> # removes credentials for a specific org
|
|
35
43
|
```
|
|
36
44
|
|
|
37
45
|
## Layout
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readConfig, writeConfig } from "../lib/config.js";
|
|
2
|
+
export async function logout(subdomain) {
|
|
3
|
+
const config = await readConfig();
|
|
4
|
+
const target = subdomain ?? config.default;
|
|
5
|
+
if (!target || !config.orgs[target]) {
|
|
6
|
+
throw new Error("Not logged in.");
|
|
7
|
+
}
|
|
8
|
+
delete config.orgs[target];
|
|
9
|
+
if (config.default === target) {
|
|
10
|
+
const remaining = Object.keys(config.orgs);
|
|
11
|
+
config.default = remaining.length > 0 ? remaining[0] : undefined;
|
|
12
|
+
}
|
|
13
|
+
await writeConfig(config);
|
|
14
|
+
console.log(`Logged out of ${target}.`);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,SAAkB;IAC7C,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAE3C,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAED,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,GAAG,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { login } from "./commands/login.js";
|
|
4
|
+
import { logout } from "./commands/logout.js";
|
|
4
5
|
import { pull } from "./commands/pull.js";
|
|
5
6
|
import { push } from "./commands/push.js";
|
|
6
7
|
import { dev } from "./commands/dev.js";
|
|
@@ -10,27 +11,34 @@ program
|
|
|
10
11
|
.description("Local theme development for Cobber")
|
|
11
12
|
.version("0.1.0");
|
|
12
13
|
program
|
|
13
|
-
.command("login")
|
|
14
|
-
.description("Authenticate
|
|
15
|
-
.option("--api-base-url <url>", "Override the API base URL
|
|
16
|
-
.action(async (opts) => {
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
.command("login <subdomain>")
|
|
15
|
+
.description("Authenticate with a Cobber organisation")
|
|
16
|
+
.option("--api-base-url <url>", "Override the API base URL (default: https://<subdomain>.cobberhq.com.au)")
|
|
17
|
+
.action(async (subdomain, opts) => {
|
|
18
|
+
const apiBaseUrl = opts.apiBaseUrl || process.env.COBBER_API_URL || `https://${subdomain}.cobberhq.com.au`;
|
|
19
|
+
try {
|
|
20
|
+
await login({ apiBaseUrl });
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.error(err.message);
|
|
19
24
|
process.exitCode = 1;
|
|
20
|
-
return;
|
|
21
25
|
}
|
|
26
|
+
});
|
|
27
|
+
program
|
|
28
|
+
.command("logout [subdomain]")
|
|
29
|
+
.description("Remove stored credentials for an organisation")
|
|
30
|
+
.action(async (subdomain) => {
|
|
22
31
|
try {
|
|
23
|
-
await
|
|
32
|
+
await logout(subdomain);
|
|
24
33
|
}
|
|
25
34
|
catch (err) {
|
|
26
35
|
console.error(err.message);
|
|
27
36
|
process.exitCode = 1;
|
|
28
37
|
}
|
|
29
38
|
});
|
|
30
|
-
|
|
31
|
-
theme
|
|
39
|
+
program
|
|
32
40
|
.command("pull [theme]")
|
|
33
|
-
.description("Download a draft theme
|
|
41
|
+
.description("Download a draft theme (prompts to pick one, or use --all)")
|
|
34
42
|
.option("--all", "Pull every published theme into <subdomain>-themes/<slug>/")
|
|
35
43
|
.action(async (themeIdentifier, opts) => {
|
|
36
44
|
try {
|
|
@@ -41,7 +49,7 @@ theme
|
|
|
41
49
|
process.exitCode = 1;
|
|
42
50
|
}
|
|
43
51
|
});
|
|
44
|
-
|
|
52
|
+
program
|
|
45
53
|
.command("dev")
|
|
46
54
|
.description("Watch the local theme directory and sync changes on save")
|
|
47
55
|
.action(async () => {
|
|
@@ -53,7 +61,7 @@ theme
|
|
|
53
61
|
process.exitCode = 1;
|
|
54
62
|
}
|
|
55
63
|
});
|
|
56
|
-
|
|
64
|
+
program
|
|
57
65
|
.command("push")
|
|
58
66
|
.description("Push all local changes to the draft theme")
|
|
59
67
|
.action(async () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CA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