@blocofy/cli 0.1.7 → 0.1.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/bin/blocofy.mjs CHANGED
@@ -20,7 +20,7 @@ import { fetchDevSession, pullTheme, pushTheme } from "../lib/theme-sync.mjs";
20
20
  import { hyperlink, openUrl } from "../lib/term.mjs";
21
21
  import { isValidToken, isValidUrl, normalizeUrl } from "../lib/validate.mjs";
22
22
 
23
- const VERSION = "0.1.7";
23
+ const VERSION = "0.1.8";
24
24
  const args = process.argv.slice(2);
25
25
 
26
26
  /** Parse `--key value` and `--flag` (boolean) arguments. */
@@ -58,8 +58,9 @@ Usage
58
58
  --port <n> local port (default 3030)
59
59
  --no-sync local preview only (skip draft sync + remote views)
60
60
 
61
- blocofy theme pull [dir]
61
+ blocofy theme pull [dir] [--draft]
62
62
  Download the live theme to disk. (dir defaults to cwd)
63
+ --draft pull the draft theme (what 'theme dev' syncs into) instead of live
63
64
 
64
65
  blocofy theme push [dir] [--draft]
65
66
  Write the local theme to the site (create/update; no delete).
@@ -148,11 +149,13 @@ function requireCreds() {
148
149
  }
149
150
 
150
151
  async function themePull(rest) {
152
+ const flags = parseFlags(rest);
151
153
  const positional = rest.filter((a) => !a.startsWith("--"));
152
154
  const dir = resolve(positional[0] ?? process.cwd());
153
155
  const creds = requireCreds();
154
- const { count } = await pullTheme({ dir, url: creds.url, token: creds.token });
155
- console.log(`Downloaded ${count} theme files → ${dir}`);
156
+ const draft = Boolean(flags.draft);
157
+ const { count } = await pullTheme({ dir, url: creds.url, token: creds.token, draft });
158
+ console.log(`Downloaded ${count} ${draft ? "draft" : "live"} theme files → ${dir}`);
156
159
  }
157
160
 
158
161
  async function themePush(rest) {
@@ -18,10 +18,16 @@ async function errorText(res) {
18
18
  }
19
19
  }
20
20
 
21
- /** Download the live theme to disk. `{ path: content }` (stripped) → `.liquid` files. */
22
- export async function pullTheme({ dir, url, token }) {
21
+ /**
22
+ * Download a theme to disk. `{ path: content }` (stripped) → `.liquid` files.
23
+ * With `draft`, pulls the "CLI Draft" instance (what `theme dev` syncs into)
24
+ * instead of the live theme — symmetric with `push --draft`.
25
+ */
26
+ export async function pullTheme({ dir, url, token, draft = false }) {
23
27
  const base = url.replace(/\/+$/, "");
24
- const res = await fetch(`${base}/api/dev/theme`, { headers: { authorization: `Bearer ${token}` } });
28
+ const res = await fetch(`${base}/api/dev/theme${draft ? "?draft=1" : ""}`, {
29
+ headers: { authorization: `Bearer ${token}` },
30
+ });
25
31
  if (!res.ok) throw new Error(await errorText(res));
26
32
  const { files } = await res.json();
27
33
  let count = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocofy/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Develop your Blocofy theme locally against live data with instant preview — login, theme dev, pull, push.",
5
5
  "type": "module",
6
6
  "license": "MIT",