@stacksjs/actions 0.70.193 → 0.70.194
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 +22 -0
- package/dist/upgrade/packages.js +86 -4
- package/package.json +18 -18
|
@@ -17,6 +17,21 @@ export declare function applyBumps(pkg: PkgJson, target: string, lockstep: Set<s
|
|
|
17
17
|
* Handles resolution, package.json rewrite, and reinstall; then `process.exit`s.
|
|
18
18
|
*/
|
|
19
19
|
export declare function upgradeStacksPackages(projectRoot: string, options: PackageUpgradeOptions): Promise<never>;
|
|
20
|
+
/**` pointed at them by workspace
|
|
21
|
+
* reference. Delete that directory to move onto published packages and those
|
|
22
|
+
* references resolve to nothing: `bun install` fails outright with
|
|
23
|
+
* "@stacksjs/utils@workspace:* failed to resolve", and the app cannot install
|
|
24
|
+
* at all until every one of them is rewritten by hand.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveManifestSpec(name: string, spec: string, target: string): string | null;
|
|
27
|
+
/*` dependencies, and an upgrade that ignores them leaves the app
|
|
28
|
+
* describing two different framework versions at once - or, after a vendored
|
|
29
|
+
* core is removed, unable to install.
|
|
30
|
+
*
|
|
31
|
+
* Returns what changed so the caller can report it. Writes nothing when
|
|
32
|
+
* `dryRun` is set.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reconcileVendoredManifests(projectRoot: string, target: string, options?: { dryRun?: boolean }): ManifestChange[];
|
|
20
35
|
export declare interface PackageUpgradeOptions {
|
|
21
36
|
version?: string
|
|
22
37
|
canary?: boolean
|
|
@@ -30,3 +45,10 @@ declare interface PkgJson {
|
|
|
30
45
|
devDependencies?: Record<string, string>
|
|
31
46
|
[key: string]: unknown
|
|
32
47
|
}
|
|
48
|
+
/** One manifest the reconcile rewrote, for reporting. */
|
|
49
|
+
export declare interface ManifestChange {
|
|
50
|
+
file: string
|
|
51
|
+
name: string
|
|
52
|
+
from: string
|
|
53
|
+
to: string
|
|
54
|
+
}
|
package/dist/upgrade/packages.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { runCommand } from "@stacksjs/cli";
|
|
5
5
|
export function hasStacksDependency(pkg) {
|
|
@@ -95,8 +95,8 @@ export async function upgradeStacksPackages(projectRoot, options) {
|
|
|
95
95
|
if (current)
|
|
96
96
|
console.log(` current \`stacks\` constraint: ${current}
|
|
97
97
|
`);
|
|
98
|
-
const lockstep = lockstepPackages(metaDeps, target), changes = applyBumps(pkg, target, lockstep);
|
|
99
|
-
if (changes.length === 0 && !options.force) {
|
|
98
|
+
const lockstep = lockstepPackages(metaDeps, target), changes = applyBumps(pkg, target, lockstep), manifestChanges = reconcileVendoredManifests(projectRoot, target, { dryRun: options.dryRun });
|
|
99
|
+
if (changes.length === 0 && manifestChanges.length === 0 && !options.force) {
|
|
100
100
|
console.log(`\u2714 Already up to date \u2014 every framework dependency matches the target.
|
|
101
101
|
`);
|
|
102
102
|
process.exit(0);
|
|
@@ -108,6 +108,13 @@ export async function upgradeStacksPackages(projectRoot, options) {
|
|
|
108
108
|
console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to}`);
|
|
109
109
|
console.log("");
|
|
110
110
|
}
|
|
111
|
+
if (manifestChanges.length > 0) {
|
|
112
|
+
console.log(` Vendored manifests under storage/framework (${manifestChanges.length}):`);
|
|
113
|
+
const width = Math.max(...manifestChanges.map((c) => c.name.length));
|
|
114
|
+
for (const c of manifestChanges)
|
|
115
|
+
console.log(` ${c.name.padEnd(width)} ${c.from} \u2192 ${c.to} ${c.file}`);
|
|
116
|
+
console.log("");
|
|
117
|
+
}
|
|
111
118
|
if (options.dryRun) {
|
|
112
119
|
console.log(` --dry-run: no files were written and nothing was installed.
|
|
113
120
|
`);
|
|
@@ -138,3 +145,78 @@ export async function upgradeStacksPackages(projectRoot, options) {
|
|
|
138
145
|
`);
|
|
139
146
|
process.exit(0);
|
|
140
147
|
}
|
|
148
|
+
export function resolveManifestSpec(name, spec, target) {
|
|
149
|
+
if (name !== "stacks" && !name.startsWith("@stacksjs/"))
|
|
150
|
+
return null;
|
|
151
|
+
if (spec.startsWith("workspace:"))
|
|
152
|
+
return `^${target}`;
|
|
153
|
+
if (baseVersion(spec) === target)
|
|
154
|
+
return null;
|
|
155
|
+
if (!/^[\^~]?\d/.test(spec))
|
|
156
|
+
return null;
|
|
157
|
+
return `${/^[\^~]/.test(spec) ? spec[0] : ""}${target}`;
|
|
158
|
+
}
|
|
159
|
+
export function reconcileVendoredManifests(projectRoot, target, options = {}) {
|
|
160
|
+
const root = join(projectRoot, "storage/framework");
|
|
161
|
+
if (!existsSync(root))
|
|
162
|
+
return [];
|
|
163
|
+
const changes = [], walk = (dir) => {
|
|
164
|
+
let entries;
|
|
165
|
+
try {
|
|
166
|
+
entries = readdirSync(dir);
|
|
167
|
+
} catch {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
for (const entry of entries) {
|
|
171
|
+
if (entry === "node_modules" || entry === "dist" || entry === ".git")
|
|
172
|
+
continue;
|
|
173
|
+
const full = join(dir, entry);
|
|
174
|
+
let stat;
|
|
175
|
+
try {
|
|
176
|
+
stat = statSync(full);
|
|
177
|
+
} catch {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (stat.isDirectory()) {
|
|
181
|
+
walk(full);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (entry !== "package.json")
|
|
185
|
+
continue;
|
|
186
|
+
let raw;
|
|
187
|
+
try {
|
|
188
|
+
raw = readFileSync(full, "utf-8");
|
|
189
|
+
} catch {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
let pkg;
|
|
193
|
+
try {
|
|
194
|
+
pkg = JSON.parse(raw);
|
|
195
|
+
} catch {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
let touched = !1;
|
|
199
|
+
for (const field of ["dependencies", "devDependencies"]) {
|
|
200
|
+
const deps = pkg[field];
|
|
201
|
+
if (!deps)
|
|
202
|
+
continue;
|
|
203
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
204
|
+
const next = resolveManifestSpec(name, spec, target);
|
|
205
|
+
if (!next)
|
|
206
|
+
continue;
|
|
207
|
+
changes.push({ file: relative(projectRoot, full), name, from: spec, to: next });
|
|
208
|
+
deps[name] = next;
|
|
209
|
+
touched = !0;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (touched && !options.dryRun) {
|
|
213
|
+
const suffix = raw.endsWith(`
|
|
214
|
+
`) ? `
|
|
215
|
+
` : "";
|
|
216
|
+
writeFileSync(full, `${JSON.stringify(pkg, null, 2)}${suffix}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
walk(root);
|
|
221
|
+
return changes;
|
|
222
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.194",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -62,31 +62,31 @@
|
|
|
62
62
|
"prepublishOnly": "bun run build"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@stacksjs/config": "0.70.
|
|
65
|
+
"@stacksjs/config": "0.70.194",
|
|
66
66
|
"@stacksjs/bumpx": "^0.2.6",
|
|
67
67
|
"@stacksjs/bunpress": "^0.1.18",
|
|
68
68
|
"@stacksjs/logsmith": "^0.2.3",
|
|
69
|
-
"@stacksjs/registry": "0.70.
|
|
70
|
-
"@stacksjs/ts-cloud": "^0.7.
|
|
69
|
+
"@stacksjs/registry": "0.70.194",
|
|
70
|
+
"@stacksjs/ts-cloud": "^0.7.78",
|
|
71
71
|
"@stacksjs/ts-md": "^0.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@stacksjs/api": "0.70.
|
|
75
|
-
"@stacksjs/cli": "0.70.
|
|
76
|
-
"@stacksjs/database": "0.70.
|
|
74
|
+
"@stacksjs/api": "0.70.194",
|
|
75
|
+
"@stacksjs/cli": "0.70.194",
|
|
76
|
+
"@stacksjs/database": "0.70.194",
|
|
77
77
|
"@stacksjs/tlsx": "^0.13.2",
|
|
78
78
|
"better-dx": "^0.2.17",
|
|
79
|
-
"@stacksjs/dns": "0.70.
|
|
80
|
-
"@stacksjs/enums": "0.70.
|
|
81
|
-
"@stacksjs/env": "0.70.
|
|
82
|
-
"@stacksjs/error-handling": "0.70.
|
|
83
|
-
"@stacksjs/logging": "0.70.
|
|
84
|
-
"@stacksjs/path": "0.70.
|
|
85
|
-
"@stacksjs/security": "0.70.
|
|
86
|
-
"@stacksjs/storage": "0.70.
|
|
87
|
-
"@stacksjs/strings": "0.70.
|
|
88
|
-
"@stacksjs/utils": "0.70.
|
|
89
|
-
"@stacksjs/validation": "0.70.
|
|
79
|
+
"@stacksjs/dns": "0.70.194",
|
|
80
|
+
"@stacksjs/enums": "0.70.194",
|
|
81
|
+
"@stacksjs/env": "0.70.194",
|
|
82
|
+
"@stacksjs/error-handling": "0.70.194",
|
|
83
|
+
"@stacksjs/logging": "0.70.194",
|
|
84
|
+
"@stacksjs/path": "0.70.194",
|
|
85
|
+
"@stacksjs/security": "0.70.194",
|
|
86
|
+
"@stacksjs/storage": "0.70.194",
|
|
87
|
+
"@stacksjs/strings": "0.70.194",
|
|
88
|
+
"@stacksjs/utils": "0.70.194",
|
|
89
|
+
"@stacksjs/validation": "0.70.194"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"pickier": "^0.1.35"
|