@stackable-labs/cli-app-extension 1.8.0 → 1.10.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 +25 -2
  2. package/dist/index.js +60 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,15 +5,17 @@ CLI for scaffolding new [Stackable](https://www.npmjs.com/package/@stackable-lab
5
5
  ## Quick Start
6
6
 
7
7
  ```bash
8
- npx @stackable-labs/cli-app-extension my-extension
8
+ npx @stackable-labs/cli-app-extension@latest create my-extension
9
9
  ```
10
10
 
11
11
  Or run interactively with no arguments:
12
12
 
13
13
  ```bash
14
- npx @stackable-labs/cli-app-extension
14
+ npx @stackable-labs/cli-app-extension@latest create
15
15
  ```
16
16
 
17
+ > **Important:** Always include `@latest` to ensure you get the most recent version. Both `npx` and `pnpm dlx` aggressively cache packages.
18
+
17
19
  ## Interactive Mode
18
20
 
19
21
  When run without all required flags, the CLI guides you through a step-by-step prompt flow:
@@ -84,6 +86,27 @@ pnpm dev # starts both Extension + Preview with hot-reload
84
86
 
85
87
  The preview host runs at the configured preview port and hot-reloads whenever the Extension changes.
86
88
 
89
+ ## Troubleshooting
90
+
91
+ ### Stale CLI version after update
92
+
93
+ Both `npx` and `pnpm dlx` cache downloaded packages. If you're seeing an older version after a new release:
94
+
95
+ **npx** — Always use `@latest` and clear the cache if needed:
96
+ ```bash
97
+ npx @stackable-labs/cli-app-extension@latest create
98
+
99
+ # If still stale, clear the npx cache:
100
+ npx clear-npx-cache
101
+ ```
102
+
103
+ **pnpm dlx** — Force a fresh resolve:
104
+ ```bash
105
+ pnpm dlx --recreate-lockfile @stackable-labs/cli-app-extension@latest create
106
+ ```
107
+
108
+ > **Note:** After a new version is published to npm, there may be a brief delay (up to ~15 minutes) before the npm CDN propagates the update.
109
+
87
110
  ## Requirements
88
111
 
89
112
  - Node 20+
package/dist/index.js CHANGED
@@ -1941,8 +1941,8 @@ var DevDashboard = ({
1941
1941
  process.off("SIGINT", handler);
1942
1942
  };
1943
1943
  }, [onQuit]);
1944
- useInput8((input) => {
1945
- if (input === "q") {
1944
+ useInput8((input, key) => {
1945
+ if (input === "q" || key.ctrl && input === "c") {
1946
1946
  onQuit();
1947
1947
  }
1948
1948
  });
@@ -1952,7 +1952,7 @@ var DevDashboard = ({
1952
1952
  StepShell,
1953
1953
  {
1954
1954
  title: "dev",
1955
- hint: "Live development with tunnel",
1955
+ hint: "Live development with Tunnel",
1956
1956
  footer: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
1957
1957
  bundleUrlUpdated && /* @__PURE__ */ jsx15(Text15, { color: "green", children: "bundleUrl updated \u2713" }),
1958
1958
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Press q or Ctrl-C to quit" })
@@ -1974,9 +1974,9 @@ var DevDashboard = ({
1974
1974
  ] })
1975
1975
  ] }),
1976
1976
  /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
1977
- /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1977
+ previewTunnelUrl && /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1978
1978
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel Dev - Preview:" }),
1979
- /* @__PURE__ */ jsx15(Text15, { children: previewTunnelUrl || "Connecting\u2026" })
1979
+ /* @__PURE__ */ jsx15(Text15, { children: previewTunnelUrl })
1980
1980
  ] }),
1981
1981
  /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1982
1982
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local Dev - Preview:" }),
@@ -1985,9 +1985,9 @@ var DevDashboard = ({
1985
1985
  previewPort
1986
1986
  ] })
1987
1987
  ] }),
1988
- /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1988
+ tunnelUrl && /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1989
1989
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel Dev - Extension:" }),
1990
- /* @__PURE__ */ jsx15(Text15, { children: tunnelUrl || "Connecting\u2026" })
1990
+ /* @__PURE__ */ jsx15(Text15, { children: tunnelUrl })
1991
1991
  ] }),
1992
1992
  /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
1993
1993
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local Dev - Extension:" }),
@@ -1998,7 +1998,10 @@ var DevDashboard = ({
1998
1998
  ] }),
