@stacksjs/desktop-build 0.75.406 → 0.75.408
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/macos-bundle.js +1 -1
- package/package.json +8 -8
package/dist/macos-bundle.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{chmodSync,copyFileSync,cpSync,existsSync,mkdirSync,rmSync,writeFileSync}from"node:fs";import{join,resolve}from"node:path";import{AGENT_MANIFEST}from"./agent-launcher";import{ICONSET_SIZES,renderHostConfig,renderMacosEntitlements,renderMacosHostEntitlements,renderMacosInfoPlist,renderPrivacyManifest}from"./macos-app";export const AGENT_HOST_EXECUTABLE="craft-runtime",runBundleCommand=(args)=>{const result=Bun.spawnSync(args,{stdout:"pipe",stderr:"pipe"});if(result.exitCode!==0)throw Error(`${args[0]} ${args.slice(1).join(" ")} exited with ${result.exitCode}: ${result.stderr.toString().trim()||result.stdout.toString().trim()}`)};export function makeIcns(png,output,scratch,run=runBundleCommand){const iconset=join(scratch,"AppIcon.iconset");rmSync(iconset,{recursive:!0,force:!0});mkdirSync(iconset,{recursive:!0});for(const{file,pixels}of ICONSET_SIZES)run(["sips","-z",String(pixels),String(pixels),png,"--out",join(iconset,file)]);run(["iconutil","-c","icns",iconset,"-o",output]);rmSync(iconset,{recursive:!0,force:!0})}export function assembleMacosApp(options){const run=options.run??runBundleCommand,{config}=options,notes=[],appPath=join(options.output,`${config.appName}.app`),contents=join(appPath,"Contents"),macos=join(contents,"MacOS"),resources=join(contents,"Resources");rmSync(appPath,{recursive:!0,force:!0});mkdirSync(macos,{recursive:!0});mkdirSync(resources,{recursive:!0});if(options.agent){if(!config.agent)throw Error("An agent launcher was given for an app whose config has no macos.agent");copyFileSync(options.agent.launcher,join(macos,config.executable));copyFileSync(options.host,join(macos,AGENT_HOST_EXECUTABLE));chmodSync(join(macos,AGENT_HOST_EXECUTABLE),493);const manifest={...options.agent.manifest,host:`../MacOS/${AGENT_HOST_EXECUTABLE}`,nativeBundle:"native-screen.js"};if(options.agent.manifest.staticDir){cpSync(options.agent.manifest.staticDir,join(resources,"web"),{recursive:!0});manifest.staticDir="web"}writeFileSync(join(resources,AGENT_MANIFEST),`${JSON.stringify(manifest,null,2)}
|
|
2
|
-
`)}else copyFileSync(options.host,join(macos,config.executable));chmodSync(join(macos,config.executable),493);copyFileSync(options.nativeBundle,join(resources,"native-screen.js"));writeFileSync(join(resources,"craft-app.json"),renderHostConfig(config));writeFileSync(join(resources,"PrivacyInfo.xcprivacy"),renderPrivacyManifest(config));let iconFile;if(config.icon){const icon=resolve(options.root,config.icon);if(!existsSync(icon))throw Error(`macos.icon does not exist: ${icon}`);if(icon.endsWith(".icns"))copyFileSync(icon,join(resources,"AppIcon.icns"));else makeIcns(icon,join(resources,"AppIcon.icns"),options.output,run);iconFile="AppIcon"}else notes.push("No macos.icon: the app has the generic icon, which the Mac App Store rejects.");const plist=renderMacosInfoPlist(config,{iconFile});writeFileSync(join(contents,"Info.plist"),plist.xml);if(options.distribution==="app-store"){if(!options.provisioningProfile)throw Error("A Mac App Store build needs a provisioning profile");
|
|
2
|
+
`)}else copyFileSync(options.host,join(macos,config.executable));chmodSync(join(macos,config.executable),493);copyFileSync(options.nativeBundle,join(resources,"native-screen.js"));writeFileSync(join(resources,"craft-app.json"),renderHostConfig(config));writeFileSync(join(resources,"PrivacyInfo.xcprivacy"),renderPrivacyManifest(config));let iconFile;if(config.icon){const icon=resolve(options.root,config.icon);if(!existsSync(icon))throw Error(`macos.icon does not exist: ${icon}`);if(icon.endsWith(".icns"))copyFileSync(icon,join(resources,"AppIcon.icns"));else makeIcns(icon,join(resources,"AppIcon.icns"),options.output,run);iconFile="AppIcon"}else notes.push("No macos.icon: the app has the generic icon, which the Mac App Store rejects.");const plist=renderMacosInfoPlist(config,{iconFile});writeFileSync(join(contents,"Info.plist"),plist.xml);if(options.distribution==="app-store"){if(!options.provisioningProfile)throw Error("A Mac App Store build needs a provisioning profile");const embedded=join(contents,"embedded.provisionprofile");copyFileSync(options.provisioningProfile,embedded);chmodSync(embedded,420)}const signed=options.unsandboxed?{...config,sandbox:!1}:config,entitlementsPath=join(options.output,`${config.appName}.entitlements`);writeFileSync(entitlementsPath,renderMacosEntitlements(signed,options.distribution));const hostEntitlements=join(options.output,`${config.appName}.host.entitlements`);if(options.agent)writeFileSync(hostEntitlements,renderMacosHostEntitlements(signed));run(["plutil","-lint",join(contents,"Info.plist"),join(resources,"PrivacyInfo.xcprivacy"),entitlementsPath,...options.agent?[hostEntitlements]:[]]);const identity=options.signingIdentity||"-";if(options.agent)run(["codesign","--force","--options","runtime",...identity==="-"?[]:["--timestamp"],"--entitlements",hostEntitlements,...options.keychain?["--keychain",options.keychain]:[],"--sign",identity,join(macos,AGENT_HOST_EXECUTABLE)]);run(["codesign","--force","--options","runtime",...identity==="-"?[]:["--timestamp"],"--entitlements",entitlementsPath,...options.keychain?["--keychain",options.keychain]:[],"--sign",identity,appPath]);run(["codesign","--verify","--deep","--strict",appPath]);return{appPath,entitlementsPath,ignoredPlistKeys:plist.ignored,notes}}export function parseDevelopmentIdentity(output){for(const line of output.split(`
|
|
3
3
|
`)){const match=/^\s*\d+\)\s+([0-9A-F]{40})\s+"Apple Development:/.exec(line);if(match)return match[1]}return}export function findDevelopmentIdentity(read=()=>Bun.spawnSync(["security","find-identity","-v","-p","codesigning"],{stdout:"pipe",stderr:"ignore"}).stdout.toString()){try{return parseDevelopmentIdentity(read())}catch{return}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/desktop-build",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.408",
|
|
6
6
|
"description": "Build and launch Craft desktop applications for Stacks",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"prepublishOnly": "bun run build"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@stacksjs/config": "0.75.
|
|
77
|
-
"@stacksjs/router": "0.75.
|
|
78
|
-
"@stacksjs/server": "0.75.
|
|
76
|
+
"@stacksjs/config": "0.75.408",
|
|
77
|
+
"@stacksjs/router": "0.75.408",
|
|
78
|
+
"@stacksjs/server": "0.75.408",
|
|
79
79
|
"craft-native": ">=0.0.416"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@stacksjs/config": "0.75.
|
|
83
|
-
"@stacksjs/router": "0.75.
|
|
84
|
-
"@stacksjs/server": "0.75.
|
|
82
|
+
"@stacksjs/config": "0.75.408",
|
|
83
|
+
"@stacksjs/router": "0.75.408",
|
|
84
|
+
"@stacksjs/server": "0.75.408"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"@stacksjs/config": {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@stacksjs/build": "0.75.
|
|
98
|
+
"@stacksjs/build": "0.75.408",
|
|
99
99
|
"better-dx": "^0.2.24"
|
|
100
100
|
}
|
|
101
101
|
}
|