@stacksjs/actions 0.75.74 → 0.75.76

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.
@@ -1,2 +1,2 @@
1
- import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{toCraftAndroidConfig,validateAndroidMobileConfig}from"./android-config";import{resolveMobilePath}from"./ios-config";process.exitCode=1;async function loadCraftAndroidBuilder(){const explicit=process.env.CRAFT_ANDROID_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import("craft-native/android")}catch(error){throw Error("Craft Android builder is unavailable. Install the current craft-native package or set CRAFT_ANDROID_SRC to packages/android/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an android section before running `buddy build:android`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),config=configModule.default.android;if(!config)throw Error("config/mobile.ts must define an android section");validateAndroidMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/android"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftAndroidConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);craftConfig.googleServicesFile=resolveMobilePath(projectPath(),config.googleServicesFile);if(process.env.NODE_ENV==="production"&&config.capabilities?.pushNotifications&&!craftConfig.googleServicesFile)throw Error("Production Android push notifications require android.googleServicesFile in config/mobile.ts");const builder=await loadCraftAndroidBuilder();await builder.init({name:config.appName,packageName:config.packageName,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,release:process.env.NODE_ENV==="production",compile:process.env.STACKS_ANDROID_SKIP_GRADLE!=="1"});const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),generatedConfig=JSON.parse(readFileSync(`${output}/craft.config.json`,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"android",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_ANDROID_SRC),craft:generatedConfig},null,2)}
1
+ import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{craftBuilderSpecifier}from"./craft-entry";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{toCraftAndroidConfig,validateAndroidMobileConfig}from"./android-config";import{resolveMobilePath}from"./ios-config";process.exitCode=1;async function loadCraftAndroidBuilder(){const explicit=process.env.CRAFT_ANDROID_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import(craftBuilderSpecifier("android",projectPath()))}catch(error){throw Error("Craft Android builder is unavailable. Install the current craft-native package or set CRAFT_ANDROID_SRC to packages/android/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an android section before running `buddy build:android`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),config=configModule.default.android;if(!config)throw Error("config/mobile.ts must define an android section");validateAndroidMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/android"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftAndroidConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);craftConfig.googleServicesFile=resolveMobilePath(projectPath(),config.googleServicesFile);if(process.env.NODE_ENV==="production"&&config.capabilities?.pushNotifications&&!craftConfig.googleServicesFile)throw Error("Production Android push notifications require android.googleServicesFile in config/mobile.ts");const builder=await loadCraftAndroidBuilder();await builder.init({name:config.appName,packageName:config.packageName,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,release:process.env.NODE_ENV==="production",compile:process.env.STACKS_ANDROID_SKIP_GRADLE!=="1"});const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),generatedConfig=JSON.parse(readFileSync(`${output}/craft.config.json`,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"android",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_ANDROID_SRC),craft:generatedConfig},null,2)}
2
2
  `);log.success(`Built the Craft Android project in ${output}`);await log.flush();process.exitCode=0;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Where a Craft builder (`craft-native/ios`, `craft-native/android`) is
3
+ * imported from: the copy @stacksjs/mobile resolves, not the one at the
4
+ * project root.
5
+ *
6
+ * The pages call the native bridge through @stacksjs/mobile, so the app has to
7
+ * be generated by the Craft that package was built against. A bare
8
+ * `import('craft-native/ios')` from here resolved whichever copy the package
9
+ * manager had hoisted to the root, and when two framework packages asked for
10
+ * different minimum versions the root kept the older one: the app was built
11
+ * from an old template that lacked bridge actions the pages then called. Apps
12
+ * pinned craft-native with package.json overrides to get past it.
13
+ *
14
+ * Falls back to the bare specifier when @stacksjs/mobile is not installed.
15
+ */
16
+ export declare function craftBuilderSpecifier(builder: 'ios' | 'android', root: string): string;
@@ -0,0 +1 @@
1
+ import{dirname}from"node:path";import{pathToFileURL}from"node:url";export function craftBuilderSpecifier(builder,root){try{const mobile=Bun.resolveSync("@stacksjs/mobile/package.json",root);return pathToFileURL(Bun.resolveSync(`craft-native/${builder}`,dirname(mobile))).href}catch{return`craft-native/${builder}`}}
package/dist/build/ios.js CHANGED
@@ -1,2 +1,2 @@
1
- import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{resolveMobilePath,toCraftIosConfig,validateIosMobileConfig,writeIosActivityTypes}from"./ios-config";process.exitCode=1;async function loadCraftIosBuilder(){const explicit=process.env.CRAFT_IOS_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import("craft-native/ios")}catch(error){throw Error("Craft iOS builder is unavailable. Install the current craft-native package or set CRAFT_IOS_SRC to packages/ios/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an ios section before running `buddy build:ios`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),mobile=configModule.default,config=mobile.ios;validateIosMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/ios"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftIosConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);const builder=await loadCraftIosBuilder();await builder.init({name:config.appName,bundleId:config.bundleId,teamId:config.teamId,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,generateProject:process.env.STACKS_IOS_SKIP_XCODEGEN!=="1"});const activityTypes=writeIosActivityTypes(output,mobile);if(activityTypes)log.info(`Declared ${activityTypes.length} activity types, so a tapped Spotlight or Siri entry reaches the app`);const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),craftConfigPath=`${output}/craft.config.json`,generatedConfig=JSON.parse(readFileSync(craftConfigPath,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"ios",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_IOS_SRC),craft:generatedConfig},null,2)}
1
+ import{existsSync,readFileSync,writeFileSync}from"node:fs";import{pathToFileURL}from"node:url";import process from"node:process";import{log}from"@stacksjs/cli";import{projectPath,storagePath}from"@stacksjs/path";import{craftBuilderSpecifier}from"./craft-entry";import{resolveCraftBuilderProvenance}from"./craft-provenance";import{resolveMobilePath,toCraftIosConfig,validateIosMobileConfig,writeIosActivityTypes}from"./ios-config";process.exitCode=1;async function loadCraftIosBuilder(){const explicit=process.env.CRAFT_IOS_SRC;try{if(explicit)return await import(pathToFileURL(explicit).href);return await import(craftBuilderSpecifier("ios",projectPath()))}catch(error){throw Error("Craft iOS builder is unavailable. Install the current craft-native package or set CRAFT_IOS_SRC to packages/ios/src/index.ts in a Craft checkout.",{cause:error})}}const configPath=projectPath("config/mobile.ts");if(!existsSync(configPath))throw Error("Missing config/mobile.ts. Add an ios section before running `buddy build:ios`.");const configModule=await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`),mobile=configModule.default,config=mobile.ios;validateIosMobileConfig(config);const output=resolveMobilePath(projectPath(),config.output)??storagePath("framework/mobile/ios"),webAssets=resolveMobilePath(projectPath(),config.webAssets),fallbackWebAssets=resolveMobilePath(projectPath(),config.fallbackWebAssets),craftConfig=toCraftIosConfig(config);craftConfig.appIconPath=resolveMobilePath(projectPath(),config.appIcon);const builder=await loadCraftIosBuilder();await builder.init({name:config.appName,bundleId:config.bundleId,teamId:config.teamId,output,config:craftConfig});await builder.build({output,htmlPath:webAssets??fallbackWebAssets,devServer:craftConfig.devServerURL,generateProject:process.env.STACKS_IOS_SKIP_XCODEGEN!=="1"});const activityTypes=writeIosActivityTypes(output,mobile);if(activityTypes)log.info(`Declared ${activityTypes.length} activity types, so a tapped Spotlight or Siri entry reaches the app`);const sourceRevision=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()}).stdout.toString().trim(),craftConfigPath=`${output}/craft.config.json`,generatedConfig=JSON.parse(readFileSync(craftConfigPath,"utf8"));writeFileSync(`${output}/stacks-mobile.json`,`${JSON.stringify({schemaVersion:"1.0.0",platform:"ios",sourceRevision,source:webAssets?{kind:"bundled",path:webAssets}:{kind:"remote",url:craftConfig.devServerURL,fallback:fallbackWebAssets?{kind:"bundled",path:fallbackWebAssets}:void 0},capabilities:config.capabilities??{},builder:resolveCraftBuilderProvenance(process.env.CRAFT_IOS_SRC),craft:generatedConfig},null,2)}
2
2
  `);log.success(`Built the Craft iOS project in ${output}`);await log.flush();process.exitCode=0;
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.74",
5
+ "version": "0.75.76",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -66,57 +66,57 @@
66
66
  "prepublishOnly": "bun run build"
