sparkbun 0.1.7 → 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 +44 -72
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkbun",
3
- "version": "0.1.7",
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
@@ -2548,7 +2548,8 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2548
2548
  // libasar is still loaded by SparkBunCore at runtime — needed until
2549
2549
  // native wrappers are recompiled without ASAR support
2550
2550
  const libExt = targetOS === "win" ? ".dll" : targetOS === "macos" ? ".dylib" : ".so";
2551
- 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);
2552
2553
  if (existsSync(asarLibSource)) {
2553
2554
  cpSync(asarLibSource, join(appBundleMacOSPath, "libasar" + libExt), {
2554
2555
  dereference: true,
@@ -2813,9 +2814,12 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2813
2814
  artifactsToUpload.push(debPath);
2814
2815
  }
2815
2816
 
2816
- // This branch only runs for non-dev release packaging, so the temp app bundle
2817
- // can always be removed after the tarball is produced.
2818
- 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
+ }
2819
2823
 
2820
2824
  // generate bsdiff
2821
2825
  // https://storage.googleapis.com/eggbun-static/sparkbun-playground/canary/SparkBunPlayground-canary.app.tar.gz
@@ -2973,84 +2977,52 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
2973
2977
  unlinkSync(tarPath);
2974
2978
  }
2975
2979
 
2976
- const selfExtractingBundle = createAppBundle(
2977
- bundleName,
2978
- buildFolder,
2979
- targetOS,
2980
- );
2981
- const compressedTarballInExtractingBundlePath = join(
2982
- selfExtractingBundle.appBundleFolderResourcesPath,
2983
- `${hash}.tar.gz`,
2984
- );
2985
-
2986
- // copy the gzip tarball to the self-extracting app bundle
2987
- cpSync(compressedTarPath, compressedTarballInExtractingBundlePath, {
2988
- dereference: true,
2989
- });
2990
-
2991
- // macOS uses the Zig extractor in the self-extracting .app bundle.
2992
- // Windows/Linux use createCompiledInstaller instead.
2993
- if (targetOS === "macos") {
2994
- const selfExtractorBinSourcePath = targetPaths.EXTRACTOR;
2995
- const selfExtractorBinDestinationPath = join(
2996
- selfExtractingBundle.appBundleMacOSPath,
2997
- 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`,
2998
2990
  );
2999
2991
 
3000
- cpSync(selfExtractorBinSourcePath, selfExtractorBinDestinationPath, {
2992
+ cpSync(compressedTarPath, compressedTarballInExtractingBundlePath, {
3001
2993
  dereference: true,
3002
2994
  });
3003
- }
3004
2995
 
3005
- buildIcons(
3006
- selfExtractingBundle.appBundleFolderResourcesPath,
3007
- selfExtractingBundle.appBundleFolderPath,
3008
- );
3009
- await Bun.write(
3010
- join(selfExtractingBundle.appBundleFolderContentsPath, "Info.plist"),
3011
- InfoPlistContents,
3012
- );
3013
-
3014
- // Write metadata.json to outer bundle (consistent with Windows/Linux)
3015
- const extractorMetadata = {
3016
- identifier: config.app.identifier,
3017
- name: config.app.name,
3018
- channel: buildEnvironment,
3019
- hash: hash,
3020
- };
3021
- await Bun.write(
3022
- join(
2996
+ buildIcons(
3023
2997
  selfExtractingBundle.appBundleFolderResourcesPath,
3024
- "metadata.json",
3025
- ),
3026
- JSON.stringify(extractorMetadata, null, 2),
3027
- );
3028
-
3029
- // Run postWrap hook after self-extracting bundle is created, before code signing
3030
- // This is where you can add files to the wrapper (e.g., for liquid glass support)
3031
- runHook("postWrap", {
3032
- SPARKBUN_WRAPPER_BUNDLE_PATH:
3033
2998
  selfExtractingBundle.appBundleFolderPath,
3034
- });
2999
+ );
3000
+ await Bun.write(
3001
+ join(selfExtractingBundle.appBundleFolderContentsPath, "Info.plist"),
3002
+ InfoPlistContents,
3003
+ );
3035
3004
 
3036
- if (shouldCodesign) {
3037
- codesignAppBundle(
3038
- selfExtractingBundle.appBundleFolderPath,
3039
- join(buildFolder, "entitlements.plist"),
3040
- 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),
3041
3017
  );
3042
- } else {
3043
- console.log("skipping codesign");
3044
- }
3045
3018
 
3046
- // Note: we need to notarize the original app bundle, the self-extracting app bundle, and the dmg
3047
- if (shouldNotarize) {
3048
- notarizeAndStaple(selfExtractingBundle.appBundleFolderPath, config);
3049
- } else {
3050
- console.log("skipping notarization");
3019
+ runHook("postWrap", {
3020
+ SPARKBUN_WRAPPER_BUNDLE_PATH:
3021
+ selfExtractingBundle.appBundleFolderPath,
3022
+ });
3051
3023
  }
3052
3024
 
3053
- // DMG creation for macOS only
3025
+ // DMG creation for macOS — uses the real app bundle directly
3054
3026
  if (targetOS === "macos" && config.build.mac?.createDmg !== false) {
3055
3027
  console.log("creating dmg...");
3056
3028
  const finalDmgPath = join(buildFolder, `${appFileName}.dmg`);
@@ -3078,10 +3050,10 @@ usageDescriptions : ""}${urlTypes ? "\n" + urlTypes : ""}${documentTypes ?
3078
3050
  // Copy the app bundle to the staging directory
3079
3051
  const stagedAppPath = join(
3080
3052
  dmgStagingDir,
3081
- basename(selfExtractingBundle.appBundleFolderPath),
3053
+ basename(appBundleFolderPath),
3082
3054
  );
3083
3055
  execSync(
3084
- `cp -R ${escapePathForTerminal(selfExtractingBundle.appBundleFolderPath)} ${escapePathForTerminal(stagedAppPath)}`,
3056
+ `cp -R ${escapePathForTerminal(appBundleFolderPath)} ${escapePathForTerminal(stagedAppPath)}`,
3085
3057
  );
3086
3058
 
3087
3059
  // Create a symlink to /Applications for easy drag-and-drop installation