@stackable-labs/cli-app-extension 1.9.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.
- package/README.md +25 -2
- package/dist/index.js +45 -0
- 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
|
@@ -2194,10 +2194,55 @@ var DevApp = ({ options = {} }) => {
|
|
|
2194
2194
|
return /* @__PURE__ */ jsx16(Box16, { children: /* @__PURE__ */ jsx16(Text16, { children: "Loading..." }) });
|
|
2195
2195
|
};
|
|
2196
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
|
+
|
|
2197
2241
|
// src/index.tsx
|
|
2198
2242
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2199
2243
|
var require2 = createRequire(import.meta.url);
|
|
2200
2244
|
var { version } = require2("../package.json");
|
|
2245
|
+
checkForUpdate(version);
|
|
2201
2246
|
program.name("stackable-app-extension").description("Stackable Labs - App Extension developer CLI").version(version);
|
|
2202
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) => {
|
|
2203
2248
|
render(/* @__PURE__ */ jsx17(App, { command: "create" /* CREATE */, initialName: name, options }));
|