@stackable-labs/cli-app-extension 1.6.0 → 1.6.2
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/dist/index.js +74 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1282,6 +1282,28 @@ export default function App() {
|
|
|
1282
1282
|
`;
|
|
1283
1283
|
await writeFile(appPath, appContent);
|
|
1284
1284
|
};
|
|
1285
|
+
var patchViteAllowedHosts = async (rootDir) => {
|
|
1286
|
+
const configs = [
|
|
1287
|
+
join(rootDir, "packages/extension/vite.config.ts"),
|
|
1288
|
+
join(rootDir, "packages/preview/vite.config.ts")
|
|
1289
|
+
];
|
|
1290
|
+
for (const configPath of configs) {
|
|
1291
|
+
let content;
|
|
1292
|
+
try {
|
|
1293
|
+
content = await readFile(configPath, "utf8");
|
|
1294
|
+
} catch {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
if (content.includes("allowedHosts")) continue;
|
|
1298
|
+
const patched = content.replace(
|
|
1299
|
+
/server:\s*\{/,
|
|
1300
|
+
"server: {\n allowedHosts: 'all',"
|
|
1301
|
+
);
|
|
1302
|
+
if (patched !== content) {
|
|
1303
|
+
await writeFile(configPath, patched);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1285
1307
|
var rewriteTurboJson = async (rootDir) => {
|
|
1286
1308
|
const turboPath = join(rootDir, "turbo.json");
|
|
1287
1309
|
const raw = await readFile(turboPath, "utf8");
|
|
@@ -1330,6 +1352,7 @@ var scaffold = async (options) => {
|
|
|
1330
1352
|
await rewriteExtensionIndex(dir, options.extensionId || options.name, selectedTargets);
|
|
1331
1353
|
await rewritePreviewApp(dir, selectedTargets, derivedPermissions);
|
|
1332
1354
|
await rewriteTurboJson(dir);
|
|
1355
|
+
await patchViteAllowedHosts(dir);
|
|
1333
1356
|
await writeEnvFile(dir, options.extensionPort, options.previewPort);
|
|
1334
1357
|
await updateGitignore(dir);
|
|
1335
1358
|
return options;
|
|
@@ -1795,7 +1818,7 @@ var startTunnel = (port) => new Promise((resolve, reject) => {
|
|
|
1795
1818
|
reject(new Error("Tunnel connection timed out after 30s"));
|
|
1796
1819
|
}, 3e4);
|
|
1797
1820
|
tunnel.once("url", (url) => {
|
|
1798
|
-
console.log(
|
|
1821
|
+
console.log(">>> > startTunnel > url:", { url });
|
|
1799
1822
|
clearTimeout(timeout);
|
|
1800
1823
|
resolve({ url, stop: () => tunnel.stop() });
|
|
1801
1824
|
});
|
|
@@ -1888,45 +1911,54 @@ var DevDashboard = ({
|
|
|
1888
1911
|
onQuit();
|
|
1889
1912
|
}
|
|
1890
1913
|
});
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
")
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1914
|
+
const previewUrl = tunnelUrl ? `${tunnelUrl.replace(/\/$/, "")}/preview` : `http://localhost:${previewPort}`;
|
|
1915
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
|
|
1916
|
+
/* @__PURE__ */ jsx15(Banner, {}),
|
|
1917
|
+
/* @__PURE__ */ jsxs15(
|
|
1918
|
+
StepShell,
|
|
1919
|
+
{
|
|
1920
|
+
title: "dev",
|
|
1921
|
+
hint: "Live development with tunnel",
|
|
1922
|
+
footer: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
|
|
1923
|
+
bundleUrlUpdated && /* @__PURE__ */ jsx15(Text15, { color: "green", children: "bundleUrl updated \u2713" }),
|
|
1924
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Press q or Ctrl-C to quit" })
|
|
1925
|
+
] }),
|
|
1926
|
+
children: [
|
|
1927
|
+
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
|
|
1928
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1929
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Extension:" }),
|
|
1930
|
+
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1931
|
+
extensionName,
|
|
1932
|
+
" (",
|
|
1933
|
+
extensionId,
|
|
1934
|
+
")"
|
|
1935
|
+
] })
|
|
1936
|
+
] }),
|
|
1937
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1938
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "App:" }),
|
|
1939
|
+
/* @__PURE__ */ jsx15(Text15, { children: `${appName ? `${appName} ` : ""}(${appId})` })
|
|
1940
|
+
] })
|
|
1941
|
+
] }),
|
|
1942
|
+
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", gap: 1, children: [
|
|
1943
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1944
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local Dev - Preview:" }),
|
|
1945
|
+
/* @__PURE__ */ jsx15(Text15, { children: previewUrl })
|
|
1946
|
+
] }),
|
|
1947
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1948
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Local Dev - Extension:" }),
|
|
1949
|
+
/* @__PURE__ */ jsxs15(Text15, { children: [
|
|
1950
|
+
"http://localhost:",
|
|
1951
|
+
extensionPort
|
|
1952
|
+
] })
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ jsxs15(Box15, { gap: 2, children: [
|
|
1955
|
+
/* @__PURE__ */ jsx15(Text15, { dimColor: true, children: "Tunnel Dev - Extension:" }),
|
|
1956
|
+
/* @__PURE__ */ jsx15(Text15, { children: tunnelUrl || "Connecting\u2026" })
|
|
1957
|
+
] })
|
|
1958
|
+
] })
|
|
1959
|
+
]
|
|
1960
|
+
}
|
|
1961
|
+
)
|
|
1930
1962
|
] });
|
|
1931
1963
|
};
|
|
1932
1964
|
|
|
@@ -1962,6 +1994,7 @@ var DevApp = ({ options = {} }) => {
|
|
|
1962
1994
|
extensionId: resolved.extensionId
|
|
1963
1995
|
});
|
|
1964
1996
|
const extensionPort = options.extensionPort ? parseInt(options.extensionPort, 10) : devContext.extensionPort;
|
|
1997
|
+
await patchViteAllowedHosts(devContext.projectRoot);
|
|
1965
1998
|
console.log(`[dev] Starting dev server in ${devContext.projectRoot}`);
|
|
1966
1999
|
const serverHandle = startDevServer(devContext.projectRoot);
|
|
1967
2000
|
setDevServerHandle(serverHandle);
|
|
@@ -2060,7 +2093,7 @@ var DevApp = ({ options = {} }) => {
|
|
|
2060
2093
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2061
2094
|
var require2 = createRequire(import.meta.url);
|
|
2062
2095
|
var { version } = require2("../package.json");
|
|
2063
|
-
program.name("stackable-app-extension").description("Stackable app
|
|
2096
|
+
program.name("stackable-app-extension").description("Stackable app Extension developer CLI").version(version);
|
|
2064
2097
|
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 host dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action((name, options) => {
|
|
2065
2098
|
render(/* @__PURE__ */ jsx17(App, { command: "create" /* CREATE */, initialName: name, options }));
|
|
2066
2099
|
});
|