sellify-cli 0.1.0 → 0.1.2
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 +1 -1
- package/bin/sellify.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Needs Node 20 or newer. No other dependencies.
|
|
|
13
13
|
```bash
|
|
14
14
|
sellify login # opens your browser; pick the store and click Allow
|
|
15
15
|
sellify login --store mystore # straight to that store
|
|
16
|
-
sellify login --url
|
|
16
|
+
sellify login --url http://admin.localhost:3000 # a local or self-hosted Sellify
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Sign in to Sellify in the browser (password or Google), check the computer name and click **Allow**. The CLI receives its token directly from the browser (a one-off listener on `127.0.0.1` with PKCE), so you never see or copy it. It is saved in `~/.config/sellify/config.json`, readable only by you.
|
package/bin/sellify.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { parseArgs } from "node:util";
|
|
|
13
13
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
14
14
|
const API_VERSION = "2026-10";
|
|
15
15
|
// The Sellify admin host. Point at your own deployment with --url or SELLIFY_URL.
|
|
16
|
-
const DEFAULT_URL = "
|
|
16
|
+
const DEFAULT_URL = "https://admin-sellifyhq.vercel.app";
|
|
17
17
|
// Same rule as the server (lib/theme-code FILE_PATH_RE): which files a theme can hold. All are text.
|
|
18
18
|
const THEME_PATH_RE =
|
|
19
19
|
/^(layout|templates|sections|snippets)\/[a-z0-9][a-z0-9_.-]{0,60}\.liquid$|^(templates|sections)\/[a-z0-9][a-z0-9_.-]{0,60}\.json$|^assets\/[a-z0-9][a-z0-9_.-]{0,60}\.(css|js|svg|json)$|^config\/settings_(schema|data)\.json$|^locales\/[a-z]{2}(-[a-z]{2})?(\.default)?(\.schema)?\.json$/;
|
|
@@ -227,7 +227,8 @@ async function browserLogin(url, store, open) {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
const ok = !!q.get("code");
|
|
230
|
-
|
|
230
|
+
// "connection: close" so the browser doesn't hold the listener open after this page.
|
|
231
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8", connection: "close" }).end(
|
|
231
232
|
`<!doctype html><meta charset="utf-8"><title>Sellify CLI</title><body style="font:16px system-ui;display:grid;place-items:center;height:90vh;margin:0;background:#f5f5f5"><div style="background:#fff;padding:32px 40px;border-radius:12px;box-shadow:0 0 0 1px #0001;text-align:center"><h1 style="font-size:20px;margin:0 0 8px">${ok ? "You're logged in to Sellify CLI" : "Login cancelled"}</h1><p style="margin:0;color:#555">You can close this tab and return to your terminal.</p></div>`,
|
|
232
233
|
);
|
|
233
234
|
if (ok) finish.resolve({ code: q.get("code"), store: q.get("store") });
|
|
@@ -258,6 +259,8 @@ async function browserLogin(url, store, open) {
|
|
|
258
259
|
return { store: chosen, token: body.access_token };
|
|
259
260
|
} finally {
|
|
260
261
|
clearTimeout(timer);
|
|
262
|
+
// Browsers keep idle connections (and preconnects) open; drop them so the CLI can exit.
|
|
263
|
+
server.closeAllConnections();
|
|
261
264
|
server.close();
|
|
262
265
|
}
|
|
263
266
|
}
|