@stacksjs/actions 0.75.602 → 0.75.604
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.
- package/dist/upgrade/packages.js +2 -2
- package/package.json +42 -42
package/dist/upgrade/packages.js
CHANGED
|
@@ -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{buddyOptionArgs,runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{runPostSyncAiRefresh,runPostSyncDatabaseTypesRefresh}from"./framework-hooks";import{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=false){if(!/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(target))throw new 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");const installed=JSON.parse(readFileSync(join(metaRoot,"package.json"),"utf8"));if(installed.version!==target)return true;const projectPath=join(projectRoot,"package.json");const project=existsSync(projectPath)?JSON.parse(readFileSync(projectPath,"utf8")):{};const publishedRange=/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/;const customResolution=(name)=>{const rule=project.overrides?.[name]??project.resolutions?.[name];return rule!==undefined&&(typeof rule!=="string"||!publishedRange.test(rule))};const lockPath=join(projectRoot,"bun.lock");if(existsSync(lockPath)){const lock=Bun.JSONC.parse(readFileSync(lockPath,"utf8"));if(lock.packages?.stacks?.[0]!==`stacks@${target}`)return true}for(const[name,version]of Object.entries(installed.dependencies??{})){if(!name.startsWith("@stacksjs/")||version!==target||customResolution(name))continue;const manifest=JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,metaRoot),"utf8"));if(manifest.version!==target)return true}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;const manifest=JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,projectRoot),"utf8"));if(manifest.version!==baseVersion(version))return true}}return false}catch{return true}}async function updateStandalonePackage(projectRoot,options){console.log(`
|
|
1
|
+
import{existsSync,lstatSync,readdirSync,readFileSync,writeFileSync}from"node:fs";import{isAbsolute,join,relative}from"node:path";import process from"node:process";import{buddyOptionArgs,runCommand}from"@stacksjs/cli";import{installedDefaultsVersion}from"@stacksjs/path";import{runPostSyncAiRefresh,runPostSyncDatabaseTypesRefresh}from"./framework-hooks";import{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=false){if(!/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(target))throw new 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");const installed=JSON.parse(readFileSync(join(metaRoot,"package.json"),"utf8"));if(installed.version!==target)return true;const projectPath=join(projectRoot,"package.json");const project=existsSync(projectPath)?JSON.parse(readFileSync(projectPath,"utf8")):{};const publishedRange=/^[\^~]?\d+\.\d+\.\d+(?:-[\w.-]+)?$/;const customResolution=(name)=>{const rule=project.overrides?.[name]??project.resolutions?.[name];return rule!==undefined&&(typeof rule!=="string"||!publishedRange.test(rule))};const lockPath=join(projectRoot,"bun.lock");if(existsSync(lockPath)){const lock=Bun.JSONC.parse(readFileSync(lockPath,"utf8"));if(lock.packages?.stacks?.[0]!==`stacks@${target}`)return true}for(const[name,version]of Object.entries(installed.dependencies??{})){if(!name.startsWith("@stacksjs/")||version!==target||customResolution(name))continue;const manifest=JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,metaRoot),"utf8"));if(manifest.version!==target)return true}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;const manifest=JSON.parse(readFileSync(Bun.resolveSync(`${name}/package.json`,projectRoot),"utf8"));if(manifest.version!==baseVersion(version))return true}}return false}catch{return true}}function pantryWorkspaceMetadataStale(projectRoot){const file=join(projectRoot,"pantry.lock");if(!existsSync(file))return false;try{const lock=JSON.parse(readFileSync(file,"utf8"));if(!lock.workspaces||typeof lock.workspaces!=="object"||Array.isArray(lock.workspaces))return true;for(const[workspace,recorded]of Object.entries(lock.workspaces)){if(isAbsolute(workspace)||workspace.split(/[\\/]/).includes(".."))return true;const manifest=JSON.parse(readFileSync(join(projectRoot,workspace,"package.json"),"utf8"));for(const field of["dependencies","devDependencies","optionalDependencies","peerDependencies"]){const entries=(value)=>Object.entries(value??{}).sort(([a],[b])=>a.localeCompare(b));if(JSON.stringify(entries(recorded[field]))!==JSON.stringify(entries(manifest[field])))return true}}return false}catch{return true}}async function refreshPantryWorkspaceMetadata(projectRoot,changed){if(!existsSync(join(projectRoot,"pantry.lock"))||!changed&&!pantryWorkspaceMetadataStale(projectRoot))return;console.log(" Refreshing Pantry workspace metadata with `pantry install --ignore-scripts`...");const result=await runCommand("pantry install --ignore-scripts",{cwd:projectRoot});if(result.isErr||pantryWorkspaceMetadataStale(projectRoot))throw new Error("The framework was installed, but Pantry workspace metadata is not current. Resolve the Pantry install error and re-run buddy upgrade before committing the lockfiles.")}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");return}if(options.noPostinstall){console.log(" --no-postinstall: skipping the dependency refresh. Run `bun update` when ready.\n");return}console.log(` Refreshing declared dependencies...
|
|
3
3
|
`);const result=await runCommand(standalonePackageUpdateCommand(),{cwd:projectRoot});if(result.isErr){console.error("\n✗ The dependency refresh failed. Resolve the reported error and re-run `buddy update`.\n");process.exit(1)}console.log(`
|
|
4
4
|
✔ Standalone package dependencies are up to date.
|
|
@@ -48,7 +48,7 @@ catch (error) {
|
|
|
48
48
|
}
|
|
49
49
|
`;try{const child=Bun.spawn({cmd:["bun","-e",entrypoint],cwd:projectRoot,stdin:"inherit",stdout:"inherit",stderr:"inherit"});const code=await child.exited;if(code!==0)process.exit(code);return}catch(error){console.error(`
|
|
50
50
|
✗ ${error instanceof Error?error.message:String(error)} The installed files are retained; target migrations were not completed.
|
|
51
|
-
`);process.exit(1)}}const defaultsPackageRoot=join(projectRoot,"node_modules/@stacksjs/defaults");const structureChanges=existsSync(join(defaultsPackageRoot,"package.json"))?syncPackageProjectFiles(projectRoot,defaultsPackageRoot):[];const tsconfigChanges=migratePackageProjectTsconfig(projectRoot);const prunedRoutes=reportRouteActions(projectRoot,false);if(structureChanges.length>0||tsconfigChanges.length>0){const added=structureChanges.filter((change)=>change.action==="add").length;const updated=structureChanges.filter((change)=>change.action==="update").length+tsconfigChanges.length;const 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||options.changedBeforeRestart)await regenerateDatabaseTypes(projectRoot);try{await runPostSyncAiRefresh({cli:["./buddy"],projectRoot,spawn:(spawnOptions)=>Bun.spawn(spawnOptions)})}catch(err){console.error(`
|
|
51
|
+
`);process.exit(1)}}const defaultsPackageRoot=join(projectRoot,"node_modules/@stacksjs/defaults");const structureChanges=existsSync(join(defaultsPackageRoot,"package.json"))?syncPackageProjectFiles(projectRoot,defaultsPackageRoot):[];const tsconfigChanges=migratePackageProjectTsconfig(projectRoot);await refreshPantryWorkspaceMetadata(projectRoot,Boolean(options.changedBeforeRestart||changes.length||manifestChanges.length||projectManifestChanges.length));if(needsFrameworkInstall(projectRoot,target,installedPins))throw new Error(`The dependency refresh did not preserve stacks@${target} and its published cohort. Re-run buddy upgrade before committing the lockfiles.`);const prunedRoutes=reportRouteActions(projectRoot,false);if(structureChanges.length>0||tsconfigChanges.length>0){const added=structureChanges.filter((change)=>change.action==="add").length;const updated=structureChanges.filter((change)=>change.action==="update").length+tsconfigChanges.length;const 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||options.changedBeforeRestart)await regenerateDatabaseTypes(projectRoot);try{await runPostSyncAiRefresh({cli:["./buddy"],projectRoot,spawn:(spawnOptions)=>Bun.spawn(spawnOptions)})}catch(err){console.error(`
|
|
52
52
|
✗ ${err.message}
|
|
53
53
|
`);process.exit(1)}const didChange=changes.length>0||options.changedBeforeRestart||manifestChanges.length>0||projectManifestChanges.length>0||dependenciesNeedInstall||structureChanges.length>0||tsconfigChanges.length>0||prunedRoutes>0;if(!didChange&&!options.force)console.log(`
|
|
54
54
|
✔ 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.
|
|
5
|
+
"version": "0.75.604",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -68,55 +68,55 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@babel/parser": "^8.1.2",
|
|
70
70
|
"@babel/types": "^8.1.2",
|
|
71
|
-
"@stacksjs/action-runner": "0.75.
|
|
72
|
-
"@stacksjs/ai": "0.75.
|
|
73
|
-
"@stacksjs/analytics": "0.75.
|
|
74
|
-
"@stacksjs/api": "0.75.
|
|
75
|
-
"@stacksjs/auth": "0.75.
|
|
76
|
-
"@stacksjs/build": "0.75.
|
|
71
|
+
"@stacksjs/action-runner": "0.75.604",
|
|
72
|
+
"@stacksjs/ai": "0.75.604",
|
|
73
|
+
"@stacksjs/analytics": "0.75.604",
|
|
74
|
+
"@stacksjs/api": "0.75.604",
|
|
75
|
+
"@stacksjs/auth": "0.75.604",
|
|
76
|
+
"@stacksjs/build": "0.75.604",
|
|
77
77
|
"@stacksjs/bumpx": "^0.2.32",
|
|
78
78
|
"@stacksjs/bunpress": "^0.2.15",
|
|
79
|
-
"@stacksjs/cli": "0.75.
|
|
80
|
-
"@stacksjs/cloud": "0.75.
|
|
81
|
-
"@stacksjs/cms": "0.75.
|
|
79
|
+
"@stacksjs/cli": "0.75.604",
|
|
80
|
+
"@stacksjs/cloud": "0.75.604",
|
|
81
|
+
"@stacksjs/cms": "0.75.604",
|
|
82
82
|
"@stacksjs/components": "^0.2.889",
|
|
83
|
-
"@stacksjs/config": "0.75.
|
|
84
|
-
"@stacksjs/database": "0.75.
|
|
85
|
-
"@stacksjs/desktop-build": "0.75.
|
|
86
|
-
"@stacksjs/dns": "0.75.
|
|
87
|
-
"@stacksjs/docs": "0.75.
|
|
88
|
-
"@stacksjs/enums": "0.75.
|
|
89
|
-
"@stacksjs/env": "0.75.
|
|
90
|
-
"@stacksjs/error-handling": "0.75.
|
|
91
|
-
"@stacksjs/github": "0.75.
|
|
83
|
+
"@stacksjs/config": "0.75.604",
|
|
84
|
+
"@stacksjs/database": "0.75.604",
|
|
85
|
+
"@stacksjs/desktop-build": "0.75.604",
|
|
86
|
+
"@stacksjs/dns": "0.75.604",
|
|
87
|
+
"@stacksjs/docs": "0.75.604",
|
|
88
|
+
"@stacksjs/enums": "0.75.604",
|
|
89
|
+
"@stacksjs/env": "0.75.604",
|
|
90
|
+
"@stacksjs/error-handling": "0.75.604",
|
|
91
|
+
"@stacksjs/github": "0.75.604",
|
|
92
92
|
"@stacksjs/gitit": "^0.2.5",
|
|
93
|
-
"@stacksjs/i18n": "0.75.
|
|
94
|
-
"@stacksjs/image": "0.75.
|
|
95
|
-
"@stacksjs/logging": "0.75.
|
|
93
|
+
"@stacksjs/i18n": "0.75.604",
|
|
94
|
+
"@stacksjs/image": "0.75.604",
|
|
95
|
+
"@stacksjs/logging": "0.75.604",
|
|
96
96
|
"@stacksjs/logsmith": "^0.2.11",
|
|
97
|
-
"@stacksjs/mobile": "0.75.
|
|
98
|
-
"@stacksjs/orm": "0.75.
|
|
99
|
-
"@stacksjs/path": "0.75.
|
|
100
|
-
"@stacksjs/payments": "0.75.
|
|
101
|
-
"@stacksjs/queue": "0.75.
|
|
102
|
-
"@stacksjs/registry": "0.75.
|
|
103
|
-
"@stacksjs/router": "0.75.
|
|
97
|
+
"@stacksjs/mobile": "0.75.604",
|
|
98
|
+
"@stacksjs/orm": "0.75.604",
|
|
99
|
+
"@stacksjs/path": "0.75.604",
|
|
100
|
+
"@stacksjs/payments": "0.75.604",
|
|
101
|
+
"@stacksjs/queue": "0.75.604",
|
|
102
|
+
"@stacksjs/registry": "0.75.604",
|
|
103
|
+
"@stacksjs/router": "0.75.604",
|
|
104
104
|
"@stacksjs/rpx": "^0.11.54",
|
|
105
|
-
"@stacksjs/scheduler": "0.75.
|
|
106
|
-
"@stacksjs/search-engine": "0.75.
|
|
107
|
-
"@stacksjs/security": "0.75.
|
|
108
|
-
"@stacksjs/server": "0.75.
|
|
109
|
-
"@stacksjs/sites": "0.75.
|
|
110
|
-
"@stacksjs/storage": "0.75.
|
|
111
|
-
"@stacksjs/strings": "0.75.
|
|
105
|
+
"@stacksjs/scheduler": "0.75.604",
|
|
106
|
+
"@stacksjs/search-engine": "0.75.604",
|
|
107
|
+
"@stacksjs/security": "0.75.604",
|
|
108
|
+
"@stacksjs/server": "0.75.604",
|
|
109
|
+
"@stacksjs/sites": "0.75.604",
|
|
110
|
+
"@stacksjs/storage": "0.75.604",
|
|
111
|
+
"@stacksjs/strings": "0.75.604",
|
|
112
112
|
"@stacksjs/stx": "^0.2.889",
|
|
113
113
|
"@stacksjs/tlsx": "^0.13.19",
|
|
114
|
-
"@stacksjs/ts-cloud": "^0.16.
|
|
114
|
+
"@stacksjs/ts-cloud": "^0.16.136",
|
|
115
115
|
"@stacksjs/ts-md": "^0.1.1",
|
|
116
|
-
"@stacksjs/tunnel": "0.75.
|
|
117
|
-
"@stacksjs/types": "0.75.
|
|
118
|
-
"@stacksjs/utils": "0.75.
|
|
119
|
-
"@stacksjs/whois": "0.75.
|
|
116
|
+
"@stacksjs/tunnel": "0.75.604",
|
|
117
|
+
"@stacksjs/types": "0.75.604",
|
|
118
|
+
"@stacksjs/utils": "0.75.604",
|
|
119
|
+
"@stacksjs/whois": "0.75.604",
|
|
120
120
|
"bun-plugin-stx": "^0.2.889",
|
|
121
121
|
"pickier": "^0.1.92"
|
|
122
122
|
},
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@stacksjs/validation": "0.75.
|
|
132
|
+
"@stacksjs/validation": "0.75.604",
|
|
133
133
|
"better-dx": "^0.2.39"
|
|
134
134
|
}
|
|
135
135
|
}
|