@stackable-labs/cli-app-extension 1.0.0 → 1.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.
- package/README.md +84 -3
- package/dist/index.js +586 -418
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,9 +1,90 @@
|
|
|
1
1
|
# @stackable-labs/cli-app-extension
|
|
2
2
|
|
|
3
|
-
CLI for scaffolding Stackable extension projects
|
|
3
|
+
CLI for scaffolding new [Stackable](https://www.npmjs.com/package/@stackable-labs/sdk-extension-react) extension projects.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npx @stackable-labs/cli-app-extension my-extension
|
|
9
9
|
```
|
|
10
|
+
|
|
11
|
+
Or run interactively with no arguments:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @stackable-labs/cli-app-extension
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Interactive Mode
|
|
18
|
+
|
|
19
|
+
When run without all required flags, the CLI guides you through a step-by-step prompt flow:
|
|
20
|
+
|
|
21
|
+
| Step | Prompt | Description |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| 1 | **App** | Select the App you are building an Extension for (fetched live from the API) |
|
|
24
|
+
| 2 | **Name** | Display name for your Extension (e.g. `My Commerce Extension`) |
|
|
25
|
+
| 3 | **Targets** | Multiselect from the Surface targets/slots exposed by the selected app |
|
|
26
|
+
| 4 | **Extension Port** | Dev server port for the Extension (default: `5173`) |
|
|
27
|
+
| 5 | **Preview Port** | Dev server port for the Preview host (default: `5174`) |
|
|
28
|
+
| 6 | **Directory** | Output directory path (default: kebab-case of name) |
|
|
29
|
+
| 7 | **Confirm** | Review all selections before scaffolding |
|
|
30
|
+
|
|
31
|
+
## CLI Flags
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Usage: create-extension [name] [options]
|
|
35
|
+
|
|
36
|
+
Options:
|
|
37
|
+
--extension-port <port> Extension dev server port (skips port prompt)
|
|
38
|
+
--preview-port <port> Preview host dev server port (skips port prompt)
|
|
39
|
+
--skip-install Skip package manager install after scaffolding
|
|
40
|
+
--skip-git Skip git initialization
|
|
41
|
+
-h, --help Display help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Local Development
|
|
45
|
+
|
|
46
|
+
To run the CLI locally from source against the live API:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm build
|
|
50
|
+
pnpm cli
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or pass flags directly:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm cli -- --skip-install --skip-git
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Scaffolded Project Structure
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
my-extension/
|
|
63
|
+
├── packages/
|
|
64
|
+
│ ├── extension/ ← Extension source (Vite + React)
|
|
65
|
+
│ │ ├── src/
|
|
66
|
+
│ │ │ ├── index.tsx ← Extension entry point
|
|
67
|
+
│ │ │ └── surfaces/ ← One component per selected target slot
|
|
68
|
+
│ │ ├── manifest.json ← Extension manifest (id, targets, permissions)
|
|
69
|
+
│ │ └── .env ← EXTENSION_PORT, PREVIEW_PORT
|
|
70
|
+
│ └── preview/ ← Preview host app (Vite + React)
|
|
71
|
+
│ └── src/
|
|
72
|
+
│ └── App.tsx ← Host app wiring up the extension
|
|
73
|
+
├── turbo.json
|
|
74
|
+
└── package.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Development Workflow
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd my-extension
|
|
81
|
+
pnpm install # if --skip-install was used
|
|
82
|
+
pnpm dev # starts both extension + preview with hot-reload
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The preview host runs at the configured preview port and hot-reloads whenever the extension changes.
|
|
86
|
+
|
|
87
|
+
## Requirements
|
|
88
|
+
|
|
89
|
+
- Node 20+
|
|
90
|
+
- pnpm (recommended) or npm/yarn
|