@stacksjs/desktop-build 0.75.708 → 0.75.709
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/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/webview-app.js +1 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -349,6 +349,7 @@ export declare interface CodesignOptions {
|
|
|
349
349
|
identity: string
|
|
350
350
|
target: string
|
|
351
351
|
entitlements?: string
|
|
352
|
+
identifier?: string
|
|
352
353
|
}
|
|
353
354
|
export type CraftLauncher = (command: string[]) => void | Promise<void>;
|
|
354
355
|
export type CraftBinaryLocator = (binary: string) => string | null;
|
package/dist/index.js
CHANGED
|
@@ -37,4 +37,4 @@ ${minimumSystem}${highResolution}${transportSecurity}${icon}${extra}
|
|
|
37
37
|
</dict>
|
|
38
38
|
</plist>
|
|
39
39
|
`;return{xml,ignored}}export function resolveDevWindowUrl(port,options={}){if(!Number.isInteger(port)||port<1||port>65535)throw new RangeError(`Invalid desktop development port: ${port}`);const configured=options.url||process.env.APP_URL;if(!configured)return`https://stacks.test`;const withProtocol=/^https?:\/\//.test(configured)?configured:`https://${configured}`;return new URL(withProtocol).toString().replace(/\/$/,"")}export function craftDevCommand(port,options={}){const command=[resolveCraftBinary(options.craftBin),...options.htmlFile?["--html-file",options.htmlFile]:[resolveDevWindowUrl(port,options)],"--title",options.title||"Stacks","--width",String(options.width||1400),"--height",String(options.height||900)];if(options.hotReload!==false)command.push("--hot-reload");if(options.devTools===false)command.push("--no-devtools");if(options.darkMode)command.push("--dark");if(options.systemTray)command.push("--system-tray");if(options.hideDockIcon)command.push("--hide-dock-icon");if(options.menubarOnly)command.push("--menubar-only");if(options.trayPopover)command.push("--tray-popover");return command}export function createUpdateManifestUrl(baseUrl,channel="stable"){if(!/^[a-z0-9-]+$/i.test(channel))throw new Error("Update channel may only contain letters, numbers, and hyphens");return new URL(`/desktop/updates/${channel}.json`,/^https?:\/\//.test(baseUrl)?baseUrl:`https://${baseUrl}`).toString()}async function launchCraft(command){const process=Bun.spawn(command,{stdin:"inherit",stdout:"inherit",stderr:"inherit"});process.unref()}export async function openDevWindow(port,options={},launcher=launchCraft){await launcher(craftDevCommand(port,options));return true}export const BUN_EXECUTABLE_MARKER="---- Bun!";const MARKER_SEARCH_BYTES=8*1024*1024;const RUNTIME_SIZE_FLOOR=40*1024*1024;const MACH_O_MAGIC=new Set([4277009102,3472551422,4277009103,3489328638,3405691582,3199925962]);export function isMachO(path){try{const fd=openSync(path,"r");try{const head=Buffer.alloc(4);if(readSync(fd,head,0,4,0)<4)return false;return MACH_O_MAGIC.has(head.readUInt32BE(0))}finally{closeSync(fd)}}catch{return false}}export function bundleDirectoryFor(path){return isMachO(path)?"MacOS":"Resources"}export function desktopAppVersion(options={}){const override=options.override?.trim();if(override)return override;const declared=typeof options.declared==="string"?options.declared.trim():"";return declared||"0.0.0"}export function dmgVolumeName(options){const override=options.override?.trim();if(override)return override;const appName=options.appName.trim();const version=options.version?.trim();return version?`${appName} ${version}`:`${appName} Installer`}export function notarytoolAuthArgs(credentials){return"profile"in credentials?["--keychain-profile",credentials.profile]:["--key",credentials.keyPath,"--key-id",credentials.keyId,"--issuer",credentials.issuerId]}export function notarizationOutcome(report,exitCode){const status=report.match(/status: (\w[\w ]*)/g)?.pop()?.replace("status: ","").trim();const id=report.match(/id: ([0-9a-f-]{36})/)?.[1];return{accepted:exitCode===0&&status==="Accepted",status,id}}export function developerIdProblem(codesignReport){if(/code object is not signed/.test(codesignReport)||/Signature=adhoc/.test(codesignReport))return"it is not signed with a certificate. Pass a Developer ID Application identity with --signing-identity.";const authority=/^Authority=(.+)$/m.exec(codesignReport)?.[1];if(!authority?.startsWith("Developer ID Application:"))return`it is signed by ${authority?`"${authority}"`:"an unknown identity"}, not a Developer ID Application certificate.`;if(!/flags=0x[0-9a-f]+\([^)]*runtime[^)]*\)/.test(codesignReport))return"it is not signed with the hardened runtime.";if(!/^Timestamp=/m.test(codesignReport))return"its signature has no secure timestamp.";return}function resolveNotary(flags,env){const profile=supplied(flags.notaryProfile)??supplied(env.DESKTOP_NOTARY_PROFILE);if(profile)return{profile};const requested=flags.notarize===true||["1","true","yes"].includes(supplied(env.DESKTOP_NOTARIZE)?.toLowerCase()??"");if(!requested)return;const keyId=supplied(flags.apiKeyId)??supplied(env.APP_STORE_CONNECT_API_KEY_ID);const issuerId=supplied(flags.apiIssuerId)??supplied(env.APP_STORE_CONNECT_API_ISSUER_ID);const keyPath=supplied(flags.apiKeyPath)??supplied(env.APP_STORE_CONNECT_API_KEY_PATH);const keyPem=supplied(env.APP_STORE_CONNECT_API_KEY)?.replaceAll("\\n",`
|
|
40
|
-
`);const missing=[!keyId&&"APP_STORE_CONNECT_API_KEY_ID (--api-key-id)",!issuerId&&"APP_STORE_CONNECT_API_ISSUER_ID (--api-issuer-id)",!keyPath&&!keyPem&&"APP_STORE_CONNECT_API_KEY_PATH (--api-key-path) or APP_STORE_CONNECT_API_KEY"].filter(Boolean);if(missing.length||!keyId||!issuerId)throw new Error(`Notarizing needs a keychain profile (--notary-profile or DESKTOP_NOTARY_PROFILE) or an App Store Connect API key. Missing: ${missing.join(", ")}.`);if(keyPath)return{keyId,issuerId,keyPath};if(!keyPem.includes("-----BEGIN PRIVATE KEY-----"))throw new Error("APP_STORE_CONNECT_API_KEY must hold the PEM text of the .p8 key.");return{keyId,issuerId,keyPem}}function supplied(value){if(typeof value!=="string")return;const trimmed=value.trim();return trimmed||undefined}export function resolveDmgPackaging(inputs={}){const flags=inputs.flags??{};const env=inputs.env??{};const appName=supplied(flags.appName)??supplied(env.DESKTOP_APP_NAME)??supplied(inputs.manifestTitle)??supplied(env.APP_NAME)??"Stacks";const version=desktopAppVersion({override:supplied(flags.appVersion)??supplied(env.DESKTOP_APP_VERSION),declared:inputs.declaredVersion});const bundleId=supplied(flags.bundleId)??supplied(env.DESKTOP_BUNDLE_ID)??`sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return{appName,bundleId,version,volumeName:dmgVolumeName({appName,version,override:supplied(flags.volumeName)??supplied(env.DESKTOP_VOLUME_NAME)}),signingIdentity:supplied(flags.signingIdentity)??supplied(env.DESKTOP_SIGNING_IDENTITY),notaryProfile:supplied(flags.notaryProfile)??supplied(env.DESKTOP_NOTARY_PROFILE),notary:resolveNotary(flags,env)}}export function codesignArgs(options){return["codesign","--force",options.identity==="-"?"--timestamp=none":"--timestamp","--options","runtime",...options.entitlements?["--entitlements",options.entitlements]:[],"--sign",options.identity,options.target]}export function looksLikeBunExecutable(path,read=readTail){const file=read(path);if(!file||file.size<RUNTIME_SIZE_FLOOR)return false;return file.tail.includes(BUN_EXECUTABLE_MARKER)}function readTail(path){try{const{size}=statSync(path);if(size<RUNTIME_SIZE_FLOOR)return{size,tail:""};const fd=openSync(path,"r");try{const length=Math.min(MARKER_SEARCH_BYTES,size);const buffer=Buffer.alloc(length);readSync(fd,buffer,0,length,size-length);return{size,tail:buffer.toString("latin1")}}finally{closeSync(fd)}}catch{return null}}export function describeRuntimeDuplication(runtimes){if(runtimes.length<2)return null;const sorted=[...runtimes].sort((a,b)=>b.bytes-a.bytes);const duplicated=sorted.slice(1);const wasted=duplicated.length*RUNTIME_SIZE_FLOOR;const names=sorted.map((r)=>`${r.name} (${(r.bytes/1024/1024).toFixed(1)} MB)`).join(", ");return`This bundle ships ${runtimes.length} Bun-compiled executables: ${names}. `+`Each embeds a full copy of the Bun runtime, so at least ${(wasted/1024/1024).toFixed(0)} MB of the bundle is the same runtime repeated. `+`Compiling one binary that dispatches on a subcommand — \`MyApp agent\`, \`MyApp worker\` — keeps the helpers as separate processes and pays for the runtime once.`}
|
|
40
|
+
`);const missing=[!keyId&&"APP_STORE_CONNECT_API_KEY_ID (--api-key-id)",!issuerId&&"APP_STORE_CONNECT_API_ISSUER_ID (--api-issuer-id)",!keyPath&&!keyPem&&"APP_STORE_CONNECT_API_KEY_PATH (--api-key-path) or APP_STORE_CONNECT_API_KEY"].filter(Boolean);if(missing.length||!keyId||!issuerId)throw new Error(`Notarizing needs a keychain profile (--notary-profile or DESKTOP_NOTARY_PROFILE) or an App Store Connect API key. Missing: ${missing.join(", ")}.`);if(keyPath)return{keyId,issuerId,keyPath};if(!keyPem.includes("-----BEGIN PRIVATE KEY-----"))throw new Error("APP_STORE_CONNECT_API_KEY must hold the PEM text of the .p8 key.");return{keyId,issuerId,keyPem}}function supplied(value){if(typeof value!=="string")return;const trimmed=value.trim();return trimmed||undefined}export function resolveDmgPackaging(inputs={}){const flags=inputs.flags??{};const env=inputs.env??{};const appName=supplied(flags.appName)??supplied(env.DESKTOP_APP_NAME)??supplied(inputs.manifestTitle)??supplied(env.APP_NAME)??"Stacks";const version=desktopAppVersion({override:supplied(flags.appVersion)??supplied(env.DESKTOP_APP_VERSION),declared:inputs.declaredVersion});const bundleId=supplied(flags.bundleId)??supplied(env.DESKTOP_BUNDLE_ID)??`sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return{appName,bundleId,version,volumeName:dmgVolumeName({appName,version,override:supplied(flags.volumeName)??supplied(env.DESKTOP_VOLUME_NAME)}),signingIdentity:supplied(flags.signingIdentity)??supplied(env.DESKTOP_SIGNING_IDENTITY),notaryProfile:supplied(flags.notaryProfile)??supplied(env.DESKTOP_NOTARY_PROFILE),notary:resolveNotary(flags,env)}}export function codesignArgs(options){return["codesign","--force",options.identity==="-"?"--timestamp=none":"--timestamp","--options","runtime",...options.entitlements?["--entitlements",options.entitlements]:[],...options.identifier?["--identifier",options.identifier]:[],"--sign",options.identity,options.target]}export function looksLikeBunExecutable(path,read=readTail){const file=read(path);if(!file||file.size<RUNTIME_SIZE_FLOOR)return false;return file.tail.includes(BUN_EXECUTABLE_MARKER)}function readTail(path){try{const{size}=statSync(path);if(size<RUNTIME_SIZE_FLOOR)return{size,tail:""};const fd=openSync(path,"r");try{const length=Math.min(MARKER_SEARCH_BYTES,size);const buffer=Buffer.alloc(length);readSync(fd,buffer,0,length,size-length);return{size,tail:buffer.toString("latin1")}}finally{closeSync(fd)}}catch{return null}}export function describeRuntimeDuplication(runtimes){if(runtimes.length<2)return null;const sorted=[...runtimes].sort((a,b)=>b.bytes-a.bytes);const duplicated=sorted.slice(1);const wasted=duplicated.length*RUNTIME_SIZE_FLOOR;const names=sorted.map((r)=>`${r.name} (${(r.bytes/1024/1024).toFixed(1)} MB)`).join(", ");return`This bundle ships ${runtimes.length} Bun-compiled executables: ${names}. `+`Each embeds a full copy of the Bun runtime, so at least ${(wasted/1024/1024).toFixed(0)} MB of the bundle is the same runtime repeated. `+`Compiling one binary that dispatches on a subcommand — \`MyApp agent\`, \`MyApp worker\` — keeps the helpers as separate processes and pays for the runtime once.`}
|
package/dist/webview-app.js
CHANGED
|
@@ -3,7 +3,7 @@ import{chmodSync,copyFileSync,existsSync,mkdirSync,readdirSync,readFileSync,rmSy
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
${plistValue({...BUN_HARDENED_ENTITLEMENTS,...config.macos?.entitlements})}
|
|
5
5
|
</plist>
|
|
6
|
-
`}export function renderWebviewInfoPlist(config,options={}){const schemes=config.urlSchemes??[];return renderInfoPlist({appName:config.appName,bundleId:config.macos?.bundleId??config.appId,version:config.version,buildNumber:config.buildNumber,executable:config.executable,iconFile:options.iconFile,ownsLauncher:true,declared:{LSMinimumSystemVersion:config.macos?.minimumSystemVersion??WEBVIEW_DEFAULTS.minimumSystemVersion,LSApplicationCategoryType:config.macos?.category??WEBVIEW_DEFAULTS.category,...schemes.length?{CFBundleURLTypes:[{CFBundleURLName:config.appId,CFBundleURLSchemes:schemes}]}:{},...config.macos?.usageDescriptions,...config.macos?.infoPlist}})}export function assembleWebviewMacosApp(options){const{config}=options;const run=options.run??runBundleCommand;const identity=options.signingIdentity??"-";const appPath=join(options.output,`${config.appName}.app`);const macos=join(appPath,"Contents","MacOS");const resources=join(appPath,"Contents","Resources");rmSync(appPath,{recursive:true,force:true});mkdirSync(macos,{recursive:true});mkdirSync(resources,{recursive:true});const executable=join(macos,config.executable);const runtime=join(macos,WEBVIEW_RUNTIME_NAME);copyFileSync(options.agent,executable);copyFileSync(options.runtime,runtime);chmodSync(executable,493);chmodSync(runtime,493);let iconFile;if(config.icon){const icon=resolve(options.root,config.icon);if(!existsSync(icon))throw new Error(`webview.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"}const plist=renderWebviewInfoPlist(config,{iconFile});writeFileSync(join(appPath,"Contents","Info.plist"),plist.xml);const entitlementsPath=join(options.output,`${config.appName}.entitlements`);writeFileSync(entitlementsPath,renderWebviewEntitlements(config));run(codesignArgs({identity,target:runtime}));run(codesignArgs({identity,target:appPath,entitlements:entitlementsPath}));return{appPath,entitlementsPath,ignoredPlistKeys:plist.ignored}}export function webviewPackageConfig(config,target,staged){const{platform,architecture}=splitDesktopTarget(target);const base={name:config.appName,version:config.version,...config.description?{description:config.description}:{},...config.publisher?{author:config.publisher}:{},...config.homepage?{homepage:config.homepage}:{},bundleId:config.appId,binaryPath:staged.binary,...staged.icon?{iconPath:staged.icon}:{},outDir:staged.outDir};if(platform==="win32"){return{...base,platforms:["windows"],windows:{msi:true,zip:true,architecture,...staged.additionalFiles?.length?{additionalFiles:staged.additionalFiles}:{},...config.urlSchemes?.length?{urlSchemes:config.urlSchemes}:{},...config.windows?.certificatePath?{certificatePath:config.windows.certificatePath,...staged.certificatePassword?{certificatePassword:staged.certificatePassword}:{}}:{}}}}return{...base,platforms:["linux"],linux:{appImage:true,deb:true,rpm:true,categories:config.linux?.categories??["Development"],...config.urlSchemes?.length?{urlSchemes:config.urlSchemes}:{},...config.linux?.debDependencies?{debDependencies:config.linux.debDependencies}:{},...config.linux?.rpmDependencies?{rpmDependencies:config.linux.rpmDependencies}:{}}}}export function nativeBuildSteps(target){const{platform}=splitDesktopTarget(target);if(platform==="darwin")return"The .app is assembled and signed with codesign, notarized with notarytool and imaged with hdiutil: macOS only.";if(platform==="win32")return"The MSI is built with WiX (candle, light) and signed with signtool: Windows only.";return"The AppImage (appimagetool), deb (dpkg-deb) and rpm (rpmbuild) are built with Linux tools: Linux only."}export function signtoolArgs(options){return["signtool.exe","sign","/f",options.certificatePath,...options.certificatePassword?["/p",options.certificatePassword]:[],"/fd","SHA256","/tr",options.timestampUrl??"http://timestamp.digicert.com","/td","SHA256",options.file]}export function releaseArtifactNames(config,target){const{platform,architecture}=splitDesktopTarget(target);const base=`${config.appName.replace(/[^\w.-]+/g,"-")}-${config.version}-${architecture}`;if(platform==="darwin")return{update:`${base}.zip`,downloads:[`${base}.dmg`]};if(platform==="win32")return{update:`${base}.msi`,downloads:[`${base}.msi`]};return{update:`${base}.AppImage`,downloads:[`${base}.AppImage`,`${base}.deb`,`${base}.rpm`]}}export function releaseArtifactFormat(name){return name.slice(name.lastIndexOf(".")+1).toLowerCase()}export function signingIdentityNote(identity,chosen){if(chosen)return;const fix="Set DESKTOP_SIGNING_IDENTITY (or pass --identity) to a Developer ID Application certificate to build what a release can notarize; `buddy release:desktop --identity` signs it again otherwise.";if(identity==="-")return`Signed ad hoc: it runs on this Mac only. ${fix}`;return`Signed with the Apple Development certificate found on this Mac: it runs here, and cannot be notarized. ${fix}`}export function resignWebviewMacosApp(options){const run=options.run??runBundleCommand;const runtime=join(options.appPath,"Contents","MacOS",WEBVIEW_RUNTIME_NAME);if(!existsSync(runtime))throw new Error(`${options.appPath} has no ${WEBVIEW_RUNTIME_NAME}: it is not a web view app this build made.`);let entitlements=options.entitlementsPath;if(!entitlements||!existsSync(entitlements)){entitlements=join(dirname(options.appPath),`${basename(options.appPath,".app")}.entitlements`);writeFileSync(entitlements,renderWebviewEntitlements(options.config))}run(codesignArgs({identity:options.signingIdentity,target:runtime}));run(codesignArgs({identity:options.signingIdentity,target:options.appPath,entitlements}))}export function releaseVersionProblem(version,published,compare){if(!published)return;const order=compare(version,published);if(order===0)return`${version} is already published. Bump the version; a published build is never replaced under the same number.`;if(order<0)return`${published} is already published, which is newer than ${version}.`;return}export function resolveWebviewComponents(root,components){return(components??[]).map((directory)=>resolve(root,directory))}export function renderViewsBuildScript(options){const pages=relative(options.root,options.viewsDir);const site={name:options.appName,url:"http://127.0.0.1",pagesDir:pages,outDir:options.outDir,publicDir:join(pages,"public"),...webviewComponentDirs(resolveWebviewComponents(options.root,options.components)),sitemap:false,robots:false};return`// Written by buddy build:desktop. Do not edit.
|
|
6
|
+
`}export function renderWebviewInfoPlist(config,options={}){const schemes=config.urlSchemes??[];return renderInfoPlist({appName:config.appName,bundleId:config.macos?.bundleId??config.appId,version:config.version,buildNumber:config.buildNumber,executable:config.executable,iconFile:options.iconFile,ownsLauncher:true,declared:{LSMinimumSystemVersion:config.macos?.minimumSystemVersion??WEBVIEW_DEFAULTS.minimumSystemVersion,LSApplicationCategoryType:config.macos?.category??WEBVIEW_DEFAULTS.category,...schemes.length?{CFBundleURLTypes:[{CFBundleURLName:config.appId,CFBundleURLSchemes:schemes}]}:{},...config.macos?.usageDescriptions,...config.macos?.infoPlist}})}export function assembleWebviewMacosApp(options){const{config}=options;const run=options.run??runBundleCommand;const identity=options.signingIdentity??"-";const appPath=join(options.output,`${config.appName}.app`);const macos=join(appPath,"Contents","MacOS");const resources=join(appPath,"Contents","Resources");rmSync(appPath,{recursive:true,force:true});mkdirSync(macos,{recursive:true});mkdirSync(resources,{recursive:true});const executable=join(macos,config.executable);const runtime=join(macos,WEBVIEW_RUNTIME_NAME);copyFileSync(options.agent,executable);copyFileSync(options.runtime,runtime);chmodSync(executable,493);chmodSync(runtime,493);let iconFile;if(config.icon){const icon=resolve(options.root,config.icon);if(!existsSync(icon))throw new Error(`webview.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"}const plist=renderWebviewInfoPlist(config,{iconFile});writeFileSync(join(appPath,"Contents","Info.plist"),plist.xml);const entitlementsPath=join(options.output,`${config.appName}.entitlements`);writeFileSync(entitlementsPath,renderWebviewEntitlements(config));run(codesignArgs({identity,target:runtime,identifier:config.macos?.bundleId??config.appId}));run(codesignArgs({identity,target:appPath,entitlements:entitlementsPath}));return{appPath,entitlementsPath,ignoredPlistKeys:plist.ignored}}export function webviewPackageConfig(config,target,staged){const{platform,architecture}=splitDesktopTarget(target);const base={name:config.appName,version:config.version,...config.description?{description:config.description}:{},...config.publisher?{author:config.publisher}:{},...config.homepage?{homepage:config.homepage}:{},bundleId:config.appId,binaryPath:staged.binary,...staged.icon?{iconPath:staged.icon}:{},outDir:staged.outDir};if(platform==="win32"){return{...base,platforms:["windows"],windows:{msi:true,zip:true,architecture,...staged.additionalFiles?.length?{additionalFiles:staged.additionalFiles}:{},...config.urlSchemes?.length?{urlSchemes:config.urlSchemes}:{},...config.windows?.certificatePath?{certificatePath:config.windows.certificatePath,...staged.certificatePassword?{certificatePassword:staged.certificatePassword}:{}}:{}}}}return{...base,platforms:["linux"],linux:{appImage:true,deb:true,rpm:true,categories:config.linux?.categories??["Development"],...config.urlSchemes?.length?{urlSchemes:config.urlSchemes}:{},...config.linux?.debDependencies?{debDependencies:config.linux.debDependencies}:{},...config.linux?.rpmDependencies?{rpmDependencies:config.linux.rpmDependencies}:{}}}}export function nativeBuildSteps(target){const{platform}=splitDesktopTarget(target);if(platform==="darwin")return"The .app is assembled and signed with codesign, notarized with notarytool and imaged with hdiutil: macOS only.";if(platform==="win32")return"The MSI is built with WiX (candle, light) and signed with signtool: Windows only.";return"The AppImage (appimagetool), deb (dpkg-deb) and rpm (rpmbuild) are built with Linux tools: Linux only."}export function signtoolArgs(options){return["signtool.exe","sign","/f",options.certificatePath,...options.certificatePassword?["/p",options.certificatePassword]:[],"/fd","SHA256","/tr",options.timestampUrl??"http://timestamp.digicert.com","/td","SHA256",options.file]}export function releaseArtifactNames(config,target){const{platform,architecture}=splitDesktopTarget(target);const base=`${config.appName.replace(/[^\w.-]+/g,"-")}-${config.version}-${architecture}`;if(platform==="darwin")return{update:`${base}.zip`,downloads:[`${base}.dmg`]};if(platform==="win32")return{update:`${base}.msi`,downloads:[`${base}.msi`]};return{update:`${base}.AppImage`,downloads:[`${base}.AppImage`,`${base}.deb`,`${base}.rpm`]}}export function releaseArtifactFormat(name){return name.slice(name.lastIndexOf(".")+1).toLowerCase()}export function signingIdentityNote(identity,chosen){if(chosen)return;const fix="Set DESKTOP_SIGNING_IDENTITY (or pass --identity) to a Developer ID Application certificate to build what a release can notarize; `buddy release:desktop --identity` signs it again otherwise.";if(identity==="-")return`Signed ad hoc: it runs on this Mac only. ${fix}`;return`Signed with the Apple Development certificate found on this Mac: it runs here, and cannot be notarized. ${fix}`}export function resignWebviewMacosApp(options){const run=options.run??runBundleCommand;const runtime=join(options.appPath,"Contents","MacOS",WEBVIEW_RUNTIME_NAME);if(!existsSync(runtime))throw new Error(`${options.appPath} has no ${WEBVIEW_RUNTIME_NAME}: it is not a web view app this build made.`);const plist=readFileSync(join(options.appPath,"Contents","Info.plist"),"utf8");const identifier=/<key>CFBundleIdentifier<\/key>\s*<string>([a-z0-9.-]+)<\/string>/i.exec(plist)?.[1];if(!identifier)throw new Error(`${options.appPath} has no valid CFBundleIdentifier in its Info.plist.`);let entitlements=options.entitlementsPath;if(!entitlements||!existsSync(entitlements)){entitlements=join(dirname(options.appPath),`${basename(options.appPath,".app")}.entitlements`);writeFileSync(entitlements,renderWebviewEntitlements(options.config))}run(codesignArgs({identity:options.signingIdentity,target:runtime,identifier}));run(codesignArgs({identity:options.signingIdentity,target:options.appPath,entitlements}))}export function releaseVersionProblem(version,published,compare){if(!published)return;const order=compare(version,published);if(order===0)return`${version} is already published. Bump the version; a published build is never replaced under the same number.`;if(order<0)return`${published} is already published, which is newer than ${version}.`;return}export function resolveWebviewComponents(root,components){return(components??[]).map((directory)=>resolve(root,directory))}export function renderViewsBuildScript(options){const pages=relative(options.root,options.viewsDir);const site={name:options.appName,url:"http://127.0.0.1",pagesDir:pages,outDir:options.outDir,publicDir:join(pages,"public"),...webviewComponentDirs(resolveWebviewComponents(options.root,options.components)),sitemap:false,robots:false};return`// Written by buddy build:desktop. Do not edit.
|
|
7
7
|
import { buildStaticSite } from '@stacksjs/stx'
|
|
8
8
|
|
|
9
9
|
await buildStaticSite(${JSON.stringify(site,null,2)})
|
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.709",
|
|
6
6
|
"description": "Build and launch Craft desktop applications for Stacks",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -73,17 +73,17 @@
|
|
|
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.
|
|
79
|
-
"@stacksjs/storage": "0.75.
|
|
76
|
+
"@stacksjs/config": "0.75.709",
|
|
77
|
+
"@stacksjs/router": "0.75.709",
|
|
78
|
+
"@stacksjs/server": "0.75.709",
|
|
79
|
+
"@stacksjs/storage": "0.75.709",
|
|
80
80
|
"craft-native": ">=0.0.505"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
|
-
"@stacksjs/config": "0.75.
|
|
84
|
-
"@stacksjs/router": "0.75.
|
|
85
|
-
"@stacksjs/server": "0.75.
|
|
86
|
-
"@stacksjs/storage": "0.75.
|
|
83
|
+
"@stacksjs/config": "0.75.709",
|
|
84
|
+
"@stacksjs/router": "0.75.709",
|
|
85
|
+
"@stacksjs/server": "0.75.709",
|
|
86
|
+
"@stacksjs/storage": "0.75.709"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@stacksjs/config": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@stacksjs/build": "0.75.
|
|
103
|
+
"@stacksjs/build": "0.75.709",
|
|
104
104
|
"better-dx": "^0.2.39"
|
|
105
105
|
}
|
|
106
106
|
}
|