create-zenbu-app 0.0.23 → 0.0.25
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.mjs
CHANGED
|
@@ -1251,6 +1251,28 @@ async function promptIconPath() {
|
|
|
1251
1251
|
if (!trimmed) return void 0;
|
|
1252
1252
|
return path.isAbsolute(trimmed) ? trimmed : path.resolve(process.cwd(), trimmed);
|
|
1253
1253
|
}
|
|
1254
|
+
const DESKTOP_PM_PRECEDENCE = [
|
|
1255
|
+
"pnpm",
|
|
1256
|
+
"bun",
|
|
1257
|
+
"yarn",
|
|
1258
|
+
"npm"
|
|
1259
|
+
];
|
|
1260
|
+
function pickDesktopPm(detected) {
|
|
1261
|
+
for (const candidate of DESKTOP_PM_PRECEDENCE) {
|
|
1262
|
+
if (candidate === "npm") return {
|
|
1263
|
+
type: "npm",
|
|
1264
|
+
version: detected.version,
|
|
1265
|
+
fallback: false
|
|
1266
|
+
};
|
|
1267
|
+
const v = probeVersion(candidate);
|
|
1268
|
+
if (v) return {
|
|
1269
|
+
type: candidate,
|
|
1270
|
+
version: v,
|
|
1271
|
+
fallback: false
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
return detected;
|
|
1275
|
+
}
|
|
1254
1276
|
async function runDesktopMode() {
|
|
1255
1277
|
p.intro("create-zenbu-app (desktop)");
|
|
1256
1278
|
let displayName;
|
|
@@ -1276,8 +1298,7 @@ async function runDesktopMode() {
|
|
|
1276
1298
|
const slugTemplate = "tailwind";
|
|
1277
1299
|
const templateDir = path.join(TEMPLATES_DIR, slugTemplate);
|
|
1278
1300
|
if (!fs.existsSync(templateDir)) bail(`No template found for configuration "${slugTemplate}".`);
|
|
1279
|
-
|
|
1280
|
-
if (pm.type === "npm") pm = await resolveNpmAmbiguity(pm, { yes });
|
|
1301
|
+
const pm = pickDesktopPm(detectPackageManager());
|
|
1281
1302
|
const log = createLogger({
|
|
1282
1303
|
slug,
|
|
1283
1304
|
verbose: desktopVerbose
|
|
@@ -1292,7 +1313,13 @@ async function runDesktopMode() {
|
|
|
1292
1313
|
if (desktopDryRun) log.info(`[dry-run] would scaffold template into ${appsDir}`);
|
|
1293
1314
|
else {
|
|
1294
1315
|
fs.mkdirSync(appsDir, { recursive: true });
|
|
1295
|
-
|
|
1316
|
+
const ctx = {
|
|
1317
|
+
projectName: slug,
|
|
1318
|
+
displayName
|
|
1319
|
+
};
|
|
1320
|
+
copyDirSync(templateDir, appsDir, ctx);
|
|
1321
|
+
const overlayDir = path.join(TEMPLATES_DIR, "desktop-overlay");
|
|
1322
|
+
if (fs.existsSync(overlayDir)) copyDirSync(overlayDir, appsDir, ctx);
|
|
1296
1323
|
const gi = path.join(appsDir, "_gitignore");
|
|
1297
1324
|
if (fs.existsSync(gi)) fs.renameSync(gi, path.join(appsDir, ".gitignore"));
|
|
1298
1325
|
seedPackageManager(appsDir, pm);
|
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useRpc } from "@zenbujs/core/react"
|
|
2
|
+
import { useEffect, useState } from "react"
|
|
3
|
+
|
|
4
|
+
export function Home() {
|
|
5
|
+
const rpc = useRpc()
|
|
6
|
+
const [cwd, setCwd] = useState<string | null>(null)
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
rpc.app.cwd.get().then(setCwd)
|
|
10
|
+
}, [rpc])
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<main className="flex-1 flex flex-col px-8 pt-6 pb-4 font-sans text-zinc-900 dark:text-zinc-100">
|
|
14
|
+
<div className="flex-1 max-w-prose">
|
|
15
|
+
<h1 className="text-2xl font-semibold mb-2">{{displayName}}</h1>
|
|
16
|
+
<p className="text-zinc-500 dark:text-zinc-400 text-sm leading-relaxed mb-6">
|
|
17
|
+
This app is yours to edit. The source lives on your machine and any
|
|
18
|
+
change you save reloads instantly — tweak the UI, add features, or
|
|
19
|
+
install plugins without rebuilding.
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<div className="text-xs uppercase tracking-wide text-zinc-400 dark:text-zinc-500 mb-1.5">
|
|
23
|
+
Source
|
|
24
|
+
</div>
|
|
25
|
+
<code className="block p-2 rounded bg-zinc-100 dark:bg-zinc-900 text-zinc-700 dark:text-zinc-300 text-xs truncate">
|
|
26
|
+
{cwd ?? "\u00a0"}
|
|
27
|
+
</code>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<footer className="mt-6 text-xs text-zinc-400 dark:text-zinc-600">
|
|
31
|
+
Built with{" "}
|
|
32
|
+
<a
|
|
33
|
+
href="https://github.com/zenbu-labs/zenbu.js"
|
|
34
|
+
onClick={(e) => {
|
|
35
|
+
e.preventDefault()
|
|
36
|
+
rpc.core.window.openExternal(
|
|
37
|
+
"https://github.com/zenbu-labs/zenbu.js",
|
|
38
|
+
)
|
|
39
|
+
}}
|
|
40
|
+
className="underline underline-offset-2 hover:text-zinc-600 dark:hover:text-zinc-400 transition-colors"
|
|
41
|
+
>
|
|
42
|
+
zenbu.js
|
|
43
|
+
</a>
|
|
44
|
+
</footer>
|
|
45
|
+
</main>
|
|
46
|
+
)
|
|
47
|
+
}
|