sparkbun 0.1.6 → 0.1.8

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/package.json +1 -1
  2. package/src/cli/index.ts +45 -76
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkbun",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Build fast, lightweight, cross-platform desktop apps with TypeScript and Bun.",
5
5
  "license": "MIT",
6
6
  "author": "SparkBun Contributors",
package/src/cli/index.ts CHANGED
@@ -163,10 +163,7 @@ async function ensureCoreDependencies(
163
163
 
164
164
  // Check platform-specific binaries
165
165
  // BUN_BINARY not required — SparkBun compiles the launcher via bun build --compile
166
- const requiredBinaries = [
167
- platformPaths.BSDIFF,
168
- platformPaths.BSPATCH,
169
- ];
166
+ const requiredBinaries: string[] = [];
170
167
  if (platformOS === "macos") {
171
168
  requiredBinaries.push(
172
169
  platformPaths.NATIVE_WRAPPER_MACOS,
@@ -2551,7 +2548,8 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2551
2548
  // libasar is still loaded by SparkBunCore at runtime — needed until
2552
2549
  // native wrappers are recompiled without ASAR support
2553
2550
  const libExt = targetOS === "win" ? ".dll" : targetOS === "macos" ? ".dylib" : ".so";
2554
- const asarLibSource = join(dirname(targetPaths.BSPATCH), "libasar" + libExt);
2551
+ const platformDistDir = join(SPARKBUN_DEP_PATH, `dist-${targetOS}-${targetARCH}`);
2552
+ const asarLibSource = join(platformDistDir, "libasar" + libExt);
2555
2553
  if (existsSync(asarLibSource)) {
2556
2554
  cpSync(asarLibSource, join(appBundleMacOSPath, "libasar" + libExt), {
2557
2555
  dereference: true,
@@ -2816,9 +2814,12 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2816
2814
  artifactsToUpload.push(debPath);
2817
2815
  }
2818
2816
 
2819
- // This branch only runs for non-dev release packaging, so the temp app bundle
2820
- // can always be removed after the tarball is produced.
2821
- rmSync(appBundleFolderPath, { recursive: true });
2817
+ // For Windows/Linux, the app bundle is deleted after tarring since
2818
+ // createCompiledInstaller builds a standalone installer binary.
2819
+ // For macOS, keep the app bundle — it goes directly into the DMG.
2820
+ if (targetOS !== "macos") {
2821
+ rmSync(appBundleFolderPath, { recursive: true });
2822
+ }
2822
2823
 
2823
2824
  // generate bsdiff
2824
2825
  // https://storage.googleapis.com/eggbun-static/sparkbun-playground/canary/SparkBunPlayground-canary.app.tar.gz
@@ -2976,84 +2977,52 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2976
2977
  unlinkSync(tarPath);
2977
2978
  }
2978
2979
 
2979
- const selfExtractingBundle = createAppBundle(
2980
- bundleName,
2981
- buildFolder,
2982
- targetOS,
2983
- );
2984
- const compressedTarballInExtractingBundlePath = join(
2985
- selfExtractingBundle.appBundleFolderResourcesPath,
2986
- `${hash}.tar.gz`,
2987
- );
2988
-
2989
- // copy the gzip tarball to the self-extracting app bundle
2990
- cpSync(compressedTarPath, compressedTarballInExtractingBundlePath, {
2991
- dereference: true,
2992
- });
2993
-
2994
- // macOS uses the Zig extractor in the self-extracting .app bundle.
2995
- // Windows/Linux use createCompiledInstaller instead.
2996
- if (targetOS === "macos") {
2997
- const selfExtractorBinSourcePath = targetPaths.EXTRACTOR;
2998
- const selfExtractorBinDestinationPath = join(
2999
- selfExtractingBundle.appBundleMacOSPath,
3000
- config.app.name.replace(/ /g, ""),
2980
+ // For Windows/Linux, create a self-extracting installer bundle
2981
+ if (targetOS !== "macos") {
2982
+ const selfExtractingBundle = createAppBundle(
2983
+ bundleName,
2984
+ buildFolder,
2985
+ targetOS,
2986
+ );
2987
+ const compressedTarballInExtractingBundlePath = join(
2988
+ selfExtractingBundle.appBundleFolderResourcesPath,
2989
+ `${hash}.tar.gz`,
3001
2990
  );
3002
2991
 
3003
- cpSync(selfExtractorBinSourcePath, selfExtractorBinDestinationPath, {
2992
+ cpSync(compressedTarPath, compressedTarballInExtractingBundlePath, {
3004
2993
  dereference: true,
3005
2994
  });
3006
- }
3007
-
3008
- buildIcons(
3009
- selfExtractingBundle.appBundleFolderResourcesPath,
3010
- selfExtractingBundle.appBundleFolderPath,
3011
- );
3012
- await Bun.write(
3013
- join(selfExtractingBundle.appBundleFolderContentsPath, "Info.plist"),
3014
- InfoPlistContents,
3015
- );
3016
2995
 
3017
- // Write metadata.json to outer bundle (consistent with Windows/Linux)
3018
- const extractorMetadata = {
3019
- identifier: config.app.identifier,
3020
- name: config.app.name,
3021
- channel: buildEnvironment,
3022
- hash: hash,
3023
- };
3024
- await Bun.write(
3025
- join(
2996
+ buildIcons(
3026
2997
  selfExtractingBundle.appBundleFolderResourcesPath,
3027
- "metadata.json",
3028
- ),
3029
- JSON.stringify(extractorMetadata, null, 2),
3030
- );
3031
-
3032
- // Run postWrap hook after self-extracting bundle is created, before code signing
3033
- // This is where you can add files to the wrapper (e.g., for liquid glass support)
3034
- runHook("postWrap", {
3035
- SPARKBUN_WRAPPER_BUNDLE_PATH:
3036
2998
  selfExtractingBundle.appBundleFolderPath,
3037
- });
2999
+ );
3000
+ await Bun.write(
3001
+ join(selfExtractingBundle.appBundleFolderContentsPath, "Info.plist"),
3002
+ InfoPlistContents,
3003
+ );
3038
3004
 
3039
- if (shouldCodesign) {
3040
- codesignAppBundle(
3041
- selfExtractingBundle.appBundleFolderPath,
3042
- join(buildFolder, "entitlements.plist"),
3043
- config,
3005
+ const extractorMetadata = {
3006
+ identifier: config.app.identifier,
3007
+ name: config.app.name,
3008
+ channel: buildEnvironment,
3009
+ hash: hash,
3010
+ };
3011
+ await Bun.write(
3012
+ join(
3013
+ selfExtractingBundle.appBundleFolderResourcesPath,
3014
+ "metadata.json",
3015
+ ),
3016
+ JSON.stringify(extractorMetadata, null, 2),
3044
3017
  );
3045
- } else {
3046
- console.log("skipping codesign");
3047
- }
3048
3018
 
3049
- // Note: we need to notarize the original app bundle, the self-extracting app bundle, and the dmg
3050
- if (shouldNotarize) {
3051
- notarizeAndStaple(selfExtractingBundle.appBundleFolderPath, config);
3052
- } else {
3053
- console.log("skipping notarization");
3019
+ runHook("postWrap", {
3020
+ SPARKBUN_WRAPPER_BUNDLE_PATH:
3021
+ selfExtractingBundle.appBundleFolderPath,
3022
+ });
3054
3023
  }
3055
3024
 
3056
- // DMG creation for macOS only
3025
+ // DMG creation for macOS — uses the real app bundle directly
3057
3026
  if (targetOS === "macos" && config.build.mac?.createDmg !== false) {
3058
3027
  console.log("creating dmg...");
3059
3028
  const finalDmgPath = join(buildFolder, `${appFileName}.dmg`);
@@ -3081,10 +3050,10 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
3081
3050
  // Copy the app bundle to the staging directory
3082
3051
  const stagedAppPath = join(
3083
3052
  dmgStagingDir,
3084
- basename(selfExtractingBundle.appBundleFolderPath),
3053
+ basename(appBundleFolderPath),
3085
3054
  );
3086
3055
  execSync(
3087
- `cp -R ${escapePathForTerminal(selfExtractingBundle.appBundleFolderPath)} ${escapePathForTerminal(stagedAppPath)}`,
3056
+ `cp -R ${escapePathForTerminal(appBundleFolderPath)} ${escapePathForTerminal(stagedAppPath)}`,
3088
3057
  );
3089
3058
 
3090
3059
  // Create a symlink to /Applications for easy drag-and-drop installation