@storifycli/cli 0.1.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.
Files changed (3) hide show
  1. package/README.md +156 -0
  2. package/dist/cli.js +1737 -0
  3. package/package.json +51 -0
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # Storify Theme CLI
2
+
3
+ Unified CLI for developing, validating, packaging, and uploading Storify themes.
4
+
5
+ **Documentation:**
6
+
7
+ - **External developers:** [docs/theme-developer-guide/13-CLI-DEV-PREVIEW.md](../../docs/theme-developer-guide/13-CLI-DEV-PREVIEW.md)
8
+ - **Internal / platform team:** [docs/theme/STORIFY_CLI_DEV_PREVIEW.md](../../docs/theme/STORIFY_CLI_DEV_PREVIEW.md)
9
+
10
+ ---
11
+
12
+ ## Quick start
13
+
14
+ ```bash
15
+ # 1. Build CLI (once per clone / after CLI changes)
16
+ cd packages/storify-cli && npm install && npm run build
17
+
18
+ # 2. Start platform services (separate terminals)
19
+ cd shared/backend && npm run dev # :3001
20
+ cd shared/storefront && npm run dev # :3004
21
+ cd shared/admin-central && npm run dev # :3003 (optional)
22
+
23
+ # 3. Develop theme with live storefront preview
24
+ cd themes/storify-templatesrap
25
+ npm install
26
+ npm run dev
27
+ ```
28
+
29
+ Follow prompts: **email → password → choose store** (first run only).
30
+
31
+ ---
32
+
33
+ ## Install
34
+
35
+ **From npm (recommended for theme developers):**
36
+
37
+ ```bash
38
+ npm install -g @storifycli/cli
39
+ storify --help
40
+ ```
41
+
42
+ Or run without global install:
43
+
44
+ ```bash
45
+ npx @storifycli/cli theme dev
46
+ ```
47
+
48
+ Do **not** use bare `npx storify` — it resolves to an unrelated legacy npm package.
49
+
50
+ **From the Storify monorepo (platform team):**
51
+
52
+ ```bash
53
+ cd packages/storify-cli && npm install && npm run build
54
+ npm link # optional global `storify` command
55
+ ```
56
+
57
+ Theme folders can also call the local build directly:
58
+
59
+ ```json
60
+ "dev": "node ../../packages/storify-cli/dist/cli.js theme dev"
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Authentication
66
+
67
+ ```bash
68
+ storify login
69
+ ```
70
+
71
+ Interactive flow:
72
+
73
+ 1. Email
74
+ 2. Password
75
+ 3. Pick store by **name**
76
+
77
+ Saves `~/.storify/config.json`:
78
+
79
+ | Key | Default (local) |
80
+ |-----|-----------------|
81
+ | `apiUrl` | `http://localhost:3001/api` |
82
+ | `storefrontUrl` | `http://localhost:3004` |
83
+ | `adminUrl` | `http://localhost:3003` |
84
+
85
+ Requires backend `LEGACY_TOKEN_RESPONSE=true` for bearer token in login response.
86
+
87
+ Environment overrides: `STORIFY_API_URL`, `STORIFY_AUTH_TOKEN`, `STORIFY_STORE_ID`, `STORIFY_STOREFRONT_URL`, `STORIFY_ADMIN_URL`.
88
+
89
+ ---
90
+
91
+ ## Commands
92
+
93
+ | Command | Description |
94
+ |---------|-------------|
95
+ | `storify` | Interactive menu |
96
+ | `storify login` | Save credentials |
97
+ | `storify status` | Config + theme folder |
98
+ | `storify theme dev` | Vite + live storefront preview (default) |
99
+ | `storify theme validate` | Manifest + section checks |
100
+ | `storify theme build` | Vite build + generated manifest |
101
+ | `storify theme pack` | Upload-ready zip |
102
+ | `storify theme upload` | POST to `/api/uploaded-themes` |
103
+ | `storify theme new <name>` | Copy starter template |
104
+
105
+ Aliases: `storify theme check`, `storify theme zip`.
106
+
107
+ ---
108
+
109
+ ## `storify theme dev`
110
+
111
+ Starts Vite, registers **dev theme link** on the platform, prints preview URLs.
112
+
113
+ ```bash
114
+ storify theme dev
115
+ storify theme dev --local # force localhost (no tunnel)
116
+ storify theme dev --remote # production storefront + cloudflared
117
+ storify theme dev --no-link-store # Vite only
118
+ storify theme dev --open-storefront
119
+ storify theme dev --port 3000
120
+ ```
121
+
122
+ **Startup order:** Vite starts first → dev-link PATCH → preview URLs printed.
123
+
124
+ **Preview URLs:**
125
+
126
+ | Label | Example |
127
+ |-------|---------|
128
+ | Storefront | `http://localhost:3004/demo-dev-store/` |
129
+ | Theme (Vite) | `http://localhost:3006` |
130
+ | Admin editor | `http://localhost:3003/demo-dev-store/admin/theme/edit` |
131
+
132
+ On Ctrl+C, dev link is disabled automatically.
133
+
134
+ ---
135
+
136
+ ## Recommended workflow
137
+
138
+ ```bash
139
+ storify login
140
+ cd themes/storify-templatesrap
141
+ storify theme dev
142
+ storify theme validate
143
+ storify theme pack
144
+ storify theme upload
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Development
150
+
151
+ ```bash
152
+ cd packages/storify-cli
153
+ npm run dev # run CLI via tsx (development)
154
+ npm run build # tsup → dist/cli.js
155
+ npm run typecheck
156
+ ```