@stackable-labs/cli-app-extension 1.10.3 → 1.11.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 +39 -2
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ When run without all required flags, the CLI guides you through a step-by-step p
|
|
|
25
25
|
| 1 | **App** | Select the App you are building an Extension for (fetched live from the API) |
|
|
26
26
|
| 2 | **Name** | Display name for your Extension (e.g. `My Commerce Extension`) |
|
|
27
27
|
| 3 | **Targets** | Multiselect from the Surface targets/slots exposed by the selected app |
|
|
28
|
-
| 4 | **Extension Port** | Dev server port for the Extension (default: `
|
|
29
|
-
| 5 | **Preview Port** | Dev server port for the Preview host (default: `
|
|
28
|
+
| 4 | **Extension Port** | Dev server port for the Extension (default: `6543`) |
|
|
29
|
+
| 5 | **Preview Port** | Dev server port for the Preview host (default: `6544`) |
|
|
30
30
|
| 6 | **Directory** | Output directory path (default: kebab-case of name) |
|
|
31
31
|
| 7 | **Confirm** | Review all selections before scaffolding |
|
|
32
32
|
|
|
@@ -76,6 +76,43 @@ my-extension/
|
|
|
76
76
|
└── package.json
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
## `dev` Command
|
|
80
|
+
|
|
81
|
+
Start local dev servers with a public Cloudflare tunnel for testing:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pnpm preview
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
Usage: stackable-app-extension dev [options]
|
|
89
|
+
|
|
90
|
+
Options:
|
|
91
|
+
--dir <path> Project root (default: cwd)
|
|
92
|
+
--extension-port <port> Override Extension port
|
|
93
|
+
--preview-port <port> Override Preview port
|
|
94
|
+
--no-tunnel Skip tunnel, just run vite dev
|
|
95
|
+
-h, --help Display help
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The `dev` command:
|
|
99
|
+
1. Reads `.env.stackable` for cached App/Extension context (prompts if missing)
|
|
100
|
+
2. Starts Cloudflare tunnels for both extension and preview servers
|
|
101
|
+
3. Starts Vite dev servers with hot-reload
|
|
102
|
+
4. Displays a **Host App Query Param** you can append to your host app URL to test against the real deployed host
|
|
103
|
+
|
|
104
|
+
### Host App Override
|
|
105
|
+
|
|
106
|
+
The dashboard displays a query param like:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
?_stackable_dev=ext-123%3Ahttps%3A%2F%2Fabc.trycloudflare.com
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Append this to your deployed host app URL to override the extension's `bundleUrl` in your browser session only. The `@stackable-labs/embeddables` SDK detects this param and loads from your tunnel instead of the production bundle. No DB changes, no shared state — each developer gets isolated overrides.
|
|
113
|
+
|
|
114
|
+
> **Note:** The `dev` command never updates the `bundleUrl` in the database. It is purely local.
|
|
115
|
+
|
|
79
116
|
## Development Workflow
|
|
80
117
|
|
|
81
118
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -287,7 +287,7 @@ import { Box as Box6, Text as Text6, useFocus as useFocus2, useFocusManager as u
|
|
|
287
287
|
import TextInput3 from "ink-text-input";
|
|
288
288
|
import { useState as useState3 } from "react";
|
|
289
289
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
290
|
-
var DEFAULT_EXTENSION_PORT =
|
|
290
|
+
var DEFAULT_EXTENSION_PORT = 6543;
|
|
291
291
|
var DEFAULT_PREVIEW_PORT = DEFAULT_EXTENSION_PORT + 1;
|
|
292
292
|
var FieldRow = ({ label, value, onChange, onSubmit, onConfirm, placeholder, autoFocus, isFirst, isLast }) => {
|
|
293
293
|
const { isFocused } = useFocus2({ autoFocus });
|
|
@@ -622,7 +622,7 @@ var UpdateSettingsPrompt = ({
|
|
|
622
622
|
label: "Bundle URL",
|
|
623
623
|
value: bundleUrlValue,
|
|
624
624
|
onChange: setBundleUrlValue,
|
|
625
|
-
placeholder: "http://localhost:
|
|
625
|
+
placeholder: "http://localhost:6543",
|
|
626
626
|
onSubmitAll: handleSubmitAll
|
|
627
627
|
}
|
|
628
628
|
),
|
|
@@ -1066,8 +1066,8 @@ var readDevContext = async (projectRoot) => {
|
|
|
1066
1066
|
} catch {
|
|
1067
1067
|
}
|
|
1068
1068
|
const devLocalEnv = await readEnvFile(join(projectRoot, ".env.development.local"));
|
|
1069
|
-
const extensionPort = parseInt(devLocalEnv.VITE_EXTENSION_PORT || env.VITE_EXTENSION_PORT || "
|
|
1070
|
-
const previewPort = parseInt(devLocalEnv.VITE_PREVIEW_PORT || env.VITE_PREVIEW_PORT || "
|
|
1069
|
+
const extensionPort = parseInt(devLocalEnv.VITE_EXTENSION_PORT || env.VITE_EXTENSION_PORT || "6543", 10);
|
|
1070
|
+
const previewPort = parseInt(devLocalEnv.VITE_PREVIEW_PORT || env.VITE_PREVIEW_PORT || "6544", 10);
|
|
1071
1071
|
return {
|
|
1072
1072
|
projectRoot,
|
|
1073
1073
|
extensionName,
|
|
@@ -1330,7 +1330,7 @@ const extensions: ExtensionRegistryEntry[] = [
|
|
|
1330
1330
|
{
|
|
1331
1331
|
id: manifest.name.toLowerCase().replace(/\\s+/g, '-'),
|
|
1332
1332
|
manifest,
|
|
1333
|
-
bundleUrl: import.meta.env.VITE_EXTENSION_BUNDLE_URL || \`http://localhost:\${import.meta.env.VITE_EXTENSION_PORT || '
|
|
1333
|
+
bundleUrl: import.meta.env.VITE_EXTENSION_BUNDLE_URL || \`http://localhost:\${import.meta.env.VITE_EXTENSION_PORT || '6543'}\`,
|
|
1334
1334
|
enabled: true,
|
|
1335
1335
|
},
|
|
1336
1336
|
]
|
|
@@ -1513,10 +1513,10 @@ var App = ({ command, initialName, initialExtensionId, options }) => {
|
|
|
1513
1513
|
);
|
|
1514
1514
|
const [selectedApp, setSelectedApp] = useState8(null);
|
|
1515
1515
|
const [extensionPort, setExtensionPort] = useState8(
|
|
1516
|
-
options?.extensionPort ? parseInt(options.extensionPort, 10) :
|
|
1516
|
+
options?.extensionPort ? parseInt(options.extensionPort, 10) : 6543
|
|
1517
1517
|
);
|
|
1518
1518
|
const [previewPort, setPreviewPort] = useState8(
|
|
1519
|
-
options?.previewPort ? parseInt(options.previewPort, 10) :
|
|
1519
|
+
options?.previewPort ? parseInt(options.previewPort, 10) : 6544
|
|
1520
1520
|
);
|
|
1521
1521
|
const [outputDir, setOutputDir] = useState8("");
|
|
1522
1522
|
const [progressSteps, setProgressSteps] = useState8(PROGRESS_STEPS[command]);
|
|
@@ -2190,10 +2190,10 @@ var require2 = createRequire(import.meta.url);
|
|
|
2190
2190
|
var { version } = require2("../package.json");
|
|
2191
2191
|
checkForUpdate(version);
|
|
2192
2192
|
program.name("stackable-app-extension").description("Stackable Labs - App Extension developer CLI").version(version);
|
|
2193
|
-
program.command("create" /* CREATE */).description("Create a new Extension project").argument("[name]", "Extension project name").option("--extension-port <port>", "Extension dev server port (default:
|
|
2193
|
+
program.command("create" /* CREATE */).description("Create a new Extension project").argument("[name]", "Extension project name").option("--extension-port <port>", "Extension dev server port (default: 6543)").option("--preview-port <port>", "Preview dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action((name, options) => {
|
|
2194
2194
|
render(/* @__PURE__ */ jsx17(App, { command: "create" /* CREATE */, initialName: name, options }));
|
|
2195
2195
|
});
|
|
2196
|
-
program.command("scaffold" /* SCAFFOLD */).description("Scaffold a local project from an existing Extension").option("--extension-port <port>", "Extension dev server port (default:
|
|
2196
|
+
program.command("scaffold" /* SCAFFOLD */).description("Scaffold a local project from an existing Extension").option("--extension-port <port>", "Extension dev server port (default: 6543)").option("--preview-port <port>", "Preview dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action((options) => {
|
|
2197
2197
|
render(/* @__PURE__ */ jsx17(App, { command: "scaffold" /* SCAFFOLD */, options }));
|
|
2198
2198
|
});
|
|
2199
2199
|
program.command("update" /* UPDATE */).description("Update an existing Extension").argument("[extensionId]", "Extension ID to update").option("--app-id <id>", "Skip App selection").option("--name <name>", "New Extension name").option("--targets <targets>", "Comma-separated target slots (validated against app)").option("--bundle-url <url>", "New bundle URL").option("--enabled <bool>", "Enable/disable Extension").option("--set-version <version>", "Explicit version (skips auto-compute)").action((extensionId, options) => {
|