@stacksjs/actions 0.72.5 → 0.72.6
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.d.ts +14 -7
- package/dist/upgrade/packages.js +2 -2
- package/package.json +20 -20
|
@@ -23,13 +23,15 @@ export declare function applyBumps(pkg: PkgJson, target: string, lockstep: Set<s
|
|
|
23
23
|
* Handles resolution, package.json rewrite, and reinstall; then `process.exit`s.
|
|
24
24
|
*/
|
|
25
25
|
export declare function upgradeStacksPackages(projectRoot: string, options: PackageUpgradeOptions): Promise<never>;
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
26
|
+
/*` package rides the framework version, though, and the
|
|
27
|
+
* doc above used to describe a guard the code did not have: without `context`
|
|
28
|
+
* this rewrote `@stacksjs/bun-router: ^0.0.20` to `^0.72.4`, a version that
|
|
29
|
+
* package has never published, so the "upgrade" left the app unable to install
|
|
30
|
+
* - the same trap #2078 fixed for the root manifest. Pass `context` and an
|
|
31
|
+
* independently-versioned package takes the meta's declared range instead, or
|
|
32
|
+
* is reported rather than guessed at.
|
|
31
33
|
*/
|
|
32
|
-
export declare function resolveManifestSpec(name: string, spec: string, target: string): string | null;
|
|
34
|
+
export declare function resolveManifestSpec(name: string, spec: string, target: string, context?: ManifestSpecContext): string | null;
|
|
33
35
|
/*` dependencies, and an upgrade that ignores them leaves the app
|
|
34
36
|
* describing two different framework versions at once - or, after a vendored
|
|
35
37
|
* core is removed, unable to install.
|
|
@@ -37,7 +39,7 @@ export declare function resolveManifestSpec(name: string, spec: string, target:
|
|
|
37
39
|
* Returns what changed so the caller can report it. Writes nothing when
|
|
38
40
|
* `dryRun` is set.
|
|
39
41
|
*/
|
|
40
|
-
export declare function reconcileVendoredManifests(projectRoot: string, target: string, options?: { dryRun?: boolean }): ManifestChange[];
|
|
42
|
+
export declare function reconcileVendoredManifests(projectRoot: string, target: string, options?: { dryRun?: boolean, context?: ManifestSpecContext }): ManifestChange[];
|
|
41
43
|
export declare interface PackageUpgradeOptions {
|
|
42
44
|
version?: string
|
|
43
45
|
canary?: boolean
|
|
@@ -58,3 +60,8 @@ export declare interface ManifestChange {
|
|
|
58
60
|
from: string
|
|
59
61
|
to: string
|
|
60
62
|
}
|
|
63
|
+
/** What the framework knows about the target release, for spec decisions. */
|
|
64
|
+
export declare interface ManifestSpecContext {
|
|
65
|
+
lockstep: Set<string>
|
|
66
|
+
metaDeps: Record<string, string>
|
|
67
|
+
}
|
package/dist/upgrade/packages.js
CHANGED
|
@@ -4,7 +4,7 @@ import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";
|
|
|
4
4
|
\u2714 Standalone package dependencies are up to date.
|
|
5
5
|
`);process.exit(0)}async function resolveTarget(options){const res=await fetch("https://registry.npmjs.org/stacks").catch(()=>null);if(!res||!res.ok)throw Error("Could not reach the npm registry to resolve the target `stacks` version.");const meta=await res.json(),distTags=meta["dist-tags"]??{},versions=meta.versions??{};let version;if(options.version){if(!versions[options.version])throw Error(`stacks@${options.version} was not found on the npm registry.`);version=options.version}else{const tag=options.canary?"canary":"latest",resolved=distTags[tag];if(!resolved)throw Error(`The \`${tag}\` dist-tag is not published for \`stacks\`.`);version=resolved}const metaDeps=versions[version]?.dependencies??{};return{version,metaDeps}}export function baseVersion(range){return range.replace(/^[\^~>=<\s]+/,"").trim()}export function lockstepPackages(metaDeps,target){const lockstep=new Set(["stacks"]);for(const[name,range]of Object.entries(metaDeps))if(name.startsWith("@stacksjs/")&&baseVersion(range)===target)lockstep.add(name);return lockstep}export function applyBumps(pkg,target,lockstep){const changes=[];for(const field of["dependencies","devDependencies"]){const deps=pkg[field];if(!deps)continue;for(const[name,spec]of Object.entries(deps)){if(!lockstep.has(name))continue;const next=`${/^[\^~]/.test(spec)?spec[0]:/^\d/.test(spec)?"":"^"}${target}`;if(spec!==next){changes.push({name,from:spec,to:next});deps[name]=next}}}return changes}export async function upgradeStacksPackages(projectRoot,options){const pkgPath=join(projectRoot,"package.json");if(!existsSync(pkgPath)){console.error("No package.json found \u2014 nothing to upgrade.");process.exit(1)}const raw=readFileSync(pkgPath,"utf-8"),pkg=JSON.parse(raw),current=pkg.dependencies?.stacks??pkg.devDependencies?.stacks;if(!hasStacksDependency(pkg))return updateStandalonePackage(projectRoot,options);const{version:target,metaDeps}=await resolveTarget(options).catch((err)=>{console.error(`\u2717 ${err.message}`);process.exit(1)});console.log(`
|
|
6
6
|
Upgrading the Stacks framework${options.canary?" (canary)":""} \u2192 ${target}`);if(current)console.log(` current \`stacks\` constraint: ${current}
|
|
7
|
-
`);const lockstep=lockstepPackages(metaDeps,target),changes=applyBumps(pkg,target,lockstep),projectManifestChanges=migratePackageProjectManifest(pkg),manifestChanges=reconcileVendoredManifests(projectRoot,target,{dryRun:options.dryRun});if(changes.length>0){console.log(" The following dependencies will be updated:");const width=Math.max(...changes.map((c)=>c.name.length));for(const c of changes)console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to}`);console.log("")}if(manifestChanges.length>0){console.log(` Vendored manifests under storage/framework (${manifestChanges.length}):`);const width=Math.max(...manifestChanges.map((c)=>c.name.length));for(const c of manifestChanges)console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to} ${c.file}`);console.log("")}if(projectManifestChanges.length>0)console.log(` Project manifest migrations: ${projectManifestChanges.length}
|
|
7
|
+
`);const lockstep=lockstepPackages(metaDeps,target),changes=applyBumps(pkg,target,lockstep),projectManifestChanges=migratePackageProjectManifest(pkg),manifestChanges=reconcileVendoredManifests(projectRoot,target,{dryRun:options.dryRun,context:{lockstep,metaDeps}});if(changes.length>0){console.log(" The following dependencies will be updated:");const width=Math.max(...changes.map((c)=>c.name.length));for(const c of changes)console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to}`);console.log("")}if(manifestChanges.length>0){console.log(` Vendored manifests under storage/framework (${manifestChanges.length}):`);const width=Math.max(...manifestChanges.map((c)=>c.name.length));for(const c of manifestChanges)console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to} ${c.file}`);console.log("")}if(projectManifestChanges.length>0)console.log(` Project manifest migrations: ${projectManifestChanges.length}
|
|
8
8
|
`);if(options.dryRun){const pending=measureDefaultsDrift(projectRoot);if(pending&&pending.length>0){const installed=installedDefaultsVersion(projectRoot);console.log(` Managed project files, against the installed @stacksjs/defaults${installed?` (${installed})`:""}:`);console.log(` ${summarizeStructureChanges(pending)} in storage/framework/defaults and project support files
|
|
9
9
|
`)}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(`
|
|
@@ -17,6 +17,6 @@ import{existsSync,readdirSync,readFileSync,statSync,writeFileSync}from"node:fs";
|
|
|
17
17
|
\u2714 Already up to date \u2014 dependencies and managed project files match the target.
|
|
18
18
|
`);else console.log(`
|
|
19
19
|
\u2714 Upgraded to stacks@${target}. Review the changelog: https://github.com/stacksjs/stacks/releases/tag/v${target}
|
|
20
|
-
`);process.exit(0)}export function resolveManifestSpec(name,spec,target){if(name!=="stacks"&&!name.startsWith("@stacksjs/"))return null;if(spec.startsWith("workspace:"))return`^${target}`;if(baseVersion(spec)===target)return null;if(!/^[\^~]?\d/.test(spec))return null;return`${/^[\^~]/.test(spec)?spec[0]:""}${target}`}export function reconcileVendoredManifests(projectRoot,target,options={}){const root=join(projectRoot,"storage/framework");if(!existsSync(root))return[];const changes=[],walk=(dir)=>{let entries;try{entries=readdirSync(dir)}catch{return}for(const entry of entries){if(entry==="node_modules"||entry==="dist"||entry===".git")continue;const full=join(dir,entry);let stat;try{stat=statSync(full)}catch{continue}if(stat.isDirectory()){walk(full);continue}if(entry!=="package.json")continue;let raw;try{raw=readFileSync(full,"utf-8")}catch{continue}let pkg;try{pkg=JSON.parse(raw)}catch{continue}let touched=!1;for(const field of["dependencies","devDependencies"]){const deps=pkg[field];if(!deps)continue;for(const[name,spec]of Object.entries(deps)){const next=resolveManifestSpec(name,spec,target);if(!next)continue;changes.push({file:relative(projectRoot,full),name,from:spec,to:next});deps[name]=next;touched=!0}}if(touched&&!options.dryRun){const suffix=raw.endsWith(`
|
|
20
|
+
`);process.exit(0)}export function resolveManifestSpec(name,spec,target,context){if(name!=="stacks"&&!name.startsWith("@stacksjs/"))return null;if(context&&!context.lockstep.has(name)){const declared=context.metaDeps[name];if(!declared)return null;return baseVersion(declared)===baseVersion(spec)?null:declared}if(spec.startsWith("workspace:"))return`^${target}`;if(baseVersion(spec)===target)return null;if(!/^[\^~]?\d/.test(spec))return null;return`${/^[\^~]/.test(spec)?spec[0]:""}${target}`}export function reconcileVendoredManifests(projectRoot,target,options={}){const root=join(projectRoot,"storage/framework");if(!existsSync(root))return[];const changes=[],walk=(dir)=>{let entries;try{entries=readdirSync(dir)}catch{return}for(const entry of entries){if(entry==="node_modules"||entry==="dist"||entry===".git")continue;const full=join(dir,entry);let stat;try{stat=statSync(full)}catch{continue}if(stat.isDirectory()){walk(full);continue}if(entry!=="package.json")continue;let raw;try{raw=readFileSync(full,"utf-8")}catch{continue}let pkg;try{pkg=JSON.parse(raw)}catch{continue}let touched=!1;for(const field of["dependencies","devDependencies"]){const deps=pkg[field];if(!deps)continue;for(const[name,spec]of Object.entries(deps)){const next=resolveManifestSpec(name,spec,target,options.context);if(!next)continue;changes.push({file:relative(projectRoot,full),name,from:spec,to:next});deps[name]=next;touched=!0}}if(touched&&!options.dryRun){const suffix=raw.endsWith(`
|
|
21
21
|
`)?`
|
|
22
22
|
`:"";writeFileSync(full,`${JSON.stringify(pkg,null,2)}${suffix}`)}}};walk(root);return changes}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.72.
|
|
5
|
+
"version": "0.72.6",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -59,36 +59,36 @@
|
|
|
59
59
|
"prepublishOnly": "bun run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@stacksjs/config": "0.72.
|
|
62
|
+
"@stacksjs/config": "0.72.6",
|
|
63
63
|
"@stacksjs/bumpx": "^0.2.6",
|
|
64
64
|
"@stacksjs/bunpress": "^0.2.6",
|
|
65
65
|
"@stacksjs/logsmith": "^0.2.3",
|
|
66
|
-
"@stacksjs/registry": "0.72.
|
|
66
|
+
"@stacksjs/registry": "0.72.6",
|
|
67
67
|
"@stacksjs/stx": "^0.2.184",
|
|
68
68
|
"@stacksjs/ts-cloud": "^0.8.3",
|
|
69
69
|
"@stacksjs/ts-md": "^0.1.1",
|
|
70
70
|
"craft-native": ">=0.0.55"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@stacksjs/api": "0.72.
|
|
74
|
-
"@stacksjs/cli": "0.72.
|
|
75
|
-
"@stacksjs/database": "0.72.
|
|
73
|
+
"@stacksjs/api": "0.72.6",
|
|
74
|
+
"@stacksjs/cli": "0.72.6",
|
|
75
|
+
"@stacksjs/database": "0.72.6",
|
|
76
76
|
"@stacksjs/tlsx": "^0.13.2",
|
|
77
77
|
"better-dx": "^0.2.23",
|
|
78
|
-
"@stacksjs/dns": "0.72.
|
|
79
|
-
"@stacksjs/enums": "0.72.
|
|
80
|
-
"@stacksjs/env": "0.72.
|
|
81
|
-
"@stacksjs/error-handling": "0.72.
|
|
82
|
-
"@stacksjs/image": "0.72.
|
|
83
|
-
"@stacksjs/logging": "0.72.
|
|
84
|
-
"@stacksjs/path": "0.72.
|
|
85
|
-
"@stacksjs/security": "0.72.
|
|
86
|
-
"@stacksjs/cms": "0.72.
|
|
87
|
-
"@stacksjs/sites": "0.72.
|
|
88
|
-
"@stacksjs/storage": "0.72.
|
|
89
|
-
"@stacksjs/strings": "0.72.
|
|
90
|
-
"@stacksjs/utils": "0.72.
|
|
91
|
-
"@stacksjs/validation": "0.72.
|
|
78
|
+
"@stacksjs/dns": "0.72.6",
|
|
79
|
+
"@stacksjs/enums": "0.72.6",
|
|
80
|
+
"@stacksjs/env": "0.72.6",
|
|
81
|
+
"@stacksjs/error-handling": "0.72.6",
|
|
82
|
+
"@stacksjs/image": "0.72.6",
|
|
83
|
+
"@stacksjs/logging": "0.72.6",
|
|
84
|
+
"@stacksjs/path": "0.72.6",
|
|
85
|
+
"@stacksjs/security": "0.72.6",
|
|
86
|
+
"@stacksjs/cms": "0.72.6",
|
|
87
|
+
"@stacksjs/sites": "0.72.6",
|
|
88
|
+
"@stacksjs/storage": "0.72.6",
|
|
89
|
+
"@stacksjs/strings": "0.72.6",
|
|
90
|
+
"@stacksjs/utils": "0.72.6",
|
|
91
|
+
"@stacksjs/validation": "0.72.6"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"pickier": "^0.1.35"
|