@stacksjs/actions 0.75.296 → 0.75.299

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.
@@ -5,11 +5,11 @@ export declare function standalonePackageUpdateCommand(): string;
5
5
  * already-declared `stacks` package refreshes its dependency graph without
6
6
  * rewriting the application's ownership boundary.
7
7
  */
8
- export declare function frameworkPackageUpdateCommand(force?: boolean): string;
8
+ export declare function frameworkPackageUpdateCommand(target: string, force?: boolean): string;
9
9
  /** The installed meta-package version, or null when dependencies are absent/incomplete. */
10
10
  export declare function installedStacksVersion(projectRoot: string): string | null;
11
11
  /** Whether the declared target still needs to be installed locally. */
12
- export declare function needsFrameworkInstall(projectRoot: string, target: string): boolean;
12
+ export declare function needsFrameworkInstall(projectRoot: string, target: string, runtimePins?: Record<string, string>): boolean;
13
13
  /** Independently versioned frontend packages paired with a published framework. */
14
14
  export declare function publishedRuntimePins(dependencies: Record<string, string>): Record<string, string>;
15
15
  /** Read the exact STX release's nested runtime pins before changing an app. */
@@ -1,4 +1,4 @@
1
- import{existsSync,lstatSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{join,relative}from"node:path";import process from"node:process";import{runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{runPostSyncDatabaseTypesRefresh}from"./framework-hooks";import{detectProjectAiProviders,measureDefaultsDrift,migratePackageProjectManifest,migratePackageProjectTsconfig,summarizeStructureChanges,syncPackageProjectFiles}from"./package-project";import{describeDanglingRouteActions,findDanglingRouteActions,pruneRetiredScaffoldRoutes}from"./route-actions";export function hasStacksDependency(pkg){return Boolean(pkg.dependencies?.stacks||pkg.devDependencies?.stacks)}export function standalonePackageUpdateCommand(){return"bun update"}export function frameworkPackageUpdateCommand(force=!1){return force?"bun update stacks --force":"bun update stacks"}export function installedStacksVersion(projectRoot){try{const manifest=JSON.parse(readFileSync(join(projectRoot,"node_modules/stacks/package.json"),"utf-8"));return typeof manifest.version==="string"?manifest.version:null}catch{return null}}export function needsFrameworkInstall(projectRoot,target){return installedStacksVersion(projectRoot)!==target}async function updateStandalonePackage(projectRoot,options){console.log(`
1
+ import{existsSync,lstatSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{join,relative}from"node:path";import process from"node:process";import{runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{runPostSyncDatabaseTypesRefresh}from"./framework-hooks";import{detectProjectAiProviders,measureDefaultsDrift,migratePackageProjectManifest,migratePackageProjectTsconfig,summarizeStructureChanges,syncPackageProjectFiles}from"./package-project";import{describeDanglingRouteActions,findDanglingRouteActions,pruneRetiredScaffoldRoutes}from"./route-actions";export function hasStacksDependency(pkg){return Boolean(pkg.dependencies?.stacks||pkg.devDependencies?.stacks)}export function standalonePackageUpdateCommand(){return"bun update"}export function frameworkPackageUpdateCommand(target,force=!1){if(!/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(target))throw Error("The framework install target must be a published version.");return`bun update stacks@${target}${force?" --force":""}`}export function installedStacksVersion(projectRoot){try{const manifest=JSON.parse(readFileSync(join(projectRoot,"node_modules/stacks/package.json"),"utf-8"));return typeof manifest.version==="string"?manifest.version:null}catch{return null}}export function needsFrameworkInstall(projectRoot,target,runtimePins={}){try{const metaRoot=join(projectRoot,"node_modules/stacks"),installed=JSON.parse(readFileSync(join(metaRoot,"package.json"),"utf8"));if(installed.version!==target)return!0;const projectPath=join(projectRoot,"package.json"),project=existsSync(projectPath)?JSON.parse(readFileSync(projectPath,"utf8")):{},publishedRange=/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/,customResolution=(name)=>{const rule=project.overrides?.[name]??project.resolutions?.[name];return rule!==void 0&&(typeof rule!=="string"||!publishedRange.test(rule))},lockPath=join(projectRoot,"bun.lock");if(existsSync(lockPath)){if(Bun.JSONC.parse(readFileSync(lockPath,"utf8")).packages?.stacks?.[0]!==`stacks@${target}`)return!0}for(const[name,version]of Object.entries(installed.dependencies??{})){if(!name.startsWith("@stacksjs/")||version!==target||customResolution(name))continue;if(JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,metaRoot),"utf8")).version!==target)return!0}if(Object.keys(runtimePins).length){const declared={...project.dependencies,...project.devDependencies};for(const[name,version]of Object.entries(runtimePins)){const spec=declared[name];if(typeof spec!=="string"||!publishedRange.test(spec)||customResolution(name))continue;if(JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,projectRoot),"utf8")).version!==baseVersion(version))return!0}}return!1}catch{return!0}}async function updateStandalonePackage(projectRoot,options){console.log(`
2
2
  Standalone package detected. No Stacks framework source is installed.`);if(options.dryRun){console.log(" --dry-run: would refresh the package dependencies with `bun update`. No files were changed.\n");process.exit(0)}if(options.noPostinstall){console.log(" --no-postinstall: skipping the dependency refresh. Run `bun update` when ready.\n");process.exit(0)}console.log(` Refreshing declared dependencies...
3
3
  `);if((await runCommand(standalonePackageUpdateCommand(),{cwd:projectRoot})).isErr){console.error("\n\u2717 The dependency refresh failed. Resolve the reported error and re-run `buddy update`.\n");process.exit(1)}console.log(`
4
4
  \u2714 Standalone package dependencies are up to date.
@@ -9,9 +9,13 @@ import{existsSync,lstatSync,readdirSync,readFileSync,writeFileSync}from"node:fs"
9
9
  `)}reportRouteActions(projectRoot,!0);console.log(` --dry-run: no files were written and nothing was installed.
10
10
  `);process.exit(0)}if(changes.length>0||projectManifestChanges.length>0){const trailing=raw.endsWith(`
11
11
  `)?`
12
- `:"";writeFileSync(pkgPath,`${JSON.stringify(pkg,null,2)}${trailing}`);console.log("\u2714 Updated package.json")}if(options.noPostinstall){console.log(" --no-postinstall: skipping install. Run this to pull the new versions:");console.log(` ${frameworkPackageUpdateCommand()}
13
- `);process.exit(0)}const dependenciesNeedInstall=needsFrameworkInstall(projectRoot,target);if(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||options.force){console.log(` Installing\u2026
14
- `);if((await runCommand(frameworkPackageUpdateCommand(options.force),{cwd:projectRoot})).isErr){console.error("\n\u2717 The install step failed. Your package.json was updated - resolve the error and re-run `bun update`.\n");process.exit(1)}}const defaultsPackageRoot=join(projectRoot,"node_modules/@stacksjs/defaults"),structureChanges=existsSync(join(defaultsPackageRoot,"package.json"))?syncPackageProjectFiles(projectRoot,defaultsPackageRoot):[],tsconfigChanges=migratePackageProjectTsconfig(projectRoot),prunedRoutes=reportRouteActions(projectRoot,!1);if(structureChanges.length>0||tsconfigChanges.length>0){const added=structureChanges.filter((change)=>change.action==="add").length,updated=structureChanges.filter((change)=>change.action==="update").length+tsconfigChanges.length,removed=structureChanges.filter((change)=>change.action==="remove").length;console.log(` Project structure: +${added} ~${updated} -${removed}`)}if(structureChanges.length>0)await regenerateAutoImports(projectRoot);if(changes.length>0||dependenciesNeedInstall||structureChanges.length>0||options.force)await regenerateDatabaseTypes(projectRoot);for(const provider of detectProjectAiProviders(projectRoot))if((await runCommand(`./buddy setup:ai ${provider} --force`,{cwd:projectRoot})).isErr){console.error(`
12
+ `:"";writeFileSync(pkgPath,`${JSON.stringify(pkg,null,2)}${trailing}`);console.log("\u2714 Updated package.json")}if(options.noPostinstall){console.log(" --no-postinstall: skipping install. Run this to pull the new versions:");console.log(` ${frameworkPackageUpdateCommand(target)}
13
+ `);process.exit(0)}const dependenciesNeedInstall=needsFrameworkInstall(projectRoot,target,runtimePins);if(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||options.force){console.log(` Installing\u2026
14
+ `);if((await runCommand(frameworkPackageUpdateCommand(target,options.force),{cwd:projectRoot})).isErr){console.error(`
15
+ \u2717 The install step failed. Your package.json was updated - resolve the error and re-run \`buddy upgrade --version ${target}\`.
16
+ `);process.exit(1)}}const installed=installedStacksVersion(projectRoot);if(installed!==target){console.error(`
17
+ \u2717 Requested stacks@${target}, but the installed package reports ${installed??"no readable version"}. The installed files are retained for diagnosis; managed defaults were not synchronized.
18
+ `);process.exit(1)}const defaultsPackageRoot=join(projectRoot,"node_modules/@stacksjs/defaults"),structureChanges=existsSync(join(defaultsPackageRoot,"package.json"))?syncPackageProjectFiles(projectRoot,defaultsPackageRoot):[],tsconfigChanges=migratePackageProjectTsconfig(projectRoot),prunedRoutes=reportRouteActions(projectRoot,!1);if(structureChanges.length>0||tsconfigChanges.length>0){const added=structureChanges.filter((change)=>change.action==="add").length,updated=structureChanges.filter((change)=>change.action==="update").length+tsconfigChanges.length,removed=structureChanges.filter((change)=>change.action==="remove").length;console.log(` Project structure: +${added} ~${updated} -${removed}`)}if(structureChanges.length>0)await regenerateAutoImports(projectRoot);if(changes.length>0||dependenciesNeedInstall||structureChanges.length>0||options.force)await regenerateDatabaseTypes(projectRoot);for(const provider of detectProjectAiProviders(projectRoot))if((await runCommand(`./buddy setup:ai ${provider} --force`,{cwd:projectRoot})).isErr){console.error(`
15
19
  \u2717 AI setup refresh failed for ${provider}. Re-run \`buddy setup:ai ${provider} --force\`.
16
20
  `);process.exit(1)}if(!(changes.length>0||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||structureChanges.length>0||tsconfigChanges.length>0||prunedRoutes>0)&&!options.force)console.log(`
17
21
  \u2714 Already up to date - dependencies and managed project files match the target.
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.296",
5
+ "version": "0.75.299",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -66,54 +66,54 @@
66
66
  "prepublishOnly": "bun run build"
67
67
  },
68
68
  "dependencies": {
69
- "@stacksjs/action-runner": "0.75.296",
70
- "@stacksjs/ai": "0.75.296",
71
- "@stacksjs/analytics": "0.75.296",
72
- "@stacksjs/api": "0.75.296",
73
- "@stacksjs/auth": "0.75.296",
74
- "@stacksjs/build": "0.75.296",
69
+ "@stacksjs/action-runner": "0.75.299",
70
+ "@stacksjs/ai": "0.75.299",
71
+ "@stacksjs/analytics": "0.75.299",
72
+ "@stacksjs/api": "0.75.299",
73
+ "@stacksjs/auth": "0.75.299",
74
+ "@stacksjs/build": "0.75.299",
75
75
  "@stacksjs/bumpx": "^0.2.26",
76
76
  "@stacksjs/bunpress": "^0.2.15",
77
- "@stacksjs/cli": "0.75.296",
78
- "@stacksjs/cloud": "0.75.296",
79
- "@stacksjs/cms": "0.75.296",
77
+ "@stacksjs/cli": "0.75.299",
78
+ "@stacksjs/cloud": "0.75.299",
79
+ "@stacksjs/cms": "0.75.299",
80
80
  "@stacksjs/components": "0.2.687",
81
- "@stacksjs/config": "0.75.296",
82
- "@stacksjs/database": "0.75.296",
83
- "@stacksjs/desktop-build": "0.75.296",
84
- "@stacksjs/dns": "0.75.296",
85
- "@stacksjs/enums": "0.75.296",
86
- "@stacksjs/env": "0.75.296",
87
- "@stacksjs/error-handling": "0.75.296",
88
- "@stacksjs/github": "0.75.296",
81
+ "@stacksjs/config": "0.75.299",
82
+ "@stacksjs/database": "0.75.299",
83
+ "@stacksjs/desktop-build": "0.75.299",
84
+ "@stacksjs/dns": "0.75.299",
85
+ "@stacksjs/enums": "0.75.299",
86
+ "@stacksjs/env": "0.75.299",
87
+ "@stacksjs/error-handling": "0.75.299",
88
+ "@stacksjs/github": "0.75.299",
89
89
  "@stacksjs/gitit": "^0.2.5",
90
- "@stacksjs/i18n": "0.75.296",
91
- "@stacksjs/image": "0.75.296",
92
- "@stacksjs/logging": "0.75.296",
90
+ "@stacksjs/i18n": "0.75.299",
91
+ "@stacksjs/image": "0.75.299",
92
+ "@stacksjs/logging": "0.75.299",
93
93
  "@stacksjs/logsmith": "^0.2.11",
94
- "@stacksjs/mobile": "0.75.296",
95
- "@stacksjs/orm": "0.75.296",
96
- "@stacksjs/path": "0.75.296",
97
- "@stacksjs/payments": "0.75.296",
98
- "@stacksjs/queue": "0.75.296",
99
- "@stacksjs/registry": "0.75.296",
100
- "@stacksjs/router": "0.75.296",
94
+ "@stacksjs/mobile": "0.75.299",
95
+ "@stacksjs/orm": "0.75.299",
96
+ "@stacksjs/path": "0.75.299",
97
+ "@stacksjs/payments": "0.75.299",
98
+ "@stacksjs/queue": "0.75.299",
99
+ "@stacksjs/registry": "0.75.299",
100
+ "@stacksjs/router": "0.75.299",
101
101
  "@stacksjs/rpx": "^0.11.54",
102
- "@stacksjs/scheduler": "0.75.296",
103
- "@stacksjs/search-engine": "0.75.296",
104
- "@stacksjs/security": "0.75.296",
105
- "@stacksjs/server": "0.75.296",
106
- "@stacksjs/sites": "0.75.296",
107
- "@stacksjs/storage": "0.75.296",
108
- "@stacksjs/strings": "0.75.296",
102
+ "@stacksjs/scheduler": "0.75.299",
103
+ "@stacksjs/search-engine": "0.75.299",
104
+ "@stacksjs/security": "0.75.299",
105
+ "@stacksjs/server": "0.75.299",
106
+ "@stacksjs/sites": "0.75.299",
107
+ "@stacksjs/storage": "0.75.299",
108
+ "@stacksjs/strings": "0.75.299",
109
109
  "@stacksjs/stx": "0.2.687",
110
110
  "@stacksjs/tlsx": "^0.13.19",
111
111
  "@stacksjs/ts-cloud": "^0.16.58",
112
112
  "@stacksjs/ts-md": "^0.1.1",
113
- "@stacksjs/tunnel": "0.75.296",
114
- "@stacksjs/types": "0.75.296",
115
- "@stacksjs/utils": "0.75.296",
116
- "@stacksjs/whois": "0.75.296",
113
+ "@stacksjs/tunnel": "0.75.299",
114
+ "@stacksjs/types": "0.75.299",
115
+ "@stacksjs/utils": "0.75.299",
116
+ "@stacksjs/whois": "0.75.299",
117
117
  "bun-plugin-stx": "0.2.687"
118
118
  },
119
119
  "peerDependencies": {
@@ -129,7 +129,7 @@
129
129
  }
130
130
  },
131
131
  "devDependencies": {
132
- "@stacksjs/validation": "0.75.296",
132
+ "@stacksjs/validation": "0.75.299",
133
133
  "better-dx": "^0.2.24"
134
134
  }
135
135
  }