create-zenbu-app 0.0.6 → 0.0.9
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 +50 -3
- package/dist/index.mjs +349 -40
- package/package.json +5 -2
- package/templates/plugin/_gitignore +3 -0
- package/templates/plugin/package.json +24 -0
- package/templates/plugin/src/main/services/{{projectName}}.ts.tmpl +9 -0
- package/templates/plugin/tsconfig.json +14 -0
- package/templates/plugin/zenbu.plugin.ts.tmpl +6 -0
- package/{template → templates/tailwind}/package.json +1 -1
- package/templates/tailwind/src/main/schema.ts.tmpl +13 -0
- package/{template/src/main/services/app.ts.tmpl → templates/tailwind/src/main/services/init.ts.tmpl} +3 -3
- package/{template → templates/tailwind}/src/renderer/App.tsx.tmpl +7 -9
- package/{template → templates/tailwind}/src/renderer/main.tsx.tmpl +3 -3
- package/{template → templates/tailwind}/zenbu.config.ts.tmpl +7 -6
- package/templates/vanilla/_gitignore +8 -0
- package/templates/vanilla/electron-builder.json +12 -0
- package/templates/vanilla/package.json +45 -0
- package/templates/vanilla/src/main/schema.ts.tmpl +13 -0
- package/templates/vanilla/src/main/services/init.ts.tmpl +11 -0
- package/templates/vanilla/src/main/services/repo.ts.tmpl +11 -0
- package/templates/vanilla/src/renderer/App.tsx.tmpl +83 -0
- package/templates/vanilla/src/renderer/app.css +143 -0
- package/templates/vanilla/src/renderer/index.html +12 -0
- package/templates/vanilla/src/renderer/installing.html +118 -0
- package/templates/vanilla/src/renderer/main.tsx.tmpl +10 -0
- package/templates/vanilla/src/renderer/splash.html +22 -0
- package/templates/vanilla/tsconfig.json.tmpl +18 -0
- package/templates/vanilla/vite.config.ts.tmpl +16 -0
- package/templates/vanilla/zenbu.config.ts.tmpl +56 -0
- package/template/src/main/schema.ts.tmpl +0 -16
- /package/{template → templates/tailwind}/_gitignore +0 -0
- /package/{template → templates/tailwind}/electron-builder.json +0 -0
- /package/{template → templates/tailwind}/src/main/services/repo.ts.tmpl +0 -0
- /package/{template → templates/tailwind}/src/renderer/app.css +0 -0
- /package/{template → templates/tailwind}/src/renderer/index.html +0 -0
- /package/{template → templates/tailwind}/src/renderer/installing.html +0 -0
- /package/{template → templates/tailwind}/src/renderer/splash.html +0 -0
- /package/{template → templates/tailwind}/tsconfig.json.tmpl +0 -0
- /package/{template → templates/tailwind}/vite.config.ts.tmpl +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDb, useDbClient, useRpc } from "@zenbujs/core/react"
|
|
2
2
|
import { useState } from "react"
|
|
3
3
|
|
|
4
4
|
function Titlebar() {
|
|
@@ -17,7 +17,7 @@ function Home() {
|
|
|
17
17
|
const rpc = useRpc()
|
|
18
18
|
const [cwd, setCwd] = useState<string | null>(null)
|
|
19
19
|
|
|
20
|
-
const issues = db.
|
|
20
|
+
const issues = db.app.issues
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<main className="flex-1 px-8 pb-8 font-sans text-[#e5e5e5]">
|
|
@@ -34,7 +34,7 @@ function Home() {
|
|
|
34
34
|
const title = (form.elements.namedItem("title") as HTMLInputElement).value
|
|
35
35
|
if (!title.trim()) return
|
|
36
36
|
client.update((db) => {
|
|
37
|
-
db.
|
|
37
|
+
db.app.issues.push({
|
|
38
38
|
id: crypto.randomUUID(),
|
|
39
39
|
title,
|
|
40
40
|
createdAt: Date.now(),
|
|
@@ -92,11 +92,9 @@ function Home() {
|
|
|
92
92
|
|
|
93
93
|
export function App() {
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</div>
|
|
100
|
-
</ZenbuProvider>
|
|
95
|
+
<div className="flex flex-col min-h-screen">
|
|
96
|
+
<Titlebar />
|
|
97
|
+
<Home />
|
|
98
|
+
</div>
|
|
101
99
|
)
|
|
102
100
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { StrictMode } from "react"
|
|
2
1
|
import { createRoot } from "react-dom/client"
|
|
2
|
+
import { ZenbuProvider } from "@zenbujs/core/react"
|
|
3
3
|
import { App } from "./App"
|
|
4
4
|
import "./app.css"
|
|
5
5
|
|
|
6
6
|
createRoot(document.getElementById("root")!).render(
|
|
7
|
-
<
|
|
7
|
+
<ZenbuProvider>
|
|
8
8
|
<App />
|
|
9
|
-
</
|
|
9
|
+
</ZenbuProvider>,
|
|
10
10
|
)
|
|
@@ -26,12 +26,13 @@ export default defineConfig({
|
|
|
26
26
|
// `mirror.target` to "<owner>/<repo>" before shipping.
|
|
27
27
|
build: defineBuildConfig({
|
|
28
28
|
// {{packageManager}}
|
|
29
|
-
// The .app's "host version"
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// `
|
|
33
|
-
//
|
|
34
|
-
|
|
29
|
+
// The .app's "host version" comes from `package.json#version` —
|
|
30
|
+
// read at build time and baked into <bundle>/host.json. Bump
|
|
31
|
+
// `package.json#version` every time you ship a new .app build.
|
|
32
|
+
// Each commit's `package.json#zenbu.host` semver range is checked
|
|
33
|
+
// against that value at launch (and from `UpdaterService.update()`);
|
|
34
|
+
// incompatible commits are skipped, so older .apps stay pinned to
|
|
35
|
+
// source they can actually run.
|
|
35
36
|
source: ".",
|
|
36
37
|
out: ".zenbu/build/source",
|
|
37
38
|
include: [
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "node_modules/@zenbujs/core/dist/setup-gate.mjs",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "zen dev",
|
|
8
|
+
"build:source": "zen build:source",
|
|
9
|
+
"build:electron": "zen build:electron",
|
|
10
|
+
"publish:source": "zen publish:source",
|
|
11
|
+
"link": "zen link",
|
|
12
|
+
"db:generate": "zen db generate"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zenbujs/core": "^0.0.13",
|
|
16
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
17
|
+
"react": "^19.0.0",
|
|
18
|
+
"react-dom": "^19.0.0",
|
|
19
|
+
"vite": "^6.0.0",
|
|
20
|
+
"zod": "^4.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.0.0",
|
|
24
|
+
"@types/react": "^19.0.0",
|
|
25
|
+
"@types/react-dom": "^19.0.0",
|
|
26
|
+
"electron": "^42.0.0",
|
|
27
|
+
"electron-builder": "^26.0.0"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": ""
|
|
32
|
+
},
|
|
33
|
+
"zenbu": {
|
|
34
|
+
"host": ">=0.0.0 <0.1.0"
|
|
35
|
+
},
|
|
36
|
+
"pnpm": {
|
|
37
|
+
"onlyBuiltDependencies": [
|
|
38
|
+
"@parcel/watcher",
|
|
39
|
+
"dugite",
|
|
40
|
+
"electron",
|
|
41
|
+
"electron-winstaller",
|
|
42
|
+
"esbuild"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Service } from "@zenbujs/core/runtime"
|
|
2
|
+
import { WindowService } from "@zenbujs/core/services"
|
|
3
|
+
|
|
4
|
+
export class InitService extends Service.create({
|
|
5
|
+
key: "init",
|
|
6
|
+
deps: { window: WindowService },
|
|
7
|
+
}) {
|
|
8
|
+
async evaluate() {
|
|
9
|
+
await this.ctx.window.openView({ type: "entrypoint" })
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Service } from "@zenbujs/core/runtime"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sample RPC service. Methods on the class are callable from the renderer
|
|
5
|
+
* via `useRpc()` — see `src/renderer/App.tsx`.
|
|
6
|
+
*/
|
|
7
|
+
export class Repo extends Service.create({ key: "repo" }) {
|
|
8
|
+
async getCwd() {
|
|
9
|
+
return process.cwd()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useDb, useDbClient, useRpc } from "@zenbujs/core/react"
|
|
2
|
+
import { useState } from "react"
|
|
3
|
+
|
|
4
|
+
function Titlebar() {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
className="titlebar"
|
|
8
|
+
// @ts-expect-error webkit property
|
|
9
|
+
style={{ WebkitAppRegion: "drag" }}
|
|
10
|
+
/>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function Home() {
|
|
15
|
+
const db = useDb()
|
|
16
|
+
const client = useDbClient()
|
|
17
|
+
const rpc = useRpc()
|
|
18
|
+
const [cwd, setCwd] = useState<string | null>(null)
|
|
19
|
+
|
|
20
|
+
const issues = db.app.issues
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<main className="home">
|
|
24
|
+
<h1>Welcome to Zenbu</h1>
|
|
25
|
+
<p className="lede">
|
|
26
|
+
Edit <code>src/renderer/App.tsx</code> to get started.
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<form
|
|
30
|
+
className="add-form"
|
|
31
|
+
onSubmit={(e) => {
|
|
32
|
+
e.preventDefault()
|
|
33
|
+
const form = e.currentTarget
|
|
34
|
+
const title = (form.elements.namedItem("title") as HTMLInputElement).value
|
|
35
|
+
if (!title.trim()) return
|
|
36
|
+
client.update((db) => {
|
|
37
|
+
db.app.issues.push({
|
|
38
|
+
id: crypto.randomUUID(),
|
|
39
|
+
title,
|
|
40
|
+
createdAt: Date.now(),
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
form.reset()
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<input name="title" placeholder="New issue title" autoComplete="off" />
|
|
47
|
+
<button type="submit">+ add</button>
|
|
48
|
+
</form>
|
|
49
|
+
|
|
50
|
+
<div className="issues">
|
|
51
|
+
{issues.length === 0 ? (
|
|
52
|
+
<div className="issues-empty">No issues yet — try adding one.</div>
|
|
53
|
+
) : (
|
|
54
|
+
issues.map((issue) => (
|
|
55
|
+
<div key={issue.id} className="issue">
|
|
56
|
+
<span>{issue.title}</span>
|
|
57
|
+
<span className="issue-time">
|
|
58
|
+
{new Date(issue.createdAt).toLocaleTimeString()}
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
))
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<button
|
|
66
|
+
className="rpc-button"
|
|
67
|
+
onClick={async () => setCwd(await rpc.repo.getCwd())}
|
|
68
|
+
>
|
|
69
|
+
rpc → main process cwd
|
|
70
|
+
</button>
|
|
71
|
+
{cwd && <div className="rpc-result">{cwd}</div>}
|
|
72
|
+
</main>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function App() {
|
|
77
|
+
return (
|
|
78
|
+
<div className="app">
|
|
79
|
+
<Titlebar />
|
|
80
|
+
<Home />
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
margin: 0;
|
|
7
|
+
background: #111;
|
|
8
|
+
color: #e5e5e5;
|
|
9
|
+
font-family:
|
|
10
|
+
ui-sans-serif,
|
|
11
|
+
system-ui,
|
|
12
|
+
-apple-system,
|
|
13
|
+
"Segoe UI",
|
|
14
|
+
Roboto,
|
|
15
|
+
sans-serif;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.app {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
min-height: 100vh;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.titlebar {
|
|
25
|
+
height: 40px;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: flex-end;
|
|
29
|
+
padding: 0 12px 0 72px;
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.home {
|
|
34
|
+
flex: 1;
|
|
35
|
+
padding: 0 32px 32px;
|
|
36
|
+
color: #e5e5e5;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.home h1 {
|
|
40
|
+
font-size: 24px;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
margin: 0 0 8px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.home .lede {
|
|
46
|
+
color: #888;
|
|
47
|
+
margin: 0 0 24px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.home code {
|
|
51
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.add-form {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 12px;
|
|
58
|
+
background: #18181b;
|
|
59
|
+
border-radius: 12px;
|
|
60
|
+
padding: 16px;
|
|
61
|
+
max-width: 28rem;
|
|
62
|
+
margin-bottom: 24px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.add-form input {
|
|
66
|
+
padding: 8px 12px;
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
background: #222;
|
|
69
|
+
border: 1px solid #333;
|
|
70
|
+
color: inherit;
|
|
71
|
+
outline: none;
|
|
72
|
+
font: inherit;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.add-form input:focus {
|
|
76
|
+
border-color: #6366f1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.add-form button {
|
|
80
|
+
background: #4f46e5;
|
|
81
|
+
color: white;
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
padding: 8px 16px;
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
border: 0;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
transition: background 120ms ease;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.add-form button:hover {
|
|
91
|
+
background: #4338ca;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.issues {
|
|
95
|
+
max-width: 28rem;
|
|
96
|
+
margin-bottom: 24px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.issues-empty {
|
|
100
|
+
color: #888;
|
|
101
|
+
font-style: italic;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.issue {
|
|
105
|
+
margin-bottom: 8px;
|
|
106
|
+
padding: 12px;
|
|
107
|
+
border-radius: 8px;
|
|
108
|
+
background: #222;
|
|
109
|
+
border: 1px solid #2a2a2a;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.issue-time {
|
|
116
|
+
font-size: 12px;
|
|
117
|
+
color: #666;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.rpc-button {
|
|
121
|
+
background: #27272a;
|
|
122
|
+
color: inherit;
|
|
123
|
+
border: 0;
|
|
124
|
+
padding: 8px 16px;
|
|
125
|
+
border-radius: 4px;
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
transition: background 120ms ease;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.rpc-button:hover {
|
|
132
|
+
background: #3f3f46;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.rpc-result {
|
|
136
|
+
margin-top: 8px;
|
|
137
|
+
padding: 8px;
|
|
138
|
+
border-radius: 4px;
|
|
139
|
+
background: #232328;
|
|
140
|
+
color: #b0b0b0;
|
|
141
|
+
width: fit-content;
|
|
142
|
+
font-size: 12px;
|
|
143
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Zenbu App</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="./main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="zenbu-bg" content="#111">
|
|
6
|
+
<title>Installing</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body {
|
|
9
|
+
height: 100%;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
background: #111;
|
|
13
|
+
color: #ddd;
|
|
14
|
+
font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
15
|
+
-webkit-app-region: drag;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
body {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
gap: 18px;
|
|
24
|
+
padding: 32px;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
.label {
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
color: #f0f0f0;
|
|
30
|
+
letter-spacing: 0.2px;
|
|
31
|
+
min-height: 1.4em;
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
.bar {
|
|
35
|
+
width: min(360px, 70%);
|
|
36
|
+
height: 4px;
|
|
37
|
+
background: #2a2a2a;
|
|
38
|
+
border-radius: 2px;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
.bar-fill {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0 auto 0 0;
|
|
45
|
+
width: 0%;
|
|
46
|
+
background: #f0f0f0;
|
|
47
|
+
transition: width 180ms ease-out;
|
|
48
|
+
}
|
|
49
|
+
.bar.indeterminate .bar-fill {
|
|
50
|
+
width: 30%;
|
|
51
|
+
animation: slide 1.2s ease-in-out infinite;
|
|
52
|
+
}
|
|
53
|
+
@keyframes slide {
|
|
54
|
+
0% { transform: translateX(-100%); }
|
|
55
|
+
100% { transform: translateX(366%); }
|
|
56
|
+
}
|
|
57
|
+
.message {
|
|
58
|
+
font-size: 11px;
|
|
59
|
+
color: #888;
|
|
60
|
+
font-family: "SF Mono", Menlo, Consolas, monospace;
|
|
61
|
+
max-width: min(420px, 90%);
|
|
62
|
+
text-align: center;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
min-height: 1.4em;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
<div class="label" id="label">Starting…</div>
|
|
72
|
+
<div class="bar indeterminate" id="bar"><div class="bar-fill" id="fill"></div></div>
|
|
73
|
+
<div class="message" id="message"></div>
|
|
74
|
+
<script>
|
|
75
|
+
// The framework's built-in preload exposes `window.zenbuInstall` with
|
|
76
|
+
// `.on(event, cb)` returning an unsubscribe function. Events:
|
|
77
|
+
// step: { id: "clone" | "fetch" | "install" | "handoff", label }
|
|
78
|
+
// message: { text }
|
|
79
|
+
// progress: { phase?, loaded?, total?, ratio? }
|
|
80
|
+
// done: { id }
|
|
81
|
+
// error: { id?, message }
|
|
82
|
+
const api = window.zenbuInstall;
|
|
83
|
+
const labelEl = document.getElementById("label");
|
|
84
|
+
const messageEl = document.getElementById("message");
|
|
85
|
+
const barEl = document.getElementById("bar");
|
|
86
|
+
const fillEl = document.getElementById("fill");
|
|
87
|
+
if (api) {
|
|
88
|
+
api.on("step", (p) => {
|
|
89
|
+
if (p && p.label) labelEl.textContent = p.label;
|
|
90
|
+
barEl.classList.add("indeterminate");
|
|
91
|
+
fillEl.style.width = "";
|
|
92
|
+
});
|
|
93
|
+
api.on("message", (p) => {
|
|
94
|
+
if (p && p.text) messageEl.textContent = p.text;
|
|
95
|
+
});
|
|
96
|
+
api.on("progress", (p) => {
|
|
97
|
+
const ratio = p && typeof p.ratio === "number" ? p.ratio : null;
|
|
98
|
+
if (ratio != null && ratio >= 0) {
|
|
99
|
+
barEl.classList.remove("indeterminate");
|
|
100
|
+
fillEl.style.width = Math.max(2, Math.min(100, ratio * 100)) + "%";
|
|
101
|
+
} else {
|
|
102
|
+
barEl.classList.add("indeterminate");
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
api.on("done", () => {
|
|
106
|
+
messageEl.textContent = "";
|
|
107
|
+
});
|
|
108
|
+
api.on("error", (p) => {
|
|
109
|
+
labelEl.textContent = "Failed";
|
|
110
|
+
if (p && p.message) messageEl.textContent = p.message;
|
|
111
|
+
barEl.classList.remove("indeterminate");
|
|
112
|
+
fillEl.style.width = "100%";
|
|
113
|
+
fillEl.style.background = "#d04444";
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="zenbu-bg" content="#111">
|
|
6
|
+
<style>
|
|
7
|
+
html, body {
|
|
8
|
+
height: 100%;
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
background: #111;
|
|
12
|
+
}
|
|
13
|
+
@media (prefers-color-scheme: dark) {
|
|
14
|
+
html, body {
|
|
15
|
+
background: #111;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"rootDir": ".",
|
|
12
|
+
"paths": {
|
|
13
|
+
"@/*": ["./src/renderer/*"],
|
|
14
|
+
"#registry/*": ["./types/*"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"include": ["src", "types"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import path from "node:path"
|
|
2
|
+
import { fileURLToPath } from "node:url"
|
|
3
|
+
import { defineConfig } from "vite"
|
|
4
|
+
import react from "@vitejs/plugin-react"
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
root: path.resolve(__dirname, "src", "renderer"),
|
|
10
|
+
plugins: [react()],
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: {
|
|
13
|
+
"@": path.resolve(__dirname, "src", "renderer"),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineConfig,
|
|
3
|
+
definePlugin,
|
|
4
|
+
defineBuildConfig,
|
|
5
|
+
} from "@zenbujs/core/config"
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
// Where the kyju database lives (relative to this file).
|
|
9
|
+
db: "./.zenbu/db",
|
|
10
|
+
|
|
11
|
+
// Boot-window HTML. The single ui entrypoint for the whole app.
|
|
12
|
+
uiEntrypoint: "./src/renderer",
|
|
13
|
+
|
|
14
|
+
// Plugins are pure main-process: services + optional schema/preload/events.
|
|
15
|
+
// The "host plugin" is just the first entry by convention.
|
|
16
|
+
plugins: [
|
|
17
|
+
definePlugin({
|
|
18
|
+
name: "app",
|
|
19
|
+
services: ["./src/main/services/*.ts"],
|
|
20
|
+
schema: "./src/main/schema.ts",
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// Build pipeline for `zen build:source` (mirror staging) and
|
|
25
|
+
// `zen build:electron` (signed .app via electron-builder). Set
|
|
26
|
+
// `mirror.target` to "<owner>/<repo>" before shipping.
|
|
27
|
+
build: defineBuildConfig({
|
|
28
|
+
// {{packageManager}}
|
|
29
|
+
// The .app's "host version" comes from `package.json#version` —
|
|
30
|
+
// read at build time and baked into <bundle>/host.json. Bump
|
|
31
|
+
// `package.json#version` every time you ship a new .app build.
|
|
32
|
+
// Each commit's `package.json#zenbu.host` semver range is checked
|
|
33
|
+
// against that value at launch (and from `UpdaterService.update()`);
|
|
34
|
+
// incompatible commits are skipped, so older .apps stay pinned to
|
|
35
|
+
// source they can actually run.
|
|
36
|
+
source: ".",
|
|
37
|
+
out: ".zenbu/build/source",
|
|
38
|
+
include: [
|
|
39
|
+
"src/**/*",
|
|
40
|
+
".gitignore",
|
|
41
|
+
"package.json",
|
|
42
|
+
"pnpm-lock.yaml",
|
|
43
|
+
"tsconfig.json",
|
|
44
|
+
"zenbu.config.ts",
|
|
45
|
+
"vite.config.ts",
|
|
46
|
+
],
|
|
47
|
+
ignore: [
|
|
48
|
+
"src/**/*.test.ts",
|
|
49
|
+
"src/**/*.test.tsx",
|
|
50
|
+
"src/**/*.spec.ts",
|
|
51
|
+
"src/**/*.spec.tsx",
|
|
52
|
+
"src/dev-only/**",
|
|
53
|
+
],
|
|
54
|
+
// mirror: { target: "{{owner}}/{{repo}}", branch: "main" },
|
|
55
|
+
}),
|
|
56
|
+
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createSchema, InferRoot, InferSchema, z } from "@zenbujs/core/db"
|
|
2
|
-
|
|
3
|
-
export const schema = createSchema({
|
|
4
|
-
issues: z
|
|
5
|
-
.array(
|
|
6
|
-
z.object({
|
|
7
|
-
id: z.string(),
|
|
8
|
-
title: z.string(),
|
|
9
|
-
createdAt: z.number(),
|
|
10
|
-
}),
|
|
11
|
-
)
|
|
12
|
-
.default([]),
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export type AppSchema = InferSchema<typeof schema>
|
|
16
|
-
export type SchemaRoot = InferRoot<AppSchema>
|
|
File without changes
|