@stacksjs/stx 0.2.127 → 0.2.128
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/cli.js +135 -133
- package/dist/craft.js +83 -81
- package/dist/native-build.d.ts +1 -0
- package/dist/native-build.js +64 -17
- package/package.json +5 -5
package/dist/native-build.d.ts
CHANGED
package/dist/native-build.js
CHANGED
|
@@ -91,29 +91,57 @@ async function buildMacOS(html, appName, appVersion, outputDir, format, config,
|
|
|
91
91
|
sidebarConfigPath = join(resourcesDir, "sidebar-config.json");
|
|
92
92
|
await Bun.write(sidebarConfigPath, JSON.stringify(config.sidebar.config));
|
|
93
93
|
}
|
|
94
|
-
const sidebarFlags = config.sidebar?.enabled ? `--native-sidebar --sidebar-width ${config.sidebar?.width || 240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"` : "",
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
const sidebarFlags = config.sidebar?.enabled ? `--native-sidebar --sidebar-width ${config.sidebar?.width || 240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"` : "", menubarOnly = config.menubarOnly ?? config.systemTray;
|
|
95
|
+
if ((config.bundleStyle || (await supportsBundleManifest(craftPath) ? "executable" : "launcher")) === "executable") {
|
|
96
|
+
const executablePath = join(macOSDir, appName);
|
|
97
|
+
copyFileSync(craftPath, executablePath);
|
|
98
|
+
chmodSync(executablePath, 493);
|
|
99
|
+
const manifest = {
|
|
100
|
+
html: "index.html",
|
|
101
|
+
title: config.window?.title || appName,
|
|
102
|
+
width: config.window?.width || 1200,
|
|
103
|
+
height: config.window?.height || 800,
|
|
104
|
+
devTools: Boolean(config.devTools)
|
|
105
|
+
};
|
|
106
|
+
if (menubarOnly)
|
|
107
|
+
manifest.menubarOnly = !0;
|
|
108
|
+
else if (config.systemTray)
|
|
109
|
+
manifest.systemTray = !0;
|
|
110
|
+
if (config.window?.frameless)
|
|
111
|
+
manifest.frameless = !0;
|
|
112
|
+
if (config.window?.transparent)
|
|
113
|
+
manifest.transparent = !0;
|
|
114
|
+
if (config.window?.alwaysOnTop)
|
|
115
|
+
manifest.alwaysOnTop = !0;
|
|
116
|
+
if (config.window?.resizable === !1)
|
|
117
|
+
manifest.resizable = !1;
|
|
118
|
+
await Bun.write(join(resourcesDir, "craft.json"), `${JSON.stringify(manifest, null, 2)}
|
|
119
|
+
`);
|
|
120
|
+
} else {
|
|
121
|
+
const craftBinaryDest = join(macOSDir, "craft");
|
|
122
|
+
copyFileSync(craftPath, craftBinaryDest);
|
|
123
|
+
chmodSync(craftBinaryDest, 493);
|
|
124
|
+
const sidebarFlags = config.sidebar?.enabled ? `--native-sidebar --sidebar-width ${config.sidebar?.width || 240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"` : "", launcherScript = `#!/bin/bash
|
|
98
125
|
set -euo pipefail
|
|
99
126
|
DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
|
100
127
|
RESOURCES="$DIR/../Resources"
|
|
101
128
|
exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
102
129
|
${[
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
130
|
+
`--title "${config.window?.title || appName}"`,
|
|
131
|
+
`--width ${config.window?.width || 1200}`,
|
|
132
|
+
`--height ${config.window?.height || 800}`,
|
|
133
|
+
menubarOnly ? "--menubar-only" : config.systemTray ? "--system-tray" : "",
|
|
134
|
+
config.devTools ? "" : "--no-devtools",
|
|
135
|
+
config.window?.frameless ? "--frameless" : "",
|
|
136
|
+
config.window?.transparent ? "--transparent" : "",
|
|
137
|
+
config.window?.alwaysOnTop ? "--always-on-top" : "",
|
|
138
|
+
config.window?.resizable === !1 ? "--no-resize" : "",
|
|
139
|
+
sidebarFlags
|
|
140
|
+
].filter(Boolean).join(" \\\n ")}
|
|
114
141
|
`, launcherPath = join(macOSDir, appName);
|
|
115
|
-
|
|
116
|
-
|
|
142
|
+
await Bun.write(launcherPath, launcherScript);
|
|
143
|
+
chmodSync(launcherPath, 493);
|
|
144
|
+
}
|
|
117
145
|
const hasIcon = Boolean(config.icon && await Bun.file(config.icon).exists());
|
|
118
146
|
if (hasIcon)
|
|
119
147
|
copyFileSync(config.icon, join(resourcesDir, "AppIcon.icns"));
|
|
@@ -144,6 +172,25 @@ exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
|
|
|
144
172
|
}
|
|
145
173
|
return { success: !0, target: "macos", format: "app", outputPath: appBundlePath };
|
|
146
174
|
}
|
|
175
|
+
async function supportsBundleManifest(craftPath) {
|
|
176
|
+
try {
|
|
177
|
+
const proc = Bun.spawn([craftPath, "--version"], { stdout: "pipe", stderr: "pipe" }), [stdout, stderr] = await Promise.all([
|
|
178
|
+
new Response(proc.stdout).text(),
|
|
179
|
+
new Response(proc.stderr).text()
|
|
180
|
+
]);
|
|
181
|
+
await proc.exited;
|
|
182
|
+
const version = `${stdout}
|
|
183
|
+
${stderr}`.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
184
|
+
if (!version)
|
|
185
|
+
return !1;
|
|
186
|
+
const [major, minor, patch] = version.slice(1).map(Number);
|
|
187
|
+
if (major > 0 || minor > 0)
|
|
188
|
+
return !0;
|
|
189
|
+
return patch >= 57;
|
|
190
|
+
} catch {
|
|
191
|
+
return !1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
147
194
|
function escapeXml(value) {
|
|
148
195
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
149
196
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.128",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.12",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.128",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.128",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.128",
|
|
124
124
|
"bunfig": "^0.15.15",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.128",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|