67
67
  },
68
68
  "dependencies": {
69
- "@stacksjs/action-runner": "0.75.74",
70
- "@stacksjs/ai": "0.75.74",
71
- "@stacksjs/analytics": "0.75.74",
72
- "@stacksjs/api": "0.75.74",
73
- "@stacksjs/auth": "0.75.74",
74
- "@stacksjs/build": "0.75.74",
69
+ "@stacksjs/action-runner": "0.75.76",
70
+ "@stacksjs/ai": "0.75.76",
71
+ "@stacksjs/analytics": "0.75.76",
72
+ "@stacksjs/api": "0.75.76",
73
+ "@stacksjs/auth": "0.75.76",
74
+ "@stacksjs/build": "0.75.76",
75
75
  "@stacksjs/bumpx": "^0.2.18",
76
- "@stacksjs/bunpress": "^0.2.14",
77
- "@stacksjs/cli": "0.75.74",
78
- "@stacksjs/cloud": "0.75.74",
79
- "@stacksjs/cms": "0.75.74",
80
- "@stacksjs/components": "^0.2.374",
81
- "@stacksjs/config": "0.75.74",
82
- "@stacksjs/database": "0.75.74",
83
- "@stacksjs/desktop-build": "0.75.74",
84
- "@stacksjs/dns": "0.75.74",
85
- "@stacksjs/enums": "0.75.74",
86
- "@stacksjs/env": "0.75.74",
87
- "@stacksjs/error-handling": "0.75.74",
76
+ "@stacksjs/bunpress": "^0.2.15",
77
+ "@stacksjs/cli": "0.75.76",
78
+ "@stacksjs/cloud": "0.75.76",
79
+ "@stacksjs/cms": "0.75.76",
80
+ "@stacksjs/components": "^0.2.378",
81
+ "@stacksjs/config": "0.75.76",
82
+ "@stacksjs/database": "0.75.76",
83
+ "@stacksjs/desktop-build": "0.75.76",
84
+ "@stacksjs/dns": "0.75.76",
85
+ "@stacksjs/enums": "0.75.76",
86
+ "@stacksjs/env": "0.75.76",
87
+ "@stacksjs/error-handling": "0.75.76",
88
88
  "@stacksjs/gitit": "^0.2.5",
89
- "@stacksjs/i18n": "0.75.74",
90
- "@stacksjs/image": "0.75.74",
91
- "@stacksjs/logging": "0.75.74",
89
+ "@stacksjs/i18n": "0.75.76",
90
+ "@stacksjs/image": "0.75.76",
91
+ "@stacksjs/logging": "0.75.76",
92
92
  "@stacksjs/logsmith": "^0.2.11",
93
- "@stacksjs/mobile": "0.75.74",
94
- "@stacksjs/orm": "0.75.74",
95
- "@stacksjs/path": "0.75.74",
96
- "@stacksjs/payments": "0.75.74",
97
- "@stacksjs/queue": "0.75.74",
98
- "@stacksjs/registry": "0.75.74",
99
- "@stacksjs/router": "0.75.74",
93
+ "@stacksjs/mobile": "0.75.76",
94
+ "@stacksjs/orm": "0.75.76",
95
+ "@stacksjs/path": "0.75.76",
96
+ "@stacksjs/payments": "0.75.76",
97
+ "@stacksjs/queue": "0.75.76",
98
+ "@stacksjs/registry": "0.75.76",
99
+ "@stacksjs/router": "0.75.76",
100
100
  "@stacksjs/rpx": "^0.11.54",
101
- "@stacksjs/scheduler": "0.75.74",
102
- "@stacksjs/search-engine": "0.75.74",
103
- "@stacksjs/security": "0.75.74",
104
- "@stacksjs/server": "0.75.74",
105
- "@stacksjs/sites": "0.75.74",
106
- "@stacksjs/storage": "0.75.74",
107
- "@stacksjs/strings": "0.75.74",
108
- "@stacksjs/stx": "^0.2.374",
101
+ "@stacksjs/scheduler": "0.75.76",
102
+ "@stacksjs/search-engine": "0.75.76",
103
+ "@stacksjs/security": "0.75.76",
104
+ "@stacksjs/server": "0.75.76",
105
+ "@stacksjs/sites": "0.75.76",
106
+ "@stacksjs/storage": "0.75.76",
107
+ "@stacksjs/strings": "0.75.76",
108
+ "@stacksjs/stx": "^0.2.378",
109
109
  "@stacksjs/tlsx": "^0.13.19",
110
110
  "@stacksjs/ts-cloud": "^0.16.39",
111
111
  "@stacksjs/ts-md": "^0.1.1",
112
- "@stacksjs/tunnel": "0.75.74",
113
- "@stacksjs/types": "0.75.74",
114
- "@stacksjs/utils": "0.75.74",
115
- "@stacksjs/whois": "0.75.74",
116
- "bun-plugin-stx": "^0.2.374"
112
+ "@stacksjs/tunnel": "0.75.76",
113
+ "@stacksjs/types": "0.75.76",
114
+ "@stacksjs/utils": "0.75.76",
115
+ "@stacksjs/whois": "0.75.76",
116
+ "bun-plugin-stx": "^0.2.378"
117
117
  },
118
118
  "peerDependencies": {
119
- "craft-native": ">=0.0.111",
119
+ "craft-native": ">=0.0.118",
120
120
  "pickier": "^0.1.68"
121
121
  },
122
122
  "peerDependenciesMeta": {
@@ -128,7 +128,7 @@
128
128
  }
129
129
  },
130
130
  "devDependencies": {
131
- "@stacksjs/validation": "0.75.74",
131
+ "@stacksjs/validation": "0.75.76",
132
132
  "better-dx": "^0.2.24"
133
133
  }
134
134
  }