@farm.js/desktop 0.0.0-stage → 0.1.0-beta.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/LICENSE +22 -0
- package/README.md +37 -2
- package/assets/icon.png +0 -0
- package/dist/electrobun/index.d.ts +11 -0
- package/dist/electrobun/index.d.ts.map +1 -0
- package/dist/electrobun/index.js +113 -0
- package/dist/electrobun/templates.d.ts +19 -0
- package/dist/electrobun/templates.d.ts.map +1 -0
- package/dist/electrobun/templates.js +141 -0
- package/package.json +54 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Farm.js Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @farm.js/desktop
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Desktop shells for Farm.js apps. Each shell is a subpath, picked with `desktop.shell` in
|
|
4
|
+
`farm.config.ts`. The default is [Electrobun](https://github.com/blackboardsh/electrobun)
|
|
5
|
+
(`@farm.js/desktop/electrobun`). Install it with the shell's toolkit, add `desktop` to the config,
|
|
6
|
+
and run `farm dev --desktop` or `farm build --desktop`.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add -D @farm.js/desktop electrobun
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
// farm.config.ts
|
|
14
|
+
export default defineConfig({
|
|
15
|
+
desktop: { name: "Notes", id: "com.example.notes", window: { width: 1100, height: 760 } },
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Electrobun
|
|
20
|
+
|
|
21
|
+
On every run Farm writes the Electrobun shell project to `.farm/output/desktop/shell`:
|
|
22
|
+
|
|
23
|
+
- `electrobun.config.ts`: app name, identifier, and version from `desktop`; the Farm server output
|
|
24
|
+
copied into the app; the system WebView (no bundled Chromium).
|
|
25
|
+
- `main.ts`: the Electrobun main process. It imports the server's `start()` in-process, binds
|
|
26
|
+
`127.0.0.1` on a port the OS assigns, passes a per-launch secret and a one-time handshake token,
|
|
27
|
+
sets `appDataDir()` to `Utils.paths.userData`, opens the window at the handshake URL, keeps it on
|
|
28
|
+
the app's origin (other links open in the system browser), runs `onReady` from `src/desktop.ts`,
|
|
29
|
+
and stops the server through Farm's shutdown before the app quits.
|
|
30
|
+
|
|
31
|
+
`farm dev --desktop` runs `electrobun dev` with the window on `farm dev`, so HMR works.
|
|
32
|
+
`farm build --desktop` builds the server for Bun, runs `electrobun build --env=stable`, and moves
|
|
33
|
+
the app to `.farm/output/desktop/dist` (update archives under `dist/update`).
|
|
34
|
+
|
|
35
|
+
The first `electrobun` command downloads Hutch and the Electrobun runtime into `~/.hutch`. The
|
|
36
|
+
packaged app ships its own Bun.
|
|
37
|
+
|
|
38
|
+
See [Desktop Apps](https://farmjs.dev/docs/desktop).
|
package/assets/icon.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { createElectrobunConfig, createElectrobunMain } from "./templates.js";
|
|
2
|
+
/** The Farm icon, used when the app sets no `desktop.icon`. */
|
|
3
|
+
export declare const DEFAULT_ICON: string;
|
|
4
|
+
/**
|
|
5
|
+
* The `electrobun` bootstrap installed in the app, which runs Hutch's Electrobun toolchain.
|
|
6
|
+
* Looked up in the app's node_modules folders only, like a package bin.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveElectrobunCli(root: string): string;
|
|
9
|
+
declare const _default: import("@farm.js/core/desktop").DesktopShell;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/electrobun/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAI9E,+DAA+D;AAC/D,eAAO,MAAM,YAAY,QAAmE,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYzD;;AAyDD,wBAiCG"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { mkdir, readFile, readdir, rename, rm } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { defineDesktopShell, } from "@farm.js/core/desktop";
|
|
7
|
+
import { createElectrobunConfig, createElectrobunMain, ICONSET_IMAGE } from "./templates.js";
|
|
8
|
+
export { createElectrobunConfig, createElectrobunMain } from "./templates.js";
|
|
9
|
+
const isWindows = process.platform === "win32";
|
|
10
|
+
/** The Farm icon, used when the app sets no `desktop.icon`. */
|
|
11
|
+
export const DEFAULT_ICON = fileURLToPath(new URL("../../assets/icon.png", import.meta.url));
|
|
12
|
+
/**
|
|
13
|
+
* The `electrobun` bootstrap installed in the app, which runs Hutch's Electrobun toolchain.
|
|
14
|
+
* Looked up in the app's node_modules folders only, like a package bin.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveElectrobunCli(root) {
|
|
17
|
+
for (let dir = path.resolve(root);; dir = path.dirname(dir)) {
|
|
18
|
+
const cli = path.join(dir, "node_modules", "electrobun", "bin", "electrobun.cjs");
|
|
19
|
+
if (existsSync(cli))
|
|
20
|
+
return cli;
|
|
21
|
+
if (path.dirname(dir) === dir)
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
throw Object.assign(new Error(`@farm.js/desktop/electrobun needs the electrobun package in ${root}. Install it next to the adapter, for example:\n pnpm add -D electrobun`), { name: "FarmDesktopError", code: "shell-missing" });
|
|
25
|
+
}
|
|
26
|
+
function runElectrobun(context, args, env) {
|
|
27
|
+
// Its own process group on macOS and Linux, so stopping also reaches the app that
|
|
28
|
+
// `electrobun dev` launches, which outlives the CLI wrapper otherwise.
|
|
29
|
+
return spawn(process.execPath, [resolveElectrobunCli(context.root), ...args], {
|
|
30
|
+
cwd: context.shellDir,
|
|
31
|
+
env: env ?? process.env,
|
|
32
|
+
stdio: "inherit",
|
|
33
|
+
detached: !isWindows,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function waitForExit(child) {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
child.once("error", reject);
|
|
39
|
+
child.once("exit", (code, signal) => resolve(code ?? (signal ? 1 : 0)));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function stopProcessTree(child, signal) {
|
|
43
|
+
if (child.exitCode !== null || child.signalCode !== null || child.pid === undefined)
|
|
44
|
+
return;
|
|
45
|
+
try {
|
|
46
|
+
if (isWindows)
|
|
47
|
+
child.kill(signal);
|
|
48
|
+
else
|
|
49
|
+
process.kill(-child.pid, signal);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Already gone.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Move Electrobun's build and artifact folders into Farm's dist directory. */
|
|
56
|
+
async function collectArtifacts(shellDir, distDir) {
|
|
57
|
+
await rm(distDir, { recursive: true, force: true });
|
|
58
|
+
await mkdir(distDir, { recursive: true });
|
|
59
|
+
const files = [];
|
|
60
|
+
const buildRoot = path.join(shellDir, "build");
|
|
61
|
+
for (const target of existsSync(buildRoot) ? await readdir(buildRoot) : []) {
|
|
62
|
+
if (!target.startsWith("stable-"))
|
|
63
|
+
continue;
|
|
64
|
+
for (const entry of await readdir(path.join(buildRoot, target))) {
|
|
65
|
+
const destination = path.join(distDir, entry);
|
|
66
|
+
await rename(path.join(buildRoot, target, entry), destination);
|
|
67
|
+
files.push(destination);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const artifactRoot = path.join(shellDir, "artifacts");
|
|
71
|
+
if (existsSync(artifactRoot)) {
|
|
72
|
+
const updateDir = path.join(distDir, "update");
|
|
73
|
+
await mkdir(updateDir, { recursive: true });
|
|
74
|
+
for (const entry of await readdir(artifactRoot)) {
|
|
75
|
+
const destination = path.join(updateDir, entry);
|
|
76
|
+
await rename(path.join(artifactRoot, entry), destination);
|
|
77
|
+
files.push(destination);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return files;
|
|
81
|
+
}
|
|
82
|
+
export default defineDesktopShell({
|
|
83
|
+
name: "electrobun",
|
|
84
|
+
runtime: "bun",
|
|
85
|
+
async generateMain(context) {
|
|
86
|
+
return [
|
|
87
|
+
{ path: "electrobun.config.ts", contents: createElectrobunConfig(context) },
|
|
88
|
+
{ path: "main.ts", contents: createElectrobunMain(context) },
|
|
89
|
+
{ path: ICONSET_IMAGE, contents: await readFile(context.desktop.icon ?? DEFAULT_ICON) },
|
|
90
|
+
];
|
|
91
|
+
},
|
|
92
|
+
async dev(context) {
|
|
93
|
+
// The config copies the server output into the app; dev never reads it, but it must exist.
|
|
94
|
+
await mkdir(context.serverDir, { recursive: true });
|
|
95
|
+
const child = runElectrobun(context, ["dev"], context.env);
|
|
96
|
+
const exited = waitForExit(child);
|
|
97
|
+
return {
|
|
98
|
+
exited,
|
|
99
|
+
async close() {
|
|
100
|
+
stopProcessTree(child, "SIGTERM");
|
|
101
|
+
const timer = setTimeout(() => stopProcessTree(child, "SIGKILL"), 5_000);
|
|
102
|
+
await exited.catch(() => 1);
|
|
103
|
+
clearTimeout(timer);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
async package(context) {
|
|
108
|
+
const code = await waitForExit(runElectrobun(context, ["build", "--env=stable"]));
|
|
109
|
+
if (code !== 0)
|
|
110
|
+
throw new Error(`electrobun build exited with code ${code}.`);
|
|
111
|
+
return { files: await collectArtifacts(context.shellDir, context.distDir) };
|
|
112
|
+
},
|
|
113
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DesktopShellContext } from "@farm.js/core/desktop";
|
|
2
|
+
/** Where the Farm server output lands inside the app's `Resources/app` folder. */
|
|
3
|
+
export declare const SERVER_RESOURCE_DIR = "farm";
|
|
4
|
+
/**
|
|
5
|
+
* The macOS icon set Electrobun turns into AppIcon.icns. One 1024px image is a valid set; the
|
|
6
|
+
* OS scales it for smaller sizes.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ICONSET_DIR = "icon.iconset";
|
|
9
|
+
export declare const ICONSET_IMAGE = "icon.iconset/icon_512x512@2x.png";
|
|
10
|
+
/** `electrobun.config.ts` for the generated shell project. */
|
|
11
|
+
export declare function createElectrobunConfig(context: DesktopShellContext): string;
|
|
12
|
+
/**
|
|
13
|
+
* The Electrobun main process: start the Farm server in-process on 127.0.0.1:0, open the
|
|
14
|
+
* window at the one-time handshake URL, keep it on the app's origin, and stop the server
|
|
15
|
+
* through Farm's shutdown before the app quits. Under `farm dev --desktop` it opens the window
|
|
16
|
+
* on the dev server instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createElectrobunMain(context: DesktopShellContext): string;
|
|
19
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/electrobun/templates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAC1C,eAAO,MAAM,aAAa,qCAAuC,CAAC;AAOlE,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAuB3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAgGzE"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
/** Where the Farm server output lands inside the app's `Resources/app` folder. */
|
|
3
|
+
export const SERVER_RESOURCE_DIR = "farm";
|
|
4
|
+
/**
|
|
5
|
+
* The macOS icon set Electrobun turns into AppIcon.icns. One 1024px image is a valid set; the
|
|
6
|
+
* OS scales it for smaller sizes.
|
|
7
|
+
*/
|
|
8
|
+
export const ICONSET_DIR = "icon.iconset";
|
|
9
|
+
export const ICONSET_IMAGE = `${ICONSET_DIR}/icon_512x512@2x.png`;
|
|
10
|
+
function toImportPath(from, to) {
|
|
11
|
+
const relative = path.relative(from, to).split(path.sep).join("/");
|
|
12
|
+
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
13
|
+
}
|
|
14
|
+
/** `electrobun.config.ts` for the generated shell project. */
|
|
15
|
+
export function createElectrobunConfig(context) {
|
|
16
|
+
const { desktop } = context;
|
|
17
|
+
const serverSource = toImportPath(context.shellDir, context.serverDir);
|
|
18
|
+
const config = {
|
|
19
|
+
app: {
|
|
20
|
+
name: desktop.name,
|
|
21
|
+
identifier: desktop.id,
|
|
22
|
+
version: desktop.version,
|
|
23
|
+
},
|
|
24
|
+
build: {
|
|
25
|
+
bun: { entrypoint: "main.ts" },
|
|
26
|
+
// The Farm server built for Bun. main.ts imports its entry from Resources/app/farm.
|
|
27
|
+
copy: { [serverSource]: SERVER_RESOURCE_DIR },
|
|
28
|
+
// The system WebView (WKWebView, WebView2, WebKitGTK): no bundled Chromium.
|
|
29
|
+
mac: { bundleCEF: false, createDmg: false, icons: ICONSET_DIR },
|
|
30
|
+
linux: { bundleCEF: false },
|
|
31
|
+
win: { bundleCEF: false },
|
|
32
|
+
},
|
|
33
|
+
runtime: { exitOnLastWindowClosed: true },
|
|
34
|
+
};
|
|
35
|
+
return `// Generated by @farm.js/desktop/electrobun on every farm dev|build --desktop. Do not edit.
|
|
36
|
+
export default ${JSON.stringify(config, null, 2)};
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The Electrobun main process: start the Farm server in-process on 127.0.0.1:0, open the
|
|
41
|
+
* window at the one-time handshake URL, keep it on the app's origin, and stop the server
|
|
42
|
+
* through Farm's shutdown before the app quits. Under `farm dev --desktop` it opens the window
|
|
43
|
+
* on the dev server instead.
|
|
44
|
+
*/
|
|
45
|
+
export function createElectrobunMain(context) {
|
|
46
|
+
const { desktop } = context;
|
|
47
|
+
const hooksImport = context.hooksFile
|
|
48
|
+
? `import farmDesktopHooks from ${JSON.stringify(toImportPath(context.shellDir, context.hooksFile))};`
|
|
49
|
+
: "const farmDesktopHooks = {};";
|
|
50
|
+
const options = {
|
|
51
|
+
title: desktop.window.title,
|
|
52
|
+
width: desktop.window.width,
|
|
53
|
+
height: desktop.window.height,
|
|
54
|
+
basePath: context.basePath,
|
|
55
|
+
serverEntry: `${SERVER_RESOURCE_DIR}/server/index.mjs`,
|
|
56
|
+
};
|
|
57
|
+
return `// Generated by @farm.js/desktop/electrobun on every farm dev|build --desktop. Do not edit.
|
|
58
|
+
import Electrobun, { BrowserWindow, BuildConfig, PATHS, Utils } from "electrobun/main";
|
|
59
|
+
import { randomBytes } from "node:crypto";
|
|
60
|
+
import { mkdir } from "node:fs/promises";
|
|
61
|
+
import { join } from "node:path";
|
|
62
|
+
import { pathToFileURL } from "node:url";
|
|
63
|
+
${hooksImport}
|
|
64
|
+
|
|
65
|
+
const options = ${JSON.stringify(options, null, 2)};
|
|
66
|
+
const HANDSHAKE_PATH = "/__farm/desktop/handshake";
|
|
67
|
+
|
|
68
|
+
function takeEnv(name) {
|
|
69
|
+
const value = process.env[name];
|
|
70
|
+
delete process.env[name];
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function startFarm() {
|
|
75
|
+
const build = await BuildConfig.get();
|
|
76
|
+
const devUrl = process.env.FARM_DESKTOP_DEV_URL;
|
|
77
|
+
const devToken = takeEnv("FARM_DESKTOP_HANDSHAKE_TOKEN");
|
|
78
|
+
takeEnv("FARM_DESKTOP_SECRET");
|
|
79
|
+
if (!build.isPackaged && devUrl && devToken) {
|
|
80
|
+
return {
|
|
81
|
+
mode: "development",
|
|
82
|
+
origin: devUrl,
|
|
83
|
+
port: Number(new URL(devUrl).port),
|
|
84
|
+
handshakeToken: devToken,
|
|
85
|
+
stop: async () => {},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const dataDir = Utils.paths.userData;
|
|
90
|
+
await mkdir(dataDir, { recursive: true });
|
|
91
|
+
const secret = randomBytes(32).toString("base64url");
|
|
92
|
+
const handshakeToken = randomBytes(32).toString("base64url");
|
|
93
|
+
// A computed specifier, so Electrobun's bundler leaves the server to load at runtime.
|
|
94
|
+
const entry = pathToFileURL(join(PATHS.RESOURCES_FOLDER, "app", options.serverEntry)).href;
|
|
95
|
+
const { start } = await import(entry);
|
|
96
|
+
const server = await start({ secret, handshakeToken, dataDir });
|
|
97
|
+
return { mode: "production", ...server, handshakeToken };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const farm = await startFarm();
|
|
101
|
+
const win = new BrowserWindow({
|
|
102
|
+
title: options.title,
|
|
103
|
+
url: farm.origin + options.basePath + HANDSHAKE_PATH + "?t=" + encodeURIComponent(farm.handshakeToken),
|
|
104
|
+
frame: { width: options.width, height: options.height },
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// The window stays on the app's origin (the last matching rule wins). Links elsewhere open
|
|
108
|
+
// in the system browser.
|
|
109
|
+
win.webview.setNavigationRules(["^*", farm.origin + "/*"]);
|
|
110
|
+
function openOutside(url) {
|
|
111
|
+
if (typeof url !== "string") return;
|
|
112
|
+
if (url === farm.origin || url.startsWith(farm.origin + "/")) return;
|
|
113
|
+
if (/^(?:https?|mailto):/i.test(url)) Utils.openExternal(url);
|
|
114
|
+
}
|
|
115
|
+
Electrobun.events.on("will-navigate", (event) => openOutside(event.data?.detail));
|
|
116
|
+
Electrobun.events.on("new-window-open", (event) => {
|
|
117
|
+
const detail = event.data?.detail;
|
|
118
|
+
openOutside(typeof detail === "string" ? detail : detail?.url);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Drain requests and run Farm's shutdown hooks, then quit for real.
|
|
122
|
+
let farmStopped = farm.mode === "development";
|
|
123
|
+
Electrobun.events.on("before-quit", (event) => {
|
|
124
|
+
if (farmStopped) return;
|
|
125
|
+
event.response = { allow: false };
|
|
126
|
+
farm
|
|
127
|
+
.stop()
|
|
128
|
+
.catch((error) => console.error("[farm] desktop server shutdown failed:", error))
|
|
129
|
+
.finally(() => {
|
|
130
|
+
farmStopped = true;
|
|
131
|
+
Utils.quit();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await farmDesktopHooks.onReady?.({
|
|
136
|
+
window: win,
|
|
137
|
+
server: { origin: farm.origin, port: farm.port },
|
|
138
|
+
mode: farm.mode,
|
|
139
|
+
});
|
|
140
|
+
`;
|
|
141
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/desktop",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Desktop shells for Farm.js apps (farm dev --desktop, farm build --desktop). Ships the Electrobun shell.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"desktop",
|
|
7
|
+
"electrobun",
|
|
8
|
+
"farm.js"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/farming-labs/farm.js",
|
|
14
|
+
"directory": "packages/farm-desktop"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"assets",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
"./electrobun": {
|
|
23
|
+
"types": "./dist/electrobun/index.d.ts",
|
|
24
|
+
"import": "./dist/electrobun/index.js",
|
|
25
|
+
"default": "./dist/electrobun/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.20.5",
|
|
34
|
+
"electrobun": "2.0.5",
|
|
35
|
+
"typescript": "^5.3.3",
|
|
36
|
+
"vite": "8.3.4",
|
|
37
|
+
"vitest": "5.0.5",
|
|
38
|
+
"@farm.js/core": "0.1.48"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"electrobun": "^2.0.5",
|
|
42
|
+
"@farm.js/core": "0.1.48"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"electrobun": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22.13.0"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|
|
54
|
+
"type-check": "tsc --noEmit",
|
|
55
|
+
"test": "vitest run"
|
|
56
|
+
}
|
|
6
57
|
}
|