@stacksjs/buddy 0.75.324 → 0.75.326

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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Generated from canonical defaults by scripts/native-templates.ts.
3
+ * @defaultValue
4
+ * ```ts
5
+ * {
6
+ * ".github/workflows/buddy-bot.yml": "# The one dependency bot a generated app gets.\n#\n# The template used to ship a `renovate.json` instead, which opted every new app\n# into a bot the framework's own policy does not use (AGENTS.md: \"buddy-bot\n# handles dependency updates, not renovatebot\"). Running both is what\n# stacksjs/stacks#2574 is about: the same bump arrives twice, two dashboards\n# disagree, and a human picks a winner with nothing recording why.\n#\n# This is the app-shaped version of the framework's own buddy-bot workflow -\n# the three scheduled jobs and the manual trigger, without the framework's\n# release plumbing. Configure it in `config/buddy-bot.ts`.\nname: Buddy Bot\n\non:\n schedule:\n # Look for updates every two hours, then refresh the dashboard 15 minutes\n # later so it reflects the pull requests that run just opened.\n - cron: '0 *\/2 * * *'\n - cron: '15 *\/2 * * *'\n # Daily: close pull requests whose update already landed, and clean up the\n # branches left behind.\n - cron: '0 4 * * *'\n\n workflow_dispatch:\n inputs:\n job:\n description: Which job to run\n required: false\n default: all\n type: choice\n options:\n - all\n - check\n - update\n - dashboard\n strategy:\n description: Update strategy\n required: false\n default: patch\n type: choice\n options:\n - all\n - major\n - minor\n - patch\n dry_run:\n description: Dry run (preview only)\n required: false\n default: false\n type: boolean\n\nenv:\n # The built-in token is enough for commits, pull requests and issues.\n # BUDDY_BOT_TOKEN (a PAT with `repo` and `workflow` scope) is only needed if\n # you want buddy-bot to update workflow files themselves.\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n BUDDY_BOT_TOKEN: ${{ secrets.BUDDY_BOT_TOKEN }}\n\npermissions:\n contents: write\n pull-requests: write\n issues: write\n\n# Serialize runs so a scheduled tick and a manual one cannot race on the same\n# branches. `cancel-in-progress: false` lets the running job finish rather than\n# being killed part-way through a commit.\nconcurrency:\n group: buddy-bot-${{ github.ref }}\n cancel-in-progress: false\n\njobs:\n buddy-bot:\n runs-on: ubuntu-latest\n timeout-minutes: 30\n\n steps:\n - name: Checkout Code\n uses: actions/checkout@v4\n with:\n token: ${{ secrets.GITHUB_TOKEN }}\n # Rebasing an open branch needs the history it was cut from.\n fetch-depth: 0\n persist-credentials: true\n\n - name: Setup Pantry\n uses: pantry-pm/pantry/packages/action@cdb82193cb344c2b881a88ea79f88243f5522e0f # v0.11.75\n with:\n version: '0.11.75'\n install: 'false'\n\n - name: Install Dependencies\n run: bun install\n\n - name: Configure Git\n run: |\n git config --global user.name \"github-actions[bot]\"\n git config --global user.email \"github-actions[bot]@users.noreply.github.com\"\n\n - name: Open and refresh update pull requests\n if: ${{ github.event.schedule == '0 *\/2 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('[\"all\", \"update\"]'), inputs.job)) }}\n run: bunx @buddysh/buddy update --strategy \"${{ inputs.strategy || 'patch' }}\" ${{ inputs.dry_run && '--dry-run' || '' }}\n\n - name: Update the dependency dashboard\n if: ${{ github.event.schedule == '15 *\/2 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('[\"all\", \"dashboard\"]'), inputs.job)) }}\n run: bunx @buddysh/buddy dashboard ${{ inputs.dry_run && '--dry-run' || '' }}\n\n - name: Close landed pull requests and clean up branches\n if: ${{ github.event.schedule == '0 4 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('[\"all\", \"check\"]'), inputs.job)) }}\n run: bunx @buddysh/buddy update-check ${{ inputs.dry_run && '--dry-run' || '' }}\n",
7
+ * "config/buddy-bot.ts": "import type { BuddyConfig } from '@buddysh/buddy'\n\n/**\n * buddy-bot is the one dependency bot a Stacks app runs.\n *\n * `.github/workflows/buddy-bot.yml` is what drives it: updates every two\n * hours, a dashboard issue 15 minutes later, and a daily pass that closes pull\n * requests whose bump already landed. Nothing else should be opening\n * dependency pull requests here - two bots proposing the same bump is\n * stacksjs/stacks#2574, and it costs a full CI matrix per duplicate.\n *\/\nexport default {\n repository: {\n provider: 'github',\n // In Actions this is already the account or organization the repository\n // lives under, which is the only place the workflow above runs. Replace the\n // fallback if you also run buddy-bot locally.\n owner: process.env.GITHUB_REPOSITORY_OWNER || 'your-github-owner',\n name: '__APP_SLUG__',\n // token: process.env.BUDDY_BOT_TOKEN,\n },\n\n dashboard: {\n enabled: true,\n title: 'Dependency Dashboard',\n },\n\n workflows: {\n enabled: true,\n outputDir: '.github/workflows',\n templates: {\n daily: true,\n weekly: true,\n monthly: true,\n },\n custom: [],\n },\n\n packages: {\n strategy: 'all',\n ignore: [\n // Packages to hold back, e.g. '@types/node'\n ],\n ignorePaths: [\n // Glob patterns to skip, e.g. 'apps/legacy/**'\n ],\n },\n\n verbose: false,\n} satisfies BuddyConfig\n"
8
+ * }
9
+ * ```
10
+ */
11
+ export declare const nativeProjectTemplates: Record<string, string>;
@@ -0,0 +1,160 @@
1
+ export const nativeProjectTemplates={".github/workflows/buddy-bot.yml":`# The one dependency bot a generated app gets.
2
+ #
3
+ # The template used to ship a \`renovate.json\` instead, which opted every new app
4
+ # into a bot the framework's own policy does not use (AGENTS.md: "buddy-bot
5
+ # handles dependency updates, not renovatebot"). Running both is what
6
+ # stacksjs/stacks#2574 is about: the same bump arrives twice, two dashboards
7
+ # disagree, and a human picks a winner with nothing recording why.
8
+ #
9
+ # This is the app-shaped version of the framework's own buddy-bot workflow -
10
+ # the three scheduled jobs and the manual trigger, without the framework's
11
+ # release plumbing. Configure it in \`config/buddy-bot.ts\`.
12
+ name: Buddy Bot
13
+
14
+ on:
15
+ schedule:
16
+ # Look for updates every two hours, then refresh the dashboard 15 minutes
17
+ # later so it reflects the pull requests that run just opened.
18
+ - cron: '0 */2 * * *'
19
+ - cron: '15 */2 * * *'
20
+ # Daily: close pull requests whose update already landed, and clean up the
21
+ # branches left behind.
22
+ - cron: '0 4 * * *'
23
+
24
+ workflow_dispatch:
25
+ inputs:
26
+ job:
27
+ description: Which job to run
28
+ required: false
29
+ default: all
30
+ type: choice
31
+ options:
32
+ - all
33
+ - check
34
+ - update
35
+ - dashboard
36
+ strategy:
37
+ description: Update strategy
38
+ required: false
39
+ default: patch
40
+ type: choice
41
+ options:
42
+ - all
43
+ - major
44
+ - minor
45
+ - patch
46
+ dry_run:
47
+ description: Dry run (preview only)
48
+ required: false
49
+ default: false
50
+ type: boolean
51
+
52
+ env:
53
+ # The built-in token is enough for commits, pull requests and issues.
54
+ # BUDDY_BOT_TOKEN (a PAT with \`repo\` and \`workflow\` scope) is only needed if
55
+ # you want buddy-bot to update workflow files themselves.
56
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
57
+ BUDDY_BOT_TOKEN: \${{ secrets.BUDDY_BOT_TOKEN }}
58
+
59
+ permissions:
60
+ contents: write
61
+ pull-requests: write
62
+ issues: write
63
+
64
+ # Serialize runs so a scheduled tick and a manual one cannot race on the same
65
+ # branches. \`cancel-in-progress: false\` lets the running job finish rather than
66
+ # being killed part-way through a commit.
67
+ concurrency:
68
+ group: buddy-bot-\${{ github.ref }}
69
+ cancel-in-progress: false
70
+
71
+ jobs:
72
+ buddy-bot:
73
+ runs-on: ubuntu-latest
74
+ timeout-minutes: 30
75
+
76
+ steps:
77
+ - name: Checkout Code
78
+ uses: actions/checkout@v4
79
+ with:
80
+ token: \${{ secrets.GITHUB_TOKEN }}
81
+ # Rebasing an open branch needs the history it was cut from.
82
+ fetch-depth: 0
83
+ persist-credentials: true
84
+
85
+ - name: Setup Pantry
86
+ uses: pantry-pm/pantry/packages/action@cdb82193cb344c2b881a88ea79f88243f5522e0f # v0.11.75
87
+ with:
88
+ version: '0.11.75'
89
+ install: 'false'
90
+
91
+ - name: Install Dependencies
92
+ run: bun install
93
+
94
+ - name: Configure Git
95
+ run: |
96
+ git config --global user.name "github-actions[bot]"
97
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
98
+
99
+ - name: Open and refresh update pull requests
100
+ if: \${{ github.event.schedule == '0 */2 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('["all", "update"]'), inputs.job)) }}
101
+ run: bunx @buddysh/buddy update --strategy "\${{ inputs.strategy || 'patch' }}" \${{ inputs.dry_run && '--dry-run' || '' }}
102
+
103
+ - name: Update the dependency dashboard
104
+ if: \${{ github.event.schedule == '15 */2 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('["all", "dashboard"]'), inputs.job)) }}
105
+ run: bunx @buddysh/buddy dashboard \${{ inputs.dry_run && '--dry-run' || '' }}
106
+
107
+ - name: Close landed pull requests and clean up branches
108
+ if: \${{ github.event.schedule == '0 4 * * *' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('["all", "check"]'), inputs.job)) }}
109
+ run: bunx @buddysh/buddy update-check \${{ inputs.dry_run && '--dry-run' || '' }}
110
+ `,"config/buddy-bot.ts":`import type { BuddyConfig } from '@buddysh/buddy'
111
+
112
+ /**
113
+ * buddy-bot is the one dependency bot a Stacks app runs.
114
+ *
115
+ * \`.github/workflows/buddy-bot.yml\` is what drives it: updates every two
116
+ * hours, a dashboard issue 15 minutes later, and a daily pass that closes pull
117
+ * requests whose bump already landed. Nothing else should be opening
118
+ * dependency pull requests here - two bots proposing the same bump is
119
+ * stacksjs/stacks#2574, and it costs a full CI matrix per duplicate.
120
+ */
121
+ export default {
122
+ repository: {
123
+ provider: 'github',
124
+ // In Actions this is already the account or organization the repository
125
+ // lives under, which is the only place the workflow above runs. Replace the
126
+ // fallback if you also run buddy-bot locally.
127
+ owner: process.env.GITHUB_REPOSITORY_OWNER || 'your-github-owner',
128
+ name: '__APP_SLUG__',
129
+ // token: process.env.BUDDY_BOT_TOKEN,
130
+ },
131
+
132
+ dashboard: {
133
+ enabled: true,
134
+ title: 'Dependency Dashboard',
135
+ },
136
+
137
+ workflows: {
138
+ enabled: true,
139
+ outputDir: '.github/workflows',
140
+ templates: {
141
+ daily: true,
142
+ weekly: true,
143
+ monthly: true,
144
+ },
145
+ custom: [],
146
+ },
147
+
148
+ packages: {
149
+ strategy: 'all',
150
+ ignore: [
151
+ // Packages to hold back, e.g. '@types/node'
152
+ ],
153
+ ignorePaths: [
154
+ // Glob patterns to skip, e.g. 'apps/legacy/**'
155
+ ],
156
+ },
157
+
158
+ verbose: false,
159
+ } satisfies BuddyConfig
160
+ `};
@@ -4,3 +4,5 @@ export declare function scaffoldNativeProject(root: string, options: { adopt?: b
4
4
  export declare function buildNativeProject(root: string, args?: string[]): Promise<string>;
5
5
  /** Return false to let the ordinary Buddy registry handle unrelated commands. */
6
6
  export declare function runNativeProjectCommand(root: string, args: string[]): Promise<boolean>;
7
+ /** Reject misspelled release flags before building, signing or contacting Apple. */
8
+ export declare function parseNativeAppleFlags(flags: string[]): { buildNumber?: string, packageOnly?: boolean, validateOnly?: boolean, submitForReview?: boolean };
@@ -1,4 +1,4 @@
1
- import{chmodSync,existsSync,mkdirSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{basename,join,resolve}from"node:path";import{pathToFileURL}from"node:url";import{setEnv}from"@stacksjs/env/cli";import{generateAppKey}from"@stacksjs/security/key";import{auditNativeEnvironment,defaultCraftRuntime,prepareNativeAppBuild,readNativeAppConfig,recordNativeArtifact}from"ts-pantry/native";export function isNativeProject(root){try{return JSON.parse(readFileSync(join(root,"package.json"),"utf8")).stacks?.type==="native"}catch{return!1}}export function scaffoldNativeProject(root,options){const manifest=join(root,"package.json");if(existsSync(root)&&readdirSync(root).some((name)=>name!==".git")&&!options.adopt)throw Error(`Path ${root} already exists. Use --adopt to integrate an existing native app.`);if(options.adopt&&(!existsSync(manifest)||!existsSync(join(root,"craft.config.ts"))))throw Error("--adopt requires package.json and craft.config.ts; no files were changed.");const pkg=existsSync(manifest)?JSON.parse(readFileSync(manifest,"utf8")):{name:basename(root),version:"0.1.0",description:"A Stacks native app"};if(pkg.stacks?.type&&pkg.stacks.type!=="native")throw Error("This project already declares a different Stacks application type.");const name=basename(root).replace(/(^|[-_ ])\w/g,(word)=>word.replace(/[-_ ]/g," ").toUpperCase());pkg.stacks={...pkg.stacks,type:"native"};pkg.devDependencies={"@stacksjs/buddy":`^${options.buddyVersion}`,...pkg.devDependencies};pkg.dependencies={"@stacksjs/stx":`^${options.stxVersion}`,"@stacksjs/desktop":`^${options.stxVersion}`,...pkg.dependencies};pkg.scripts={dev:"./buddy dev",build:"./buddy build",package:"./buddy package","release:patch":"./buddy release --bump patch","release:minor":"./buddy release --bump minor","release:major":"./buddy release --bump major",...pkg.scripts};mkdirSync(root,{recursive:!0});const writeMissing=(name,content)=>{const file=join(root,name);if(existsSync(file))return;mkdirSync(resolve(file,".."),{recursive:!0});writeFileSync(file,content)};writeMissing("buddy",`#!/bin/sh
1
+ import{chmodSync,existsSync,mkdirSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{basename,join,resolve}from"node:path";import{pathToFileURL}from"node:url";import{nativeProjectTemplates}from"./native-project-templates";import{setEnv}from"@stacksjs/env/cli";import{generateAppKey}from"@stacksjs/security/key";import{auditNativeEnvironment,defaultCraftRuntime,prepareNativeAppBuild,readNativeAppConfig,recordNativeArtifact}from"ts-pantry/native";export function isNativeProject(root){try{return JSON.parse(readFileSync(join(root,"package.json"),"utf8")).stacks?.type==="native"}catch{return!1}}export function scaffoldNativeProject(root,options){const manifest=join(root,"package.json");if(existsSync(root)&&readdirSync(root).some((name)=>name!==".git")&&!options.adopt)throw Error(`Path ${root} already exists. Use --adopt to integrate an existing native app.`);if(options.adopt&&(!existsSync(manifest)||!existsSync(join(root,"craft.config.ts"))))throw Error("--adopt requires package.json and craft.config.ts; no files were changed.");const pkg=existsSync(manifest)?JSON.parse(readFileSync(manifest,"utf8")):{name:basename(root),version:"0.1.0",description:"A Stacks native app"};if(pkg.stacks?.type&&pkg.stacks.type!=="native")throw Error("This project already declares a different Stacks application type.");const name=basename(root).replace(/(^|[-_ ])\w/g,(word)=>word.replace(/[-_ ]/g," ").toUpperCase());pkg.stacks={...pkg.stacks,type:"native"};pkg.devDependencies={"@buddysh/buddy":"^0.11.13","@stacksjs/buddy":`^${options.buddyVersion}`,...pkg.devDependencies};pkg.dependencies={"@stacksjs/stx":`^${options.stxVersion}`,"@stacksjs/desktop":`^${options.stxVersion}`,...pkg.dependencies};pkg.scripts={dev:"./buddy dev",build:"./buddy build",package:"./buddy package","release:patch":"./buddy release --bump patch","release:minor":"./buddy release --bump minor","release:major":"./buddy release --bump major",...pkg.scripts};mkdirSync(root,{recursive:!0});const writeMissing=(name,content)=>{const file=join(root,name);if(existsSync(file))return;mkdirSync(resolve(file,".."),{recursive:!0});writeFileSync(file,content)};writeMissing("buddy",`#!/bin/sh
2
2
  set -eu
3
3
  cd -- "$(dirname -- "$0")"
4
4
  BUDDY_NATIVE_ENTRY=$(bun --print 'Bun.resolveSync("@stacksjs/buddy/cli", process.cwd())')
@@ -16,6 +16,7 @@ exec bun "$BUDDY_NATIVE_ENTRY" "$@"
16
16
  <head><meta charset="utf-8"><title>${name.replace(/&/g,"&amp;").replace(/</g,"&lt;")}</title></head>
17
17
  <body><h1>${name.replace(/&/g,"&amp;").replace(/</g,"&lt;")}</h1><p>Your Stacks native app is ready.</p></body>
18
18
  </html>
19
+ `);for(const[destination,source]of Object.entries(nativeProjectTemplates))writeMissing(destination,source.replaceAll("__APP_SLUG__",pkg.name??basename(root)));writeMissing(".github/renovate.json",`${JSON.stringify({enabled:!1},null,2)}
19
20
  `);writeMissing(".gitignore",`node_modules/
20
21
  dist/
21
22
  .stx/
@@ -27,10 +28,11 @@ ${pattern}
27
28
  `).includes("!.env.production"))writeFileSync(ignoreFile,`${ignore.trimEnd()}
28
29
  !.env.production
29
30
  `);writeFileSync(manifest,`${JSON.stringify(pkg,null,2)}
30
- `)}export async function buildNativeProject(root,args=[]){const pkg=await Bun.file(join(root,"package.json")).json(),loaded=await import(pathToFileURL(join(root,"craft.config.ts")).href),config=loaded.default??loaded.config;if(!config||typeof config!=="object")throw Error("craft.config.ts must export a native build configuration.");const{buildNative}=await import(pathToFileURL(Bun.resolveSync("@stacksjs/stx/craft",root)).href),prepared=await prepareNativeAppBuild(root,config);try{const output=resolve(root,prepared.overrides.output??config.output??"dist");if(output===root||!output.startsWith(`${root}/`))throw Error("Native output must be a directory inside the app.");const buildNumber=process.env.PANTRY_BUILD_NUMBER||config.infoPlist?.CFBundleVersion||pkg.version,result=await buildNative({...config,...prepared.overrides,input:resolve(root,config.input??"src/app.stx"),output,version:pkg.version,description:pkg.description,author:pkg.author,infoPlist:{...config.infoPlist,CFBundleVersion:buildNumber},...config.icon?{icon:resolve(root,config.icon)}:{},...config.backend?{backend:{...config.backend,entry:resolve(root,config.backend.entry)}}:{},...args.includes("--dmg")?{format:"dmg"}:{},verbose:args.includes("--verbose")});if(!result.success||!result.outputPath)throw Error(result.error??"Native build produced no artifact.");if(readNativeAppConfig(root))recordNativeArtifact(root,{path:result.outputPath,...result.target==="macos"?{appPath:join(output,`${config.name}.app`)}:{},name:config.name,bundleId:config.bundleId,version:pkg.version,buildNumber:String(buildNumber),target:result.target,minimumSystemVersion:config.minimumSystemVersion});return result.outputPath}finally{prepared.cleanup()}}export async function runNativeProjectCommand(root,args){const[command="help",...flags]=args;if(!["build","build:desktop","build:native","package","dev","dev:desktop","dev:native","upgrade","update","release"].includes(command))return!1;if(flags.includes("--help")||flags.includes("-h")){console.log(`buddy ${command} (native app)
31
+ `)}export async function buildNativeProject(root,args=[]){const pkg=await Bun.file(join(root,"package.json")).json(),loaded=await import(pathToFileURL(join(root,"craft.config.ts")).href),config=loaded.default??loaded.config;if(!config||typeof config!=="object")throw Error("craft.config.ts must export a native build configuration.");const{buildNative}=await import(pathToFileURL(Bun.resolveSync("@stacksjs/stx/craft",root)).href),prepared=await prepareNativeAppBuild(root,config);try{const output=resolve(root,prepared.overrides.output??config.output??"dist");if(output===root||!output.startsWith(`${root}/`))throw Error("Native output must be a directory inside the app.");const buildNumber=process.env.PANTRY_BUILD_NUMBER||config.infoPlist?.CFBundleVersion||pkg.version,result=await buildNative({...config,...prepared.overrides,input:resolve(root,config.input??"src/app.stx"),output,version:pkg.version,description:pkg.description,author:pkg.author,infoPlist:{...config.infoPlist,CFBundleVersion:buildNumber},...config.icon?{icon:resolve(root,config.icon)}:{},...config.backend?{backend:{...config.backend,entry:resolve(root,config.backend.entry)}}:{},...args.includes("--dmg")?{format:"dmg"}:{},verbose:args.includes("--verbose")});if(!result.success||!result.outputPath)throw Error(result.error??"Native build produced no artifact.");if(readNativeAppConfig(root))recordNativeArtifact(root,{path:result.outputPath,...result.target==="macos"?{appPath:join(output,`${config.name}.app`)}:{},name:config.name,bundleId:config.bundleId,version:pkg.version,buildNumber:String(buildNumber),target:result.target,minimumSystemVersion:config.minimumSystemVersion});return result.outputPath}finally{prepared.cleanup()}}export async function runNativeProjectCommand(root,args){const[command="help",...flags]=args;if(!["build","build:desktop","build:native","package","dev","dev:desktop","dev:native","upgrade","update","release","desktop:apple:package","desktop:apple:publish","desktop:apple:submit"].includes(command))return!1;if(flags.includes("--help")||flags.includes("-h")){console.log(`buddy ${command} (native app)
31
32
 
32
33
  Build: --dmg --verbose
33
34
  Upgrade: --dry-run
34
35
  Release: --bump patch|minor|major --dry-run
36
+ Apple: --build-number N --validate-only --submit-for-review
35
37
 
36
- Application: craft.config.ts. Runtime and publishing: pantry.json. Development runtime override: CRAFT_BIN.`);return!0}if(command==="release"){const index=flags.indexOf("--bump"),bump=index>=0?flags[index+1]:"patch";if(!bump||!["patch","minor","major"].includes(bump)||flags.some((flag,position)=>flag!=="--dry-run"&&flag!=="--bump"&&!(index>=0&&position===index+1)))throw Error("Native releases support --bump patch|minor|major and --dry-run");const{releaseNativeApp}=await import("ts-pantry/native/release");await releaseNativeApp(root,{bump,dryRun:flags.includes("--dry-run")});return!0}if(command==="upgrade"||command==="update"){if(flags.some((flag)=>flag!=="--dry-run"&&flag!=="--verbose"))throw Error("Native upgrades support --dry-run and --verbose. Use bun add to select a specific package version.");if(flags.includes("--dry-run"))console.log("Would run bun update for the native app; no files changed.");else if(await Bun.spawn(["bun","update"],{cwd:root,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited!==0)throw Error("Native dependency upgrade failed.");return!0}const artifact=await buildNativeProject(root,command==="package"?[...flags,"--dmg"]:flags);console.log(`Built ${artifact}`);if(command.startsWith("dev")){const config=(await import(pathToFileURL(join(root,"craft.config.ts")).href)).default;if(process.platform!=="darwin")throw Error("Native development launch currently requires macOS.");const executable=join(artifact,"Contents","MacOS",config.name),child=Bun.spawn([executable],{cwd:root,stdin:"inherit",stdout:"inherit",stderr:"inherit"});let interrupted=!1;const stop=()=>{interrupted=!0;child.kill("SIGTERM")};process.once("SIGINT",stop);process.once("SIGTERM",stop);try{const code=await child.exited;if(code!==0&&!interrupted)throw Error(`Native app exited with ${child.signalCode??`code ${code}`}.`)}finally{process.removeListener("SIGINT",stop);process.removeListener("SIGTERM",stop)}}return!0}
38
+ Application: craft.config.ts. Runtime and publishing: pantry.json. Development runtime override: CRAFT_BIN.`);return!0}if(command.startsWith("desktop:apple:")){const options=parseNativeAppleFlags(flags),{publishNativeApple,submitNativeApple}=await import("ts-pantry/native");if(command==="desktop:apple:submit"){if(!options.buildNumber)throw Error("Submitting an uploaded build requires --build-number N");if(options.validateOnly||options.packageOnly)throw Error("Submit does not support package-only or validation-only");const loaded=await import(pathToFileURL(join(root,"craft.config.ts")).href),config=loaded.default??loaded.config;if(!config?.bundleId)throw Error("craft.config.ts must declare bundleId");await submitNativeApple(root,{...options,buildNumber:options.buildNumber,bundleId:config.bundleId})}else await publishNativeApple(root,{...options,...command==="desktop:apple:package"?{packageOnly:!0}:{}});return!0}if(command==="release"){const index=flags.indexOf("--bump"),bump=index>=0?flags[index+1]:"patch";if(!bump||!["patch","minor","major"].includes(bump)||flags.some((flag,position)=>flag!=="--dry-run"&&flag!=="--bump"&&!(index>=0&&position===index+1)))throw Error("Native releases support --bump patch|minor|major and --dry-run");const{releaseNativeApp}=await import("ts-pantry/native/release");await releaseNativeApp(root,{bump,dryRun:flags.includes("--dry-run")});return!0}if(command==="upgrade"||command==="update"){if(flags.some((flag)=>flag!=="--dry-run"&&flag!=="--verbose"))throw Error("Native upgrades support --dry-run and --verbose. Use bun add to select a specific package version.");if(flags.includes("--dry-run"))console.log("Would run bun update for the native app; no files changed.");else if(await Bun.spawn(["bun","update"],{cwd:root,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited!==0)throw Error("Native dependency upgrade failed.");return!0}const artifact=await buildNativeProject(root,command==="package"?[...flags,"--dmg"]:flags);console.log(`Built ${artifact}`);if(command.startsWith("dev")){const config=(await import(pathToFileURL(join(root,"craft.config.ts")).href)).default;if(process.platform!=="darwin")throw Error("Native development launch currently requires macOS.");const executable=join(artifact,"Contents","MacOS",config.name),child=Bun.spawn([executable],{cwd:root,stdin:"inherit",stdout:"inherit",stderr:"inherit"});let interrupted=!1;const stop=()=>{interrupted=!0;child.kill("SIGTERM")};process.once("SIGINT",stop);process.once("SIGTERM",stop);try{const code=await child.exited;if(code!==0&&!interrupted)throw Error(`Native app exited with ${child.signalCode??`code ${code}`}.`)}finally{process.removeListener("SIGINT",stop);process.removeListener("SIGTERM",stop)}}return!0}export function parseNativeAppleFlags(flags){const options={};for(let index=0;index<flags.length;index++){const flag=flags[index];if(flag==="--build-number"){const value=flags[++index];if(!value||!/^[1-9]\d*$/.test(value))throw Error("--build-number requires a positive integer");options.buildNumber=value}else if(flag==="--package-only")options.packageOnly=!0;else if(flag==="--validate-only")options.validateOnly=!0;else if(flag==="--submit-for-review")options.submitForReview=!0;else throw Error(`Unsupported native Apple option: ${flag}`)}if(options.packageOnly&&(options.validateOnly||options.submitForReview))throw Error("Package-only cannot validate or submit a release");if(options.validateOnly&&options.submitForReview)throw Error("Validation-only cannot submit a release");return options}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.324",
5
+ "version": "0.75.326",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -95,73 +95,73 @@
95
95
  "prepublishOnly": "bun run build"
96
96
  },
97
97
  "dependencies": {
98
- "@stacksjs/actions": "0.75.324",
99
- "@stacksjs/ai": "0.75.324",
100
- "@stacksjs/alias": "0.75.324",
101
- "@stacksjs/analytics": "0.75.324",
102
- "@stacksjs/api": "0.75.324",
103
- "@stacksjs/arrays": "0.75.324",
104
- "@stacksjs/auth": "0.75.324",
105
- "@stacksjs/browser-extension": "0.75.324",
106
- "@stacksjs/build": "0.75.324",
98
+ "@stacksjs/actions": "0.75.326",
99
+ "@stacksjs/ai": "0.75.326",
100
+ "@stacksjs/alias": "0.75.326",
101
+ "@stacksjs/analytics": "0.75.326",
102
+ "@stacksjs/api": "0.75.326",
103
+ "@stacksjs/arrays": "0.75.326",
104
+ "@stacksjs/auth": "0.75.326",
105
+ "@stacksjs/browser-extension": "0.75.326",
106
+ "@stacksjs/build": "0.75.326",
107
107
  "@stacksjs/bumpx": "^0.2.26",
108
- "@stacksjs/cache": "0.75.324",
109
- "@stacksjs/chat": "0.75.324",
108
+ "@stacksjs/cache": "0.75.326",
109
+ "@stacksjs/chat": "0.75.326",
110
110
  "@stacksjs/clapp": "^0.2.16",
111
- "@stacksjs/cli": "0.75.324",
112
- "@stacksjs/cloud": "0.75.324",
113
- "@stacksjs/cms": "0.75.324",
114
- "@stacksjs/collections": "0.75.324",
115
- "@stacksjs/commerce": "0.75.324",
116
- "@stacksjs/config": "0.75.324",
117
- "@stacksjs/database": "0.75.324",
118
- "@stacksjs/desktop-build": "0.75.324",
119
- "@stacksjs/dns": "0.75.324",
111
+ "@stacksjs/cli": "0.75.326",
112
+ "@stacksjs/cloud": "0.75.326",
113
+ "@stacksjs/cms": "0.75.326",
114
+ "@stacksjs/collections": "0.75.326",
115
+ "@stacksjs/commerce": "0.75.326",
116
+ "@stacksjs/config": "0.75.326",
117
+ "@stacksjs/database": "0.75.326",
118
+ "@stacksjs/desktop-build": "0.75.326",
119
+ "@stacksjs/dns": "0.75.326",
120
120
  "@stacksjs/dnsx": "^0.2.3",
121
- "@stacksjs/email": "0.75.324",
122
- "@stacksjs/enums": "0.75.324",
123
- "@stacksjs/env": "0.75.324",
124
- "@stacksjs/error-handling": "0.75.324",
125
- "@stacksjs/events": "0.75.324",
126
- "@stacksjs/features": "0.75.324",
127
- "@stacksjs/git": "0.75.324",
121
+ "@stacksjs/email": "0.75.326",
122
+ "@stacksjs/enums": "0.75.326",
123
+ "@stacksjs/env": "0.75.326",
124
+ "@stacksjs/error-handling": "0.75.326",
125
+ "@stacksjs/events": "0.75.326",
126
+ "@stacksjs/features": "0.75.326",
127
+ "@stacksjs/git": "0.75.326",
128
128
  "@stacksjs/gitit": "^0.2.5",
129
- "@stacksjs/health": "0.75.324",
129
+ "@stacksjs/health": "0.75.326",
130
130
  "@stacksjs/httx": "^0.1.10",
131
- "@stacksjs/image": "0.75.324",
132
- "@stacksjs/lint": "0.75.324",
133
- "@stacksjs/logging": "0.75.324",
134
- "@stacksjs/notifications": "0.75.324",
135
- "@stacksjs/objects": "0.75.324",
136
- "@stacksjs/orm": "0.75.324",
137
- "@stacksjs/path": "0.75.324",
138
- "@stacksjs/payments": "0.75.324",
139
- "@stacksjs/realtime": "0.75.324",
140
- "@stacksjs/router": "0.75.324",
141
- "@stacksjs/security": "0.75.324",
131
+ "@stacksjs/image": "0.75.326",
132
+ "@stacksjs/lint": "0.75.326",
133
+ "@stacksjs/logging": "0.75.326",
134
+ "@stacksjs/notifications": "0.75.326",
135
+ "@stacksjs/objects": "0.75.326",
136
+ "@stacksjs/orm": "0.75.326",
137
+ "@stacksjs/path": "0.75.326",
138
+ "@stacksjs/payments": "0.75.326",
139
+ "@stacksjs/realtime": "0.75.326",
140
+ "@stacksjs/router": "0.75.326",
141
+ "@stacksjs/security": "0.75.326",
142
142
  "@stacksjs/rpx": "^0.11.54",
143
- "@stacksjs/scheduler": "0.75.324",
144
- "@stacksjs/search-engine": "0.75.324",
145
- "@stacksjs/server": "0.75.324",
146
- "@stacksjs/sites": "0.75.324",
147
- "@stacksjs/skills": "0.75.324",
148
- "@stacksjs/socials": "0.75.324",
149
- "@stacksjs/storage": "0.75.324",
150
- "@stacksjs/strings": "0.75.324",
143
+ "@stacksjs/scheduler": "0.75.326",
144
+ "@stacksjs/search-engine": "0.75.326",
145
+ "@stacksjs/server": "0.75.326",
146
+ "@stacksjs/sites": "0.75.326",
147
+ "@stacksjs/skills": "0.75.326",
148
+ "@stacksjs/socials": "0.75.326",
149
+ "@stacksjs/storage": "0.75.326",
150
+ "@stacksjs/strings": "0.75.326",
151
151
  "@stacksjs/stx": "0.2.711",
152
- "@stacksjs/testing": "0.75.324",
153
- "@stacksjs/tinker": "0.75.324",
152
+ "@stacksjs/testing": "0.75.326",
153
+ "@stacksjs/tinker": "0.75.326",
154
154
  "@stacksjs/tlsx": "^0.13.19",
155
155
  "@stacksjs/ts-cloud": "^0.16.69",
156
- "@stacksjs/tunnel": "0.75.324",
157
- "@stacksjs/types": "0.75.324",
158
- "@stacksjs/ui": "0.75.324",
159
- "@stacksjs/utils": "0.75.324",
160
- "@stacksjs/validation": "0.75.324",
156
+ "@stacksjs/tunnel": "0.75.326",
157
+ "@stacksjs/types": "0.75.326",
158
+ "@stacksjs/ui": "0.75.326",
159
+ "@stacksjs/utils": "0.75.326",
160
+ "@stacksjs/validation": "0.75.326",
161
161
  "ajv": "^8.20.0",
162
162
  "ajv-formats": "^3.0.1",
163
163
  "bun-plugin-stx": "0.2.711",
164
- "ts-pantry": "^0.11.130"
164
+ "ts-pantry": "^0.11.138"
165
165
  },
166
166
  "devDependencies": {
167
167
  "better-dx": "^0.2.24"