1999
1999
  /* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
2000
2000
  /* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Bundle URL:" }),
2001
- /* @__PURE__ */ jsx15(Text15, { children: bundleUrlUpdated ? `(${tunnelUrl}) updated \u2713` : "" })
2001
+ /* @__PURE__ */ jsxs15(Text15, { children: [
2002
+ tunnelUrl || `http://localhost:${extensionPort}`,
2003
+ bundleUrlUpdated ? " (updated \u2713)" : ""
2004
+ ] })
2002
2005
  ] })
2003
2006
  ] })
2004
2007
  ]
@@ -2185,13 +2188,61 @@ var DevApp = ({ options = {} }) => {
2185
2188
  }
2186
2189
  );
2187
2190
  }
2191
+ if (state === "stopping") {
2192
+ return null;
2193
+ }
2188
2194
  return /* @__PURE__ */ jsx16(Box16, { children: /* @__PURE__ */ jsx16(Text16, { children: "Loading..." }) });
2189
2195
  };
2190
2196
 
2197
+ // src/lib/versionCheck.ts
2198
+ import https from "https";
2199
+ var PACKAGE_NAME = "@stackable-labs/cli-app-extension";
2200
+ var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
2201
+ var TIMEOUT_MS = 3e3;
2202
+ var isNewer = (a, b) => {
2203
+ const pa = a.split(".").map(Number);
2204
+ const pb = b.split(".").map(Number);
2205
+ for (let i = 0; i < 3; i++) {
2206
+ if ((pa[i] ?? 0) > (pb[i] ?? 0)) return true;
2207
+ if ((pa[i] ?? 0) < (pb[i] ?? 0)) return false;
2208
+ }
2209
+ return false;
2210
+ };
2211
+ var checkForUpdate = (currentVersion) => {
2212
+ try {
2213
+ const req = https.get(REGISTRY_URL, { timeout: TIMEOUT_MS }, (res) => {
2214
+ let data = "";
2215
+ res.on("data", (chunk) => {
2216
+ data += chunk.toString();
2217
+ });
2218
+ res.on("end", () => {
2219
+ try {
2220
+ const { version: latest } = JSON.parse(data);
2221
+ if (latest && latest !== currentVersion && isNewer(latest, currentVersion)) {
2222
+ const warning = "\n\x1B[33m\u26A0 Update available: " + currentVersion + " \u2192 " + latest + "\x1B[0m\n Run \x1B[36mnpx @stackable-labs/cli-app-extension@latest\x1B[0m to update\n";
2223
+ console.error(warning);
2224
+ }
2225
+ } catch {
2226
+ }
2227
+ });
2228
+ });
2229
+ req.on("socket", (socket) => {
2230
+ socket.unref();
2231
+ });
2232
+ req.on("error", () => {
2233
+ });
2234
+ req.on("timeout", () => {
2235
+ req.destroy();
2236
+ });
2237
+ } catch {
2238
+ }
2239
+ };
2240
+
2191
2241
  // src/index.tsx
2192
2242
  import { jsx as jsx17 } from "react/jsx-runtime";
2193
2243
  var require2 = createRequire(import.meta.url);
2194
2244
  var { version } = require2("../package.json");
2245
+ checkForUpdate(version);
2195
2246
  program.name("stackable-app-extension").description("Stackable Labs - App Extension developer CLI").version(version);
2196
2247
  program.command("create" /* CREATE */).description("Create a new Extension project").argument("[name]", "Extension project name").option("--extension-port <port>", "Extension dev server port (default: 5173)").option("--preview-port <port>", "Preview dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action((name, options) => {
2197
2248
  render(/* @__PURE__ */ jsx17(App, { command: "create" /* CREATE */, initialName: name, options }));
@@ -2203,6 +2254,6 @@ program.command("update" /* UPDATE */).description("Update an existing Extension
2203
2254
  render(/* @__PURE__ */ jsx17(App, { command: "update" /* UPDATE */, initialExtensionId: extensionId, options }));
2204
2255
  });
2205
2256
  program.command("dev" /* DEV */).description("Start dev servers with a public tunnel").option("--dir <path>", "Project root (default: cwd)").option("--extension-port <port>", "Override Extension port").option("--preview-port <port>", "Override Preview port").option("--no-tunnel", "Skip tunnel, just run vite dev").option("--no-update", "Skip bundleUrl update on server").option("--no-restore", "On exit, keep tunnel URL as bundleUrl").action((options) => {
2206
- render(/* @__PURE__ */ jsx17(DevApp, { options }));
2257
+ render(/* @__PURE__ */ jsx17(DevApp, { options }), { exitOnCtrlC: false });
2207
2258
  });
2208
2259
  program.parse(process.argv.filter((arg) => arg !== "--"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackable-labs/cli-app-extension",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "bin": {