@greatstore/cli 0.0.2 → 0.0.4

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.
Files changed (3) hide show
  1. package/README.md +9 -64
  2. package/dist/cli.js +10 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,85 +11,30 @@ gs push
11
11
  gs publish my-widget
12
12
  ```
13
13
 
14
- > **Status — MVP.** Authentication today targets a nav-side OAuth bounce
15
- > at `nav.maker.co/connect_oauth_done` and a short-lived JWT stored at
16
- > `~/.greatstore/credentials.json`. Bearer acceptance on the worker is a
17
- > separate planned change (see
18
- > `tasks/backburner/builder-cli-bearer-auth.md` in the main repo); until
19
- > that lands, push/publish/list etc. will 401 against the live API.
20
-
21
14
  ## Commands
22
15
 
23
16
  | Command | What it does |
24
17
  | --------------------------------------------- | ------------------------------------------------------------- |
25
- | `gs login [--store <slug>]` | Open the browser, capture a nav token, persist credentials. |
26
- | `gs logout` | Wipe `~/.greatstore/credentials.json`. |
27
- | `gs whoami` | Print the identity stored in your credentials file. |
18
+ | `gs login` | Sign in. |
19
+ | `gs logout` | Sign out. |
20
+ | `gs whoami` | Print the identity you're signed in as. |
28
21
  | `gs init <name> [--out <dir>] [--store <s>]` | Scaffold a working component project. |
29
- | `gs list [--json]` | List the components in the current store. |
22
+ | `gs list [--json]` | List components in the current store. |
30
23
  | `gs pull <name> [--draft\|--live\|--version N] [-o <dir>]` | Download manifest + bundle to disk. |
31
24
  | `gs push [<name>] [--manifest path] [--bundle path]` | Upload a new draft revision. |
32
- | `gs publish <name> [--version N]` | Promote a draft (or rollback to a historical version) to live.|
33
- | `gs unpublish <name>` | Clear the live pointer; the draft and history stay. |
34
- | `gs delete <name> [--yes]` | Soft-delete the component (R2 objects are retained). |
25
+ | `gs publish <name> [--version N]` | Promote a draft (or roll back to a historical version) to live.|
26
+ | `gs unpublish <name>` | Clear the live pointer; draft + history stay. |
27
+ | `gs delete <name> [--yes]` | Remove the component. |
35
28
 
36
29
  ## Store selection
37
30
 
38
31
  Every command except `login`, `logout`, and `whoami` needs a store. The
39
- CLI resolves it with this precedence:
32
+ CLI picks one in this order:
40
33
 
41
34
  1. `--store <slug>` flag.
42
35
  2. `.gsrc` in the current directory or any ancestor: `{"store":"demo"}`.
43
36
  3. `GS_STORE` environment variable.
44
37
  4. Error.
45
38
 
46
- `gs init` writes a `.gsrc` for you so commands inside a scaffolded
39
+ `gs init` writes a `.gsrc` for you, so commands inside a scaffolded
47
40
  project don't need a flag.
48
-
49
- ## Environment
50
-
51
- - `GS_API_BASE` — override the API base URL (default
52
- `https://<slug>.greatstore.ai`). Used for local dev:
53
- `GS_API_BASE=http://demo.localhost:8787`.
54
- - `GS_NAV_BASE` — override the nav OAuth base (default
55
- `https://nav.maker.co`). Used for testing against a non-prod Clerk
56
- tenant.
57
- - `GS_BROWSER_CMD` — override the command used to open the browser
58
- during `gs login`. Defaults to `open` on macOS, `xdg-open` on Linux,
59
- `start` on Windows.
60
-
61
- ## Credentials storage
62
-
63
- `~/.greatstore/credentials.json` is created with mode `0700` on its
64
- directory and `0600` on the file. The CLI verifies this on every read
65
- and refuses to use a file with broader permissions.
66
-
67
- The credentials file holds a single short-lived JWT plus its decoded
68
- identity claims. There is no refresh token; when the JWT expires, the
69
- next command prompts for re-auth and re-runs the browser flow.
70
-
71
- ## Development
72
-
73
- ```
74
- cd cli
75
- npm install
76
- npm run typecheck
77
- npm test
78
- npm run build
79
- node dist/cli.js --help
80
- ```
81
-
82
- To exercise against local `wrangler dev`, point at the tenant host:
83
-
84
- ```
85
- GS_API_BASE=http://demo.localhost:8787 \
86
- GS_NAV_BASE=https://nav.maker.co \
87
- node dist/cli.js list --store demo
88
- ```
89
-
90
- ## Release flow
91
-
92
- 1. Bump `cli/package.json` version.
93
- 2. Tag: `git tag cli-v0.0.2 && git push origin cli-v0.0.2`.
94
- 3. `cli-publish` GitHub Actions workflow runs typecheck + test + build,
95
- then `npm publish --access public` with `NPM_TOKEN`.
package/dist/cli.js CHANGED
@@ -743,10 +743,18 @@ function viteConfig() {
743
743
  return `import { defineConfig } from "vite";
744
744
  import react from "@vitejs/plugin-react";
745
745
 
746
- // Builds a single ESM bundle suitable for \`gs push\`. React + ReactDOM
747
- // are externalized \u2014 the GreatStore runtime provides them at load time.
746
+ // Builds a single self-contained ESM bundle suitable for \`gs push\`.
747
+ // React + ReactDOM are bundled in so the file is portable across
748
+ // origins; the storefront mounts each component inside a shadow root
749
+ // so a duplicate React instance is harmless in practice.
750
+ // \`process.env.NODE_ENV\` is substituted at build time \u2014 react-dom
751
+ // reads it to pick prod vs. dev mode, and lib builds don't do this
752
+ // replacement on their own.
748
753
  export default defineConfig({
749
754
  plugins: [react()],
755
+ define: {
756
+ "process.env.NODE_ENV": JSON.stringify("production"),
757
+ },
750
758
  build: {
751
759
  lib: {
752
760
  entry: "component.tsx",
@@ -756,7 +764,6 @@ export default defineConfig({
756
764
  outDir: ".",
757
765
  emptyOutDir: false,
758
766
  rollupOptions: {
759
- external: ["react", "react-dom", "react/jsx-runtime"],
760
767
  output: { entryFileNames: "bundle.js" },
761
768
  },
762
769
  minify: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatstore/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "CLI for authoring and shipping GreatStore custom components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",