@stacksjs/actions 0.70.230 → 0.70.232

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.
Files changed (2) hide show
  1. package/dist/build/desktop.js +10 -7
  2. package/package.json +17 -17
@@ -4,20 +4,23 @@ import { basename, join } from "node:path";
4
4
  import process from "node:process";
5
5
  import { log, runCommand } from "@stacksjs/cli";
6
6
  import { corePath, projectPath, storagePath } from "@stacksjs/path";
7
- import { assertDesktopReleaseChannel, resolveCraftBinary } from "@stacksjs/desktop";
7
+ import { assertDesktopReleaseChannel, resolveCraftBinary, resolveDesktopLauncher } from "@stacksjs/desktop";
8
8
  const outputDir = storagePath("framework/desktop-dist"), launcherName = process.platform === "win32" ? "stacks-desktop.exe" : "stacks-desktop", runtimeName = process.platform === "win32" ? "craft-runtime.exe" : "craft-runtime", appUrl = process.env.DESKTOP_URL || process.env.APP_URL, releaseChannel = process.env.DESKTOP_RELEASE_CHANNEL === "stable" ? "stable" : "experimental", support = assertDesktopReleaseChannel(releaseChannel);
9
9
  if (!appUrl)
10
10
  throw Error("Desktop builds require APP_URL or DESKTOP_URL so the native app knows which Stacks application to open");
11
11
  const url = new URL(/^https?:\/\//.test(appUrl) ? appUrl : `https://${appUrl}`), craftBinary = resolveCraftBinary();
12
12
  if (basename(craftBinary) === "craft" && !existsSync(craftBinary))
13
13
  throw Error("Build Craft first in ~/Code/Tools/craft, or set CRAFT_BIN to the native Craft binary");
14
+ if (readFileSync(craftBinary).subarray(0, 2).toString() === "#!")
15
+ throw Error(`CRAFT_BIN points at a script, not a native binary: ${craftBinary}. Point it at the compiled Craft executable (packages/zig/zig-out/bin/craft).`);
14
16
  if (existsSync(outputDir))
15
17
  rmSync(outputDir, { recursive: !0 });
16
18
  mkdirSync(outputDir, { recursive: !0 });
17
- await runCommand("bun run build", { cwd: corePath("desktop") });
18
- await runCommand(`bun build --compile ${JSON.stringify(corePath("desktop/src/launcher.ts"))} --outfile ${JSON.stringify(join(outputDir, launcherName))}`, {
19
- cwd: projectPath()
20
- });
19
+ const desktopSource = corePath("desktop");
20
+ if (existsSync(join(desktopSource, "package.json")) && existsSync(join(desktopSource, "src")))
21
+ await runCommand("bun run build", { cwd: desktopSource });
22
+ const launcherEntry = resolveDesktopLauncher();
23
+ await runCommand(["bun", "build", "--compile", launcherEntry, "--outfile", join(outputDir, launcherName)], { cwd: projectPath() });
21
24
  copyFileSync(craftBinary, join(outputDir, runtimeName));
22
25
  if (process.platform !== "win32") {
23
26
  chmodSync(join(outputDir, launcherName), 493);
@@ -39,13 +42,13 @@ writeFileSync(join(outputDir, "desktop.json"), `${JSON.stringify({
39
42
  const gitResult = Bun.spawnSync(["git", "rev-parse", "HEAD"], { cwd: projectPath() });
40
43
  if (gitResult.exitCode !== 0)
41
44
  throw Error("Desktop builds require an exact Git source revision");
42
- const sourceRevision = gitResult.stdout.toString().trim(), artifacts = [launcherName, runtimeName, "desktop.json"].map((name) => {
45
+ const sourceRevision = gitResult.stdout.toString().trim(), remoteResult = Bun.spawnSync(["git", "remote", "get-url", "origin"], { cwd: projectPath() }), sourceRepository = remoteResult.exitCode === 0 ? remoteResult.stdout.toString().trim().replace(/\.git$/, "") : "unknown", artifacts = [launcherName, runtimeName, "desktop.json"].map((name) => {
43
46
  const contents = readFileSync(join(outputDir, name));
44
47
  return { name, bytes: contents.byteLength, sha256: createHash("sha256").update(contents).digest("hex") };
45
48
  });
46
49
  writeFileSync(join(outputDir, "provenance.json"), `${JSON.stringify({
47
50
  schemaVersion: "1.0.0",
48
- sourceRepository: "https://github.com/stacksjs/stacks",
51
+ sourceRepository,
49
52
  sourceRevision,
50
53
  builtWith: { bun: Bun.version, craftSha256: artifacts.find((artifact) => artifact.name === runtimeName)?.sha256 },
51
54
  target: { platform: process.platform, architecture: process.arch, status: support.status, osVersions: support.osVersions },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.230",
5
+ "version": "0.70.232",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -62,32 +62,32 @@
62
62
  "prepublishOnly": "bun run build"
63
63
  },
64
64
  "dependencies": {
65
- "@stacksjs/config": "0.70.230",
65
+ "@stacksjs/config": "0.70.232",
66
66
  "@stacksjs/bumpx": "^0.2.6",
67
67
  "@stacksjs/bunpress": "^0.1.18",
68
68
  "@stacksjs/logsmith": "^0.2.3",
69
- "@stacksjs/registry": "0.70.230",
69
+ "@stacksjs/registry": "0.70.232",
70
70
  "@stacksjs/stx": "^0.2.148",
71
71
  "@stacksjs/ts-cloud": "^0.7.92",
72
72
  "@stacksjs/ts-md": "^0.1.1"
73
73
  },
74
74
  "devDependencies": {
75
- "@stacksjs/api": "0.70.230",
76
- "@stacksjs/cli": "0.70.230",
77
- "@stacksjs/database": "0.70.230",
75
+ "@stacksjs/api": "0.70.232",
76
+ "@stacksjs/cli": "0.70.232",
77
+ "@stacksjs/database": "0.70.232",
78
78
  "@stacksjs/tlsx": "^0.13.2",
79
79
  "better-dx": "^0.2.17",
80
- "@stacksjs/dns": "0.70.230",
81
- "@stacksjs/enums": "0.70.230",
82
- "@stacksjs/env": "0.70.230",
83
- "@stacksjs/error-handling": "0.70.230",
84
- "@stacksjs/logging": "0.70.230",
85
- "@stacksjs/path": "0.70.230",
86
- "@stacksjs/security": "0.70.230",
87
- "@stacksjs/storage": "0.70.230",
88
- "@stacksjs/strings": "0.70.230",
89
- "@stacksjs/utils": "0.70.230",
90
- "@stacksjs/validation": "0.70.230"
80
+ "@stacksjs/dns": "0.70.232",
81
+ "@stacksjs/enums": "0.70.232",
82
+ "@stacksjs/env": "0.70.232",
83
+ "@stacksjs/error-handling": "0.70.232",
84
+ "@stacksjs/logging": "0.70.232",
85
+ "@stacksjs/path": "0.70.232",
86
+ "@stacksjs/security": "0.70.232",
87
+ "@stacksjs/storage": "0.70.232",
88
+ "@stacksjs/strings": "0.70.232",
89
+ "@stacksjs/utils": "0.70.232",
90
+ "@stacksjs/validation": "0.70.232"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "pickier": "^0.1.35"