create-zenbu-app 0.0.30 → 0.0.33

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.
@@ -0,0 +1,185 @@
1
+ //#region src/desktop/deps-sig.d.ts
2
+ type PmType = "pnpm" | "npm" | "yarn" | "bun";
3
+ interface PmSpec {
4
+ type: PmType;
5
+ version: string;
6
+ }
7
+ /**
8
+ * Mirror of `packages/core/src/shared/pm-install.ts#depsSignature`, with
9
+ * `electronVersion` accepted explicitly because we run from Node (not
10
+ * Electron) and `process.versions.electron` is undefined here.
11
+ *
12
+ * Must stay byte-for-byte equivalent to the launcher's recipe so the
13
+ * pre-seeded `<appsDir>/.zenbu/deps-sig` matches what `ensureDepsInstalled`
14
+ * recomputes on first launch and the install gate skips.
15
+ */
16
+ declare function depsSignature(opts: {
17
+ appsDir: string;
18
+ pm: PmSpec;
19
+ electronVersion: string;
20
+ arch?: NodeJS.Architecture;
21
+ platform?: NodeJS.Platform;
22
+ }): Promise<string>;
23
+ declare function writeDepsSig(appsDir: string, sig: string): Promise<void>;
24
+ //#endregion
25
+ //#region src/desktop/log.d.ts
26
+ interface DesktopLogger {
27
+ /** Absolute path of the log file backing this logger. */
28
+ readonly file: string;
29
+ /** Append a structured step boundary. */
30
+ step(label: string): void;
31
+ /** Append a free-form line (also mirrored to stdout when verbose). */
32
+ info(line: string): void;
33
+ /** Append an error line. Always mirrored to stderr. */
34
+ error(line: string): void;
35
+ /**
36
+ * Run `fn`, logging its start and end with timing. Throws are recorded
37
+ * with the step label and re-thrown.
38
+ */
39
+ withStep<T>(label: string, fn: () => Promise<T> | T): Promise<T>;
40
+ /** Last `n` lines of the log file (string, may be empty). */
41
+ tail(n?: number): string;
42
+ /** Close the underlying stream. */
43
+ close(): void;
44
+ }
45
+ interface CreateLoggerOpts {
46
+ /** Display slug, used in the log file name. */
47
+ slug: string;
48
+ /** When true, mirror every line to stdout. */
49
+ verbose?: boolean;
50
+ }
51
+ declare function createLogger(opts: CreateLoggerOpts): DesktopLogger;
52
+ //#endregion
53
+ //#region src/desktop/electron-cache.d.ts
54
+ interface EnsureElectronAppOpts {
55
+ /**
56
+ * Either an exact version (`"42.1.3"`) or a semver-range string
57
+ * (`"^42.0.0"`). When a range, we resolve the latest published version
58
+ * matching the range from the npm registry.
59
+ */
60
+ versionRange: string;
61
+ log: DesktopLogger;
62
+ /** Override download URL prefix (for testing). */
63
+ downloadBase?: string;
64
+ }
65
+ interface EnsureElectronAppResult {
66
+ electronAppPath: string;
67
+ version: string;
68
+ major: number;
69
+ }
70
+ declare function ensureElectronApp(opts: EnsureElectronAppOpts): Promise<EnsureElectronAppResult>;
71
+ //#endregion
72
+ //#region src/desktop/bundle.d.ts
73
+ interface SynthesizeBundleOpts {
74
+ /** Cached vanilla Electron.app to clone-copy from. */
75
+ cachedElectronApp: string;
76
+ /** Final installed bundle path (e.g. `/Applications/<Name>.app`). */
77
+ destApp: string;
78
+ /** Display name shown in Finder, dock, menu bar. */
79
+ displayName: string;
80
+ /** Slug used for `CFBundleIdentifier` and `app-config.name`. */
81
+ slug: string;
82
+ /** App version (matches user project package.json#version). */
83
+ version: string;
84
+ /** Bundle id, defaults to `dev.zenbu.<slug>`. */
85
+ bundleId?: string;
86
+ /** Optional user icon (.icns or .png). When omitted, keep electron.icns. */
87
+ iconSource?: string;
88
+ /** Package manager that pre-seeded `<appsDir>/node_modules`. */
89
+ packageManager: PmSpec;
90
+ /** Pre-seeded apps dir (`~/.zenbu/apps/<slug>`). */
91
+ appsDir: string;
92
+ /** Path to `@zenbujs/core/dist/launcher.mjs` to bake into the bundle. */
93
+ launcherSource: string;
94
+ log: DesktopLogger;
95
+ dryRun?: boolean;
96
+ force?: boolean;
97
+ }
98
+ declare function synthesizeBundle(opts: SynthesizeBundleOpts): Promise<void>;
99
+ /**
100
+ * Ad-hoc deep-sign a bundle with the same entitlements used at synthesize
101
+ * time. Reusable so post-synthesize mutations (e.g. icon swap) can re-sign
102
+ * without rebuilding the whole bundle.
103
+ */
104
+ declare function adhocCodesign(opts: {
105
+ destApp: string;
106
+ log: DesktopLogger;
107
+ dryRun?: boolean;
108
+ }): Promise<void>;
109
+ declare function stripQuarantine(opts: {
110
+ destApp: string;
111
+ log: DesktopLogger;
112
+ dryRun?: boolean;
113
+ }): Promise<void>;
114
+ /**
115
+ * Resolve the path to `@zenbujs/core/dist/launcher.mjs` from any cwd. We
116
+ * use `package.json` as the resolution anchor because that subpath is
117
+ * exported (see packages/core/package.json `exports`).
118
+ */
119
+ declare function resolveLauncherSource(fromDir: string): string;
120
+ //#endregion
121
+ //#region src/desktop/icon.d.ts
122
+ interface PrepareIconOpts {
123
+ /** Path supplied by the user. May be `.icns` or `.png`. */
124
+ source: string;
125
+ /** Destination .icns path inside the bundle's Resources dir. */
126
+ dest: string;
127
+ log: DesktopLogger;
128
+ }
129
+ declare function prepareIcon(opts: PrepareIconOpts): Promise<void>;
130
+ //#endregion
131
+ //#region src/desktop/update-icon.d.ts
132
+ interface UpdateBundleIconOpts {
133
+ /** Absolute path to the existing .app bundle. */
134
+ destApp: string;
135
+ /** Source icon, .png (square, ideally 1024x1024) or .icns. */
136
+ iconSource: string;
137
+ /**
138
+ * If true, also poke the macOS icon services so Finder/Dock pick up the
139
+ * new icon without a full re-login. Best-effort.
140
+ */
141
+ refreshIconServices?: boolean;
142
+ log: DesktopLogger;
143
+ }
144
+ /**
145
+ * Swap an existing bundle's `Contents/Resources/icon.icns`, then re-codesign
146
+ * (ad-hoc, deep) so the bundle stays valid. Optionally nudges Launch
147
+ * Services to re-read the icon.
148
+ */
149
+ declare function updateBundleIcon(opts: UpdateBundleIconOpts): Promise<void>;
150
+ //#endregion
151
+ //#region src/desktop/index.d.ts
152
+ interface DesktopRunOpts {
153
+ /** Display name (e.g. "My Notes"). */
154
+ displayName: string;
155
+ /** Slug used for paths and bundle id (e.g. "my-notes"). */
156
+ slug: string;
157
+ /** App version, defaults to the project package.json#version. */
158
+ version: string;
159
+ /** Optional explicit electron version range (default: read from project pkg). */
160
+ electronVersionRange?: string;
161
+ /** Optional icon (.icns or .png) path. */
162
+ iconSource?: string;
163
+ /** Pre-seeded apps dir (e.g. ~/.zenbu/apps/<slug>). */
164
+ appsDir: string;
165
+ /** Package manager that just installed deps in `appsDir`. */
166
+ packageManager: PmSpec;
167
+ /** Override destination (default `/Applications/<DisplayName>.app`). */
168
+ destApp?: string;
169
+ /** Project dir from where to resolve the launcher source (`@zenbujs/core`). */
170
+ resolveFrom: string;
171
+ log: DesktopLogger;
172
+ force?: boolean;
173
+ dryRun?: boolean;
174
+ /** Skip writing `<appsDir>/.zenbu/deps-sig`. Useful when `--no-install`. */
175
+ skipDepsSig?: boolean;
176
+ }
177
+ interface DesktopRunResult {
178
+ destApp: string;
179
+ electronVersion: string;
180
+ appsDir: string;
181
+ launchCommand: string;
182
+ }
183
+ declare function buildDesktopApp(opts: DesktopRunOpts): Promise<DesktopRunResult>;
184
+ //#endregion
185
+ export { type DesktopLogger, DesktopRunOpts, DesktopRunResult, type UpdateBundleIconOpts, adhocCodesign, buildDesktopApp, createLogger, depsSignature, ensureElectronApp, prepareIcon, resolveLauncherSource, stripQuarantine, synthesizeBundle, updateBundleIcon, writeDepsSig };
@@ -0,0 +1,2 @@
1
+ import { a as writeDepsSig, c as stripQuarantine, d as ensureElectronApp, i as depsSignature, l as synthesizeBundle, n as updateBundleIcon, o as adhocCodesign, r as createLogger, s as resolveLauncherSource, t as buildDesktopApp, u as prepareIcon } from "./desktop-CtHHGkP3.mjs";
2
+ export { adhocCodesign, buildDesktopApp, createLogger, depsSignature, ensureElectronApp, prepareIcon, resolveLauncherSource, stripQuarantine, synthesizeBundle, updateBundleIcon, writeDepsSig };
@@ -0,0 +1 @@
1
+ export { };