@stacksjs/actions 0.75.408 → 0.75.409
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/build/dmg.js +2 -1
- package/package.json +44 -44
package/dist/build/dmg.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{cpSync,existsSync,mkdirSync,mkdtempSync,readdirSync,readFileSync,rmSync,statSync,symlinkSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{basename,dirname,join}from"node:path";import process from"node:process";import{log,parseOptions,runCommand}from"@stacksjs/cli";import{appPath,projectPath,publicPath,resourcesPath,storagePath}from"@stacksjs/path";import{bundleDirectoryFor,codesignArgs,describeRuntimeDuplication,looksLikeBunExecutable,renderInfoPlist,resolveDmgPackaging}from"@stacksjs/desktop-build";import{runBuildStep}from"./run-build-step";if(process.platform!=="darwin")throw Error("DMG packaging only runs on macOS");const desktopDist=storagePath("framework/desktop-dist"),manifestPath=join(desktopDist,"desktop.json");if(!existsSync(manifestPath)){log.info("No desktop build found. Building it first (`build:desktop`).");await import("./desktop")}if(!existsSync(manifestPath))throw Error(`build:desktop ran but left no manifest at ${manifestPath}`);const manifest=JSON.parse(readFileSync(manifestPath,"utf8")),ownsLauncher=manifest.launcher==="userland";function declaredProjectVersion(){const packageJson=projectPath("package.json");if(!existsSync(packageJson))return;try{return JSON.parse(readFileSync(packageJson,"utf8")).version}catch{return}}const{appName,bundleId,version,volumeName,signingIdentity,
|
|
1
|
+
import{cpSync,existsSync,mkdirSync,mkdtempSync,readdirSync,readFileSync,rmSync,statSync,symlinkSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{basename,dirname,join}from"node:path";import process from"node:process";import{log,parseOptions,runCommand}from"@stacksjs/cli";import{appPath,projectPath,publicPath,resourcesPath,storagePath}from"@stacksjs/path";import{bundleDirectoryFor,codesignArgs,describeRuntimeDuplication,looksLikeBunExecutable,notarytoolAuthArgs,renderInfoPlist,resolveDmgPackaging}from"@stacksjs/desktop-build";import{runBuildStep}from"./run-build-step";if(process.platform!=="darwin")throw Error("DMG packaging only runs on macOS");const desktopDist=storagePath("framework/desktop-dist"),manifestPath=join(desktopDist,"desktop.json");if(!existsSync(manifestPath)){log.info("No desktop build found. Building it first (`build:desktop`).");await import("./desktop")}if(!existsSync(manifestPath))throw Error(`build:desktop ran but left no manifest at ${manifestPath}`);const manifest=JSON.parse(readFileSync(manifestPath,"utf8")),ownsLauncher=manifest.launcher==="userland";function declaredProjectVersion(){const packageJson=projectPath("package.json");if(!existsSync(packageJson))return;try{return JSON.parse(readFileSync(packageJson,"utf8")).version}catch{return}}const{appName,bundleId,version,volumeName,signingIdentity,notary}=resolveDmgPackaging({flags:parseOptions(),env:process.env,manifestTitle:manifest.title,declaredVersion:declaredProjectVersion()}),outputDir=storagePath("framework/desktop-dmg");if(existsSync(outputDir))rmSync(outputDir,{recursive:!0});mkdirSync(outputDir,{recursive:!0});const staging=mkdtempSync(join(tmpdir(),"stacks-dmg-")),scratch=mkdtempSync(join(tmpdir(),"stacks-dmg-work-"));process.on("exit",()=>{rmSync(staging,{recursive:!0,force:!0});rmSync(scratch,{recursive:!0,force:!0})});const appDir=join(staging,`${appName}.app`),macosDir=join(appDir,"Contents/MacOS"),resourcesDir=join(appDir,"Contents/Resources");mkdirSync(macosDir,{recursive:!0});mkdirSync(resourcesDir,{recursive:!0});const builtLauncher="stacks-desktop",launcherName=appName,bundledFiles=readdirSync(desktopDist).filter((name)=>statSync(join(desktopDist,name)).isFile());for(const file of bundledFiles){const target=file===builtLauncher?launcherName:file,directory=bundleDirectoryFor(join(desktopDist,file))==="MacOS"?macosDir:resourcesDir;await runBuildStep(["cp",join(desktopDist,file),join(directory,target)],{cwd:projectPath(),describe:`Copying ${file} into the bundle`})}if(!existsSync(join(macosDir,launcherName)))throw Error(`build:desktop did not produce ${builtLauncher}`);const runtimes=readdirSync(macosDir).filter((name)=>statSync(join(macosDir,name)).isFile()).filter((name)=>looksLikeBunExecutable(join(macosDir,name))).map((name)=>({name,bytes:statSync(join(macosDir,name)).size})),duplication=describeRuntimeDuplication(runtimes);if(duplication)log.warn(duplication);const userlandResources=appPath("Desktop/Resources");if(existsSync(userlandResources))cpSync(userlandResources,resourcesDir,{recursive:!0});async function buildIcon(){const source=[resourcesPath("assets/images/app-icon.png"),publicPath("images/app-icon.png"),publicPath("apple-touch-icon.png")].find((candidate)=>existsSync(candidate));if(!source)return;const iconset=join(scratch,"icon.iconset");mkdirSync(iconset,{recursive:!0});for(const size of[16,32,128,256,512]){await runCommand(["sips","-z",String(size),String(size),source,"--out",join(iconset,`icon_${size}x${size}.png`)],{cwd:scratch,silent:!0});await runCommand(["sips","-z",String(size*2),String(size*2),source,"--out",join(iconset,`icon_${size}x${size}@2x.png`)],{cwd:scratch,silent:!0})}const icns=join(resourcesDir,"AppIcon.icns");if((await runCommand(["iconutil","-c","icns",iconset,"-o",icns],{cwd:scratch})).isErr||!existsSync(icns)){log.warn(`Could not build an .icns from ${source}; the bundle will use the default icon.`);return}return"AppIcon"}const iconFile=await buildIcon();function readUserlandPlist(){const declared=appPath("Desktop/Info.plist.json");if(!existsSync(declared))return{};try{return JSON.parse(readFileSync(declared,"utf8"))}catch(error){throw Error(`app/Desktop/Info.plist.json is not valid JSON: ${error instanceof Error?error.message:error}`)}}const declaredPlist=readUserlandPlist(),{xml:infoPlist,ignored:ignoredPlistKeys}=renderInfoPlist({appName,bundleId,version,executable:launcherName,iconFile,ownsLauncher,declared:declaredPlist});if(ignoredPlistKeys.length>0)log.info(`Ignoring reserved Info.plist keys from app/Desktop/Info.plist.json: ${ignoredPlistKeys.join(", ")}`);const infoPlistPath=join(appDir,"Contents/Info.plist");writeFileSync(infoPlistPath,infoPlist);const linted=Bun.spawnSync(["plutil","-lint",infoPlistPath],{stdout:"pipe",stderr:"pipe"});if(linted.exitCode!==0)throw Error(`Generated an Info.plist that macOS cannot read: ${`${linted.stdout.toString()}${linted.stderr.toString()}`.trim()}`);if(signingIdentity){const nested=readdirSync(macosDir).filter((name)=>name!==launcherName).map((name)=>join(macosDir,name)),declaredEntitlements=appPath("Desktop/Entitlements.plist"),entitlements=existsSync(declaredEntitlements)?declaredEntitlements:void 0;for(const target of[...nested,join(macosDir,launcherName),appDir])await runBuildStep(codesignArgs({identity:signingIdentity,target,entitlements}),{cwd:staging,describe:`Signing ${basename(target)}`})}async function notarize(target,what){if(!signingIdentity)throw Error("Notarizing needs a signing identity (--signing-identity or DESKTOP_SIGNING_IDENTITY): Apple only notarizes signed code.");const upload=target.endsWith(".app")?join(scratch,`${basename(target)}.zip`):target;if(upload!==target)await runBuildStep(["ditto","-c","-k","--keepParent",target,upload],{cwd:scratch,describe:`Zipping ${basename(target)} for notarization`});log.info(`Notarizing ${what} (Apple usually answers within a few minutes)...`);const submitted=Bun.spawnSync(["xcrun","notarytool","submit",upload,...notaryAuth,"--wait"],{stderr:"pipe"}),report=`${submitted.stdout.toString()}${submitted.stderr.toString()}`,status=report.match(/status: (\w[\w ]*)/g)?.pop()?.replace("status: ","");if(submitted.exitCode!==0||status!=="Accepted"){console.error(report.trim());const id=report.match(/id: ([0-9a-f-]{36})/)?.[1];throw Error(`Notarization of ${what} ${status??"failed"}${id?` - see \`xcrun notarytool log ${id} ${notaryAuth.join(" ")}\``:""}`)}await runBuildStep(["xcrun","stapler","staple",target],{cwd:dirname(target),describe:`Stapling the notarization ticket to ${what}`})}const notaryAuth=notary&¬arytoolAuthArgs("keyPem"in notary?{...notary,keyPath:privateKeyFile(notary.keyId,notary.keyPem)}:notary);function privateKeyFile(keyId,pem){const directory=mkdtempSync(join(tmpdir(),"stacks-notary-key-")),path=join(directory,`AuthKey_${keyId}.p8`);writeFileSync(path,`${pem}
|
|
2
|
+
`,{mode:384});process.on("exit",()=>rmSync(directory,{recursive:!0,force:!0}));return path}if(notaryAuth)await notarize(appDir,basename(appDir));symlinkSync("/Applications",join(staging,"Applications"));const dmgPath=join(outputDir,`${appName}-${version}.dmg`);if(volumeName===appName)log.warn(`The volume name is the app's own name, so the bundle stages at /Volumes/${appName}/${appName}.app. That path is refused on a Mac where ${appName} is already installed; drop --volume-name / DESKTOP_VOLUME_NAME to get "${appName} ${version}".`);const created=await runCommand(["hdiutil","create","-volname",volumeName,"-srcfolder",staging,"-ov","-format","UDZO",dmgPath],{cwd:staging});if(created.isErr)throw Error(`hdiutil failed to create ${dmgPath}`);rmSync(staging,{recursive:!0,force:!0});rmSync(scratch,{recursive:!0,force:!0});if(signingIdentity)await runBuildStep(["codesign","--force","--timestamp","--sign",signingIdentity,dmgPath],{cwd:outputDir,describe:"Signing the DMG"});if(notaryAuth){await notarize(dmgPath,"the DMG");log.success("Notarized and stapled")}log.success(`Built ${dmgPath}`);if(!signingIdentity)log.info("Unsigned build: Gatekeeper blocks the first launch. Right-click the app and choose Open, or pass --signing-identity and --notarize before distributing.");else if(!notaryAuth)log.info("Signed but not notarized: other Macs still warn on first open. Pass --notary-profile, or --notarize with an App Store Connect API key.");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.409",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -66,58 +66,58 @@
|
|
|
66
66
|
"prepublishOnly": "bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@stacksjs/action-runner": "0.75.
|
|
70
|
-
"@stacksjs/ai": "0.75.
|
|
71
|
-
"@stacksjs/analytics": "0.75.
|
|
72
|
-
"@stacksjs/api": "0.75.
|
|
73
|
-
"@stacksjs/auth": "0.75.
|
|
74
|
-
"@stacksjs/build": "0.75.
|
|
69
|
+
"@stacksjs/action-runner": "0.75.409",
|
|
70
|
+
"@stacksjs/ai": "0.75.409",
|
|
71
|
+
"@stacksjs/analytics": "0.75.409",
|
|
72
|
+
"@stacksjs/api": "0.75.409",
|
|
73
|
+
"@stacksjs/auth": "0.75.409",
|
|
74
|
+
"@stacksjs/build": "0.75.409",
|
|
75
75
|
"@stacksjs/bumpx": "^0.2.26",
|
|
76
76
|
"@stacksjs/bunpress": "^0.2.15",
|
|
77
|
-
"@stacksjs/cli": "0.75.
|
|
78
|
-
"@stacksjs/cloud": "0.75.
|
|
79
|
-
"@stacksjs/cms": "0.75.
|
|
80
|
-
"@stacksjs/components": "0.2.
|
|
81
|
-
"@stacksjs/config": "0.75.
|
|
82
|
-
"@stacksjs/database": "0.75.
|
|
83
|
-
"@stacksjs/desktop-build": "0.75.
|
|
84
|
-
"@stacksjs/dns": "0.75.
|
|
85
|
-
"@stacksjs/enums": "0.75.
|
|
86
|
-
"@stacksjs/env": "0.75.
|
|
87
|
-
"@stacksjs/error-handling": "0.75.
|
|
88
|
-
"@stacksjs/github": "0.75.
|
|
77
|
+
"@stacksjs/cli": "0.75.409",
|
|
78
|
+
"@stacksjs/cloud": "0.75.409",
|
|
79
|
+
"@stacksjs/cms": "0.75.409",
|
|
80
|
+
"@stacksjs/components": "0.2.780",
|
|
81
|
+
"@stacksjs/config": "0.75.409",
|
|
82
|
+
"@stacksjs/database": "0.75.409",
|
|
83
|
+
"@stacksjs/desktop-build": "0.75.409",
|
|
84
|
+
"@stacksjs/dns": "0.75.409",
|
|
85
|
+
"@stacksjs/enums": "0.75.409",
|
|
86
|
+
"@stacksjs/env": "0.75.409",
|
|
87
|
+
"@stacksjs/error-handling": "0.75.409",
|
|
88
|
+
"@stacksjs/github": "0.75.409",
|
|
89
89
|
"@stacksjs/gitit": "^0.2.5",
|
|
90
|
-
"@stacksjs/i18n": "0.75.
|
|
91
|
-
"@stacksjs/image": "0.75.
|
|
92
|
-
"@stacksjs/logging": "0.75.
|
|
90
|
+
"@stacksjs/i18n": "0.75.409",
|
|
91
|
+
"@stacksjs/image": "0.75.409",
|
|
92
|
+
"@stacksjs/logging": "0.75.409",
|
|
93
93
|
"@stacksjs/logsmith": "^0.2.11",
|
|
94
|
-
"@stacksjs/mobile": "0.75.
|
|
95
|
-
"@stacksjs/orm": "0.75.
|
|
96
|
-
"@stacksjs/path": "0.75.
|
|
97
|
-
"@stacksjs/payments": "0.75.
|
|
98
|
-
"@stacksjs/queue": "0.75.
|
|
99
|
-
"@stacksjs/registry": "0.75.
|
|
100
|
-
"@stacksjs/router": "0.75.
|
|
94
|
+
"@stacksjs/mobile": "0.75.409",
|
|
95
|
+
"@stacksjs/orm": "0.75.409",
|
|
96
|
+
"@stacksjs/path": "0.75.409",
|
|
97
|
+
"@stacksjs/payments": "0.75.409",
|
|
98
|
+
"@stacksjs/queue": "0.75.409",
|
|
99
|
+
"@stacksjs/registry": "0.75.409",
|
|
100
|
+
"@stacksjs/router": "0.75.409",
|
|
101
101
|
"@stacksjs/rpx": "^0.11.54",
|
|
102
|
-
"@stacksjs/scheduler": "0.75.
|
|
103
|
-
"@stacksjs/search-engine": "0.75.
|
|
104
|
-
"@stacksjs/security": "0.75.
|
|
105
|
-
"@stacksjs/server": "0.75.
|
|
106
|
-
"@stacksjs/sites": "0.75.
|
|
107
|
-
"@stacksjs/storage": "0.75.
|
|
108
|
-
"@stacksjs/strings": "0.75.
|
|
109
|
-
"@stacksjs/stx": "0.2.
|
|
102
|
+
"@stacksjs/scheduler": "0.75.409",
|
|
103
|
+
"@stacksjs/search-engine": "0.75.409",
|
|
104
|
+
"@stacksjs/security": "0.75.409",
|
|
105
|
+
"@stacksjs/server": "0.75.409",
|
|
106
|
+
"@stacksjs/sites": "0.75.409",
|
|
107
|
+
"@stacksjs/storage": "0.75.409",
|
|
108
|
+
"@stacksjs/strings": "0.75.409",
|
|
109
|
+
"@stacksjs/stx": "0.2.780",
|
|
110
110
|
"@stacksjs/tlsx": "^0.13.19",
|
|
111
111
|
"@stacksjs/ts-cloud": "^0.16.91",
|
|
112
112
|
"@stacksjs/ts-md": "^0.1.1",
|
|
113
|
-
"@stacksjs/tunnel": "0.75.
|
|
114
|
-
"@stacksjs/types": "0.75.
|
|
115
|
-
"@stacksjs/utils": "0.75.
|
|
116
|
-
"@stacksjs/whois": "0.75.
|
|
117
|
-
"bun-plugin-stx": "0.2.
|
|
113
|
+
"@stacksjs/tunnel": "0.75.409",
|
|
114
|
+
"@stacksjs/types": "0.75.409",
|
|
115
|
+
"@stacksjs/utils": "0.75.409",
|
|
116
|
+
"@stacksjs/whois": "0.75.409",
|
|
117
|
+
"bun-plugin-stx": "0.2.780"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
|
-
"craft-native": ">=0.0.
|
|
120
|
+
"craft-native": ">=0.0.420",
|
|
121
121
|
"pickier": "^0.1.75"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@stacksjs/validation": "0.75.
|
|
132
|
+
"@stacksjs/validation": "0.75.409",
|
|
133
133
|
"better-dx": "^0.2.24"
|
|
134
134
|
}
|
|
135
135
|
}
|