@stacksjs/actions 0.72.100 → 0.72.101

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/dist/build/dmg.js +5 -5
  2. package/package.json +21 -21
package/dist/build/dmg.js CHANGED
@@ -1,4 +1,4 @@
1
- import{cpSync,existsSync,mkdirSync,mkdtempSync,readdirSync,readFileSync,rmSync,statSync,symlinkSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";import process from"node:process";import{log,runCommand}from"@stacksjs/cli";import{appPath,projectPath,publicPath,resourcesPath,storagePath}from"@stacksjs/path";import{renderUserlandPlistEntries}from"@stacksjs/desktop-build";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))throw Error("Run `buddy build:desktop` before packaging a DMG");const manifest=JSON.parse(readFileSync(manifestPath,"utf8")),ownsLauncher=manifest.launcher==="userland",appName=process.env.DESKTOP_APP_NAME||manifest.title||process.env.APP_NAME||"Stacks",bundleId=process.env.DESKTOP_BUNDLE_ID||`sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,version=process.env.DESKTOP_APP_VERSION||"0.0.0",signingIdentity=process.env.DESKTOP_SIGNING_IDENTITY,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-")),appDir=join(staging,`${appName}.app`),macosDir=join(appDir,"Contents/MacOS"),resourcesDir=join(appDir,"Contents/Resources");mkdirSync(macosDir,{recursive:!0});mkdirSync(resourcesDir,{recursive:!0});const launcherName="stacks-desktop",bundledFiles=readdirSync(desktopDist).filter((name)=>statSync(join(desktopDist,name)).isFile());for(const file of bundledFiles)await runCommand(["cp",join(desktopDist,file),join(macosDir,file)],{cwd:projectPath()});if(!existsSync(join(macosDir,launcherName)))throw Error(`build:desktop did not produce ${launcherName}`);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))return;return"AppIcon"}const iconFile=await buildIcon();function userlandPlistEntries(){const declared=appPath("Desktop/Info.plist.json");if(!existsSync(declared))return"";let parsed;try{parsed=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{xml,ignored}=renderUserlandPlistEntries(parsed);if(ignored.length>0)log.info(`Ignoring reserved Info.plist keys from app/Desktop/Info.plist.json: ${ignored.join(", ")}`);return xml}const extraPlistEntries=userlandPlistEntries();writeFileSync(join(appDir,"Contents/Info.plist"),`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{cpSync,existsSync,mkdirSync,mkdtempSync,readdirSync,readFileSync,rmSync,statSync,symlinkSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";import process from"node:process";import{log,runCommand}from"@stacksjs/cli";import{appPath,projectPath,publicPath,resourcesPath,storagePath}from"@stacksjs/path";import{renderUserlandPlistEntries}from"@stacksjs/desktop-build";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))throw Error("Run `buddy build:desktop` before packaging a DMG");const manifest=JSON.parse(readFileSync(manifestPath,"utf8")),ownsLauncher=manifest.launcher==="userland",appName=process.env.DESKTOP_APP_NAME||manifest.title||process.env.APP_NAME||"Stacks",bundleId=process.env.DESKTOP_BUNDLE_ID||`sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,version=process.env.DESKTOP_APP_VERSION||"0.0.0",signingIdentity=process.env.DESKTOP_SIGNING_IDENTITY,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-")),appDir=join(staging,`${appName}.app`),macosDir=join(appDir,"Contents/MacOS"),resourcesDir=join(appDir,"Contents/Resources");mkdirSync(macosDir,{recursive:!0});mkdirSync(resourcesDir,{recursive:!0});const launcherName="stacks-desktop",bundledFiles=readdirSync(desktopDist).filter((name)=>statSync(join(desktopDist,name)).isFile());for(const file of bundledFiles)await runCommand(["cp",join(desktopDist,file),join(macosDir,file)],{cwd:projectPath()});if(!existsSync(join(macosDir,launcherName)))throw Error(`build:desktop did not produce ${launcherName}`);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))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:extraPlistEntries,ignored:ignoredPlistKeys}=renderUserlandPlistEntries(declaredPlist);if(ignoredPlistKeys.length>0)log.info(`Ignoring reserved Info.plist keys from app/Desktop/Info.plist.json: ${ignoredPlistKeys.join(", ")}`);function overriddenByApp(key){return Object.hasOwn(declaredPlist,key)}writeFileSync(join(appDir,"Contents/Info.plist"),`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
@@ -10,9 +10,9 @@ import{cpSync,existsSync,mkdirSync,mkdtempSync,readdirSync,readFileSync,rmSync,s
10
10
  <key>CFBundleExecutable</key><string>${launcherName}</string>
11
11
  <key>CFBundlePackageType</key><string>APPL</string>
12
12
  <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
13
- <key>LSMinimumSystemVersion</key><string>11.0</string>
14
- <key>NSHighResolutionCapable</key><true/>
15
- ${ownsLauncher?` <!-- The window talks to something this app started on loopback, so an
13
+ ${overriddenByApp("LSMinimumSystemVersion")?"":` <key>LSMinimumSystemVersion</key><string>11.0</string>
14
+ `}${overriddenByApp("NSHighResolutionCapable")?"":` <key>NSHighResolutionCapable</key><true/>
15
+ `}${overriddenByApp("NSAppTransportSecurity")?"":`${ownsLauncher?` <!-- The window talks to something this app started on loopback, so an
16
16
  exception for 127.0.0.1 is all it needs. NSAllowsArbitraryLoads would
17
17
  additionally permit every unencrypted host on the internet. -->
18
18
  <key>NSAppTransportSecurity</key>
@@ -24,7 +24,7 @@ ${ownsLauncher?` <!-- The window talks to something this app started on loopbac
24
24
  <dict><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>
25
25
  </dict>
26
26
  </dict>`:` <!-- The window loads a remote URL, so the app has to be allowed to reach it. -->
27
- <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>`}${iconFile?`
27
+ <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>`}`}${iconFile?`
28
28
  <key>CFBundleIconFile</key><string>${iconFile}</string>`:""}${extraPlistEntries}
29
29
  </dict>
30
30
  </plist>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.72.100",
5
+ "version": "0.72.101",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -60,36 +60,36 @@
60
60
  "prepublishOnly": "bun run build"
61
61
  },
62
62
  "dependencies": {
63
- "@stacksjs/config": "0.72.100",
63
+ "@stacksjs/config": "0.72.101",
64
64
  "@stacksjs/bumpx": "^0.2.6",
65
65
  "@stacksjs/bunpress": "^0.2.8",
66
66
  "@stacksjs/logsmith": "^0.2.3",
67
- "@stacksjs/registry": "0.72.100",
67
+ "@stacksjs/registry": "0.72.101",
68
68
  "@stacksjs/stx": "^0.2.245",
69
69
  "@stacksjs/ts-cloud": "^0.12.7",
70
70
  "@stacksjs/ts-md": "^0.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@stacksjs/api": "0.72.100",
74
- "@stacksjs/cli": "0.72.100",
75
- "@stacksjs/database": "0.72.100",
73
+ "@stacksjs/api": "0.72.101",
74
+ "@stacksjs/cli": "0.72.101",
75
+ "@stacksjs/database": "0.72.101",
76
76
  "@stacksjs/tlsx": "^0.13.2",
77
77
  "better-dx": "^0.2.24",
78
- "@stacksjs/dns": "0.72.100",
79
- "@stacksjs/enums": "0.72.100",
80
- "@stacksjs/env": "0.72.100",
81
- "@stacksjs/error-handling": "0.72.100",
82
- "@stacksjs/image": "0.72.100",
83
- "@stacksjs/logging": "0.72.100",
84
- "@stacksjs/path": "0.72.100",
85
- "@stacksjs/security": "0.72.100",
86
- "@stacksjs/server": "0.72.100",
87
- "@stacksjs/cms": "0.72.100",
88
- "@stacksjs/sites": "0.72.100",
89
- "@stacksjs/storage": "0.72.100",
90
- "@stacksjs/strings": "0.72.100",
91
- "@stacksjs/utils": "0.72.100",
92
- "@stacksjs/validation": "0.72.100"
78
+ "@stacksjs/dns": "0.72.101",
79
+ "@stacksjs/enums": "0.72.101",
80
+ "@stacksjs/env": "0.72.101",
81
+ "@stacksjs/error-handling": "0.72.101",
82
+ "@stacksjs/image": "0.72.101",
83
+ "@stacksjs/logging": "0.72.101",
84
+ "@stacksjs/path": "0.72.101",
85
+ "@stacksjs/security": "0.72.101",
86
+ "@stacksjs/server": "0.72.101",
87
+ "@stacksjs/cms": "0.72.101",
88
+ "@stacksjs/sites": "0.72.101",
89
+ "@stacksjs/storage": "0.72.101",
90
+ "@stacksjs/strings": "0.72.101",
91
+ "@stacksjs/utils": "0.72.101",
92
+ "@stacksjs/validation": "0.72.101"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "pickier": "^0.1.58",