@stacksjs/buddy 0.70.363 → 0.70.366

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.
@@ -26,6 +26,8 @@ export declare function pruneVendoredCoreFromWorkflows(cwd: string): Promise<Wor
26
26
  * Returns a new scripts object, or null when there is nothing to change.
27
27
  */
28
28
  export declare function splitFrameworkTypecheckScript(scripts: Record<string, string>): Record<string, string> | null;
29
+ /** The framework-repo scripts this prunes, so a test can pin them. */
30
+ export declare const frameworkOnlyScripts: readonly string[];
29
31
  /**
30
32
  * Strip the framework's own CI from a project that no longer vendors it.
31
33
  *
@@ -1,3 +1,3 @@
1
- const CORE_PATH=/storage\/framework\/core/;function referencesCore(line){if(line.trim().startsWith("#"))return!1;return CORE_PATH.test(line.replace(/\s#.*$/,""))}function jobStarts(lines){const out=[];let inJobs=!1;for(const[at,line]of lines.entries()){if(/^jobs:\s*$/.test(line)){inJobs=!0;continue}if(!inJobs)continue;if(/^\S/.test(line)&&!/^\s*#/.test(line))break;const match=line.match(/^ {2}([A-Za-z_][\w-]*):\s*$/);if(match)out.push({name:match[1],at})}return out}function blockEnd(lines,from,indent){const sibling=new RegExp(`^ {${indent}}(?:- |[A-Za-z_"'])`);for(let at=from+1;at<lines.length;at++){const line=lines[at];if(line.trim()==="")continue;const leading=line.length-line.trimStart().length;if(leading<indent)return at;if(leading===indent&&sibling.test(line))return at}return lines.length}const SETUP_STEP=[/uses:\s*actions\/checkout/,/uses:\s*actions\/cache/,/uses:\s*actions\/setup-/,/uses:\s*pantry-pm\/pantry/,/run:\s*(?:bun|pantry|npm|pnpm|yarn)\s+(?:install|ci)\b/];function isSetupStep(step){const code=step.filter((line)=>!line.trim().startsWith("#"));return SETUP_STEP.some((pattern)=>code.some((line)=>pattern.test(line)))}function withLeadingComments(lines,at){let start=at;while(start-1>=0){const previous=lines[start-1].trim();if(previous.startsWith("#")||previous==="")start--;else break}while(start<at&&lines[start].trim()==="")start++;return start}export function pruneVendoredCoreFromWorkflow(source){let lines=source.split(`
1
+ const FRAMEWORK_ONLY_PATH=/storage\/framework\/(?:core|scripts\/publish-commit)/,FRAMEWORK_ONLY_SCRIPTS=new Set(["docs:buddy","docs:buddy:check","docs:artifacts","docs:artifacts:check","docs:links","docs:links:check"]);function invocations(line){return[...line.matchAll(/(?:bun\s+run|bun\s+buddy|\.\/buddy|bunx?\s+buddy)\s+["']?([\w:.-]+)/g)].map((match)=>match[1])}function referencesCore(line){if(line.trim().startsWith("#"))return!1;const code=line.replace(/\s#.*$/,"");return FRAMEWORK_ONLY_PATH.test(code)||invocations(code).some((name)=>FRAMEWORK_ONLY_SCRIPTS.has(name))}export const frameworkOnlyScripts=[...FRAMEWORK_ONLY_SCRIPTS];function jobStarts(lines){const out=[];let inJobs=!1;for(const[at,line]of lines.entries()){if(/^jobs:\s*$/.test(line)){inJobs=!0;continue}if(!inJobs)continue;if(/^\S/.test(line)&&!/^\s*#/.test(line))break;const match=line.match(/^ {2}([A-Za-z_][\w-]*):\s*$/);if(match)out.push({name:match[1],at})}return out}function blockEnd(lines,from,indent){const sibling=new RegExp(`^ {${indent}}(?:- |[A-Za-z_"'])`);for(let at=from+1;at<lines.length;at++){const line=lines[at];if(line.trim()==="")continue;const leading=line.length-line.trimStart().length;if(leading<indent)return at;if(leading===indent&&sibling.test(line))return at}return lines.length}const SETUP_STEP=[/uses:\s*actions\/checkout/,/uses:\s*actions\/cache/,/uses:\s*actions\/setup-/,/uses:\s*pantry-pm\/pantry/,/run:\s*(?:bun|pantry|npm|pnpm|yarn)\s+(?:install|ci)\b/];function isSetupStep(step){const code=step.filter((line)=>!line.trim().startsWith("#"));return SETUP_STEP.some((pattern)=>code.some((line)=>pattern.test(line)))}function withLeadingComments(lines,at){let start=at;while(start-1>=0){const previous=lines[start-1].trim();if(previous.startsWith("#")||previous==="")start--;else break}while(start<at&&lines[start].trim()==="")start++;return start}export function pruneVendoredCoreFromWorkflow(source){let lines=source.split(`
2
2
  `);const removedJobs=[];let removedSteps=0;for(const job of jobStarts(lines).reverse()){const end=blockEnd(lines,job.at,2),body=lines.slice(job.at,end),steps=[];for(const[offset,line]of body.entries()){if(!/^ {6}- /.test(line))continue;const at=job.at+offset,stepEnd=blockEnd(lines,at,6),step=lines.slice(at,stepEnd);steps.push({at,end:stepEnd,core:step.some(referencesCore),setup:isSetupStep(step)})}if(steps.length===0||!steps.some((step)=>step.core))continue;if(steps.filter((step)=>!step.setup).every((step)=>step.core)){lines.splice(withLeadingComments(lines,job.at),end-withLeadingComments(lines,job.at));removedJobs.push(job.name);continue}for(const step of[...steps].reverse()){if(!step.core)continue;const from=withLeadingComments(lines,step.at);lines.splice(from,step.end-from);removedSteps++}}if(removedJobs.length>0)lines=lines.map((line)=>{const inline=line.match(/^(\s*needs:\s*)\[([^\]]*)\]\s*$/);if(inline){const kept=inline[2].split(",").map((name)=>name.trim()).filter((name)=>name&&!removedJobs.includes(name));return kept.length>0?`${inline[1]}[${kept.join(", ")}]`:""}const scalar=line.match(/^(\s*)needs:\s*([A-Za-z_][\w-]*)\s*$/);if(scalar&&removedJobs.includes(scalar[2]))return"";return line}).filter((line,at,all)=>!(line===""&&all[at-1]===""&&all[at+1]===""));return{yaml:lines.join(`
3
3
  `),removedJobs,removedSteps}}export async function pruneVendoredCoreFromWorkflows(cwd){const{readdir,readFile,writeFile}=await import("node:fs/promises"),{join}=await import("node:path"),dir=join(cwd,".github","workflows"),pruned=[];let entries;try{entries=await readdir(dir)}catch{return pruned}for(const entry of entries.sort()){if(!/\.ya?ml$/.test(entry))continue;const file=join(dir,entry);try{const source=await readFile(file,"utf-8"),result=pruneVendoredCoreFromWorkflow(source);if(result.yaml===source)continue;await writeFile(file,result.yaml);pruned.push({file:`.github/workflows/${entry}`,removedJobs:result.removedJobs,removedSteps:result.removedSteps})}catch{continue}}return pruned}export function splitFrameworkTypecheckScript(scripts){if(!scripts.typecheck?.includes("tsconfig.framework.json")||!scripts["typecheck:app"])return null;return Object.fromEntries(Object.entries(scripts).flatMap(([name,script])=>name==="typecheck"?[["typecheck","bun run typecheck:app && bun run typecheck:framework"],["typecheck:framework",script]]:[[name,script]]))}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.363",
5
+ "version": "0.70.366",
6
6
  "description": "Meet Buddy. The Stacks runtime.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -95,53 +95,53 @@
95
95
  "prepublishOnly": "bun run build"
96
96
  },
97
97
  "dependencies": {
98
- "@stacksjs/actions": "^0.70.363",
99
- "@stacksjs/ai": "^0.70.363",
100
- "@stacksjs/alias": "^0.70.363",
101
- "@stacksjs/arrays": "^0.70.363",
102
- "@stacksjs/auth": "^0.70.363",
103
- "@stacksjs/build": "^0.70.363",
104
- "@stacksjs/cache": "^0.70.363",
105
- "@stacksjs/cli": "^0.70.363",
98
+ "@stacksjs/actions": "^0.70.366",
99
+ "@stacksjs/ai": "^0.70.366",
100
+ "@stacksjs/alias": "^0.70.366",
101
+ "@stacksjs/arrays": "^0.70.366",
102
+ "@stacksjs/auth": "^0.70.366",
103
+ "@stacksjs/build": "^0.70.366",
104
+ "@stacksjs/cache": "^0.70.366",
105
+ "@stacksjs/cli": "^0.70.366",
106
106
  "@stacksjs/clapp": "^0.2.12",
107
- "@stacksjs/cloud": "^0.70.363",
108
- "@stacksjs/collections": "^0.70.363",
109
- "@stacksjs/config": "^0.70.363",
110
- "@stacksjs/database": "^0.70.363",
111
- "@stacksjs/desktop-build": "^0.70.363",
112
- "@stacksjs/dns": "^0.70.363",
113
- "@stacksjs/email": "^0.70.363",
114
- "@stacksjs/enums": "^0.70.363",
115
- "@stacksjs/error-handling": "^0.70.363",
116
- "@stacksjs/events": "^0.70.363",
117
- "@stacksjs/git": "^0.70.363",
107
+ "@stacksjs/cloud": "^0.70.366",
108
+ "@stacksjs/collections": "^0.70.366",
109
+ "@stacksjs/config": "^0.70.366",
110
+ "@stacksjs/database": "^0.70.366",
111
+ "@stacksjs/desktop-build": "^0.70.366",
112
+ "@stacksjs/dns": "^0.70.366",
113
+ "@stacksjs/email": "^0.70.366",
114
+ "@stacksjs/enums": "^0.70.366",
115
+ "@stacksjs/error-handling": "^0.70.366",
116
+ "@stacksjs/events": "^0.70.366",
117
+ "@stacksjs/git": "^0.70.366",
118
118
  "@stacksjs/gitit": "^0.2.5",
119
- "@stacksjs/health": "^0.70.363",
119
+ "@stacksjs/health": "^0.70.366",
120
120
  "@stacksjs/dnsx": "^0.2.3",
121
121
  "@stacksjs/httx": "^0.1.10",
122
- "@stacksjs/image": "^0.70.363",
123
- "@stacksjs/lint": "^0.70.363",
124
- "@stacksjs/logging": "^0.70.363",
125
- "@stacksjs/notifications": "^0.70.363",
126
- "@stacksjs/objects": "^0.70.363",
127
- "@stacksjs/orm": "^0.70.363",
128
- "@stacksjs/path": "^0.70.363",
129
- "@stacksjs/skills": "^0.70.363",
130
- "@stacksjs/payments": "^0.70.363",
131
- "@stacksjs/realtime": "^0.70.363",
132
- "@stacksjs/router": "^0.70.363",
122
+ "@stacksjs/image": "^0.70.366",
123
+ "@stacksjs/lint": "^0.70.366",
124
+ "@stacksjs/logging": "^0.70.366",
125
+ "@stacksjs/notifications": "^0.70.366",
126
+ "@stacksjs/objects": "^0.70.366",
127
+ "@stacksjs/orm": "^0.70.366",
128
+ "@stacksjs/path": "^0.70.366",
129
+ "@stacksjs/skills": "^0.70.366",
130
+ "@stacksjs/payments": "^0.70.366",
131
+ "@stacksjs/realtime": "^0.70.366",
132
+ "@stacksjs/router": "^0.70.366",
133
133
  "@stacksjs/rpx": "^0.11.42",
134
- "@stacksjs/search-engine": "^0.70.363",
135
- "@stacksjs/security": "^0.70.363",
136
- "@stacksjs/server": "^0.70.363",
137
- "@stacksjs/storage": "^0.70.363",
138
- "@stacksjs/strings": "^0.70.363",
139
- "@stacksjs/testing": "^0.70.363",
140
- "@stacksjs/tunnel": "^0.70.363",
141
- "@stacksjs/types": "^0.70.363",
142
- "@stacksjs/ui": "^0.70.363",
143
- "@stacksjs/utils": "^0.70.363",
144
- "@stacksjs/validation": "^0.70.363",
134
+ "@stacksjs/search-engine": "^0.70.366",
135
+ "@stacksjs/security": "^0.70.366",
136
+ "@stacksjs/server": "^0.70.366",
137
+ "@stacksjs/storage": "^0.70.366",
138
+ "@stacksjs/strings": "^0.70.366",
139
+ "@stacksjs/testing": "^0.70.366",
140
+ "@stacksjs/tunnel": "^0.70.366",
141
+ "@stacksjs/types": "^0.70.366",
142
+ "@stacksjs/ui": "^0.70.366",
143
+ "@stacksjs/utils": "^0.70.366",
144
+ "@stacksjs/validation": "^0.70.366",
145
145
  "@stacksjs/ts-cloud": "^0.7.103",
146
146
  "ajv": "^8.20.0",
147
147
  "ajv-formats": "^3.0.1",