@stacksjs/actions 0.70.153 → 0.70.154

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Run the migration hook after a vendored framework upgrade.
3
+ *
4
+ * The upgrade command is already an explicit request to install and activate
5
+ * the new framework. Its nested migration must therefore never open a second
6
+ * confirmation prompt. Ignoring stdin makes that contract structural, while
7
+ * `--force` bypasses both migration confirmation gates. A nonzero exit is a
8
+ * real upgrade failure so callers cannot report success with an unapplied
9
+ * schema.
10
+ */
11
+ export declare function runPostSyncMigration(options: PostSyncMigrationOptions): Promise<void>;
12
+ declare interface PostSyncSpawnOptions {
13
+ cmd: string[]
14
+ cwd: string
15
+ stdin: 'ignore'
16
+ stdout: 'inherit'
17
+ stderr: 'inherit'
18
+ }
19
+ declare interface PostSyncMigrationOptions {
20
+ bunExecutable: string
21
+ migrateScript: string
22
+ projectRoot: string
23
+ spawn: PostSyncSpawn
24
+ }
25
+ declare type PostSyncSpawn = (options: PostSyncSpawnOptions) => { exited: Promise<number> }
@@ -0,0 +1,11 @@
1
+ export async function runPostSyncMigration(options) {
2
+ const code = await options.spawn({
3
+ cmd: [options.bunExecutable, options.migrateScript, "migrate", "--force"],
4
+ cwd: options.projectRoot,
5
+ stdin: "ignore",
6
+ stdout: "inherit",
7
+ stderr: "inherit"
8
+ }).exited;
9
+ if (code !== 0)
10
+ throw Error(`Post-upgrade migration exited with code ${code}.`);
11
+ }
@@ -24,6 +24,7 @@ import {
24
24
  writeChannel,
25
25
  writeSyncedVersion
26
26
  } from "./framework-utils";
27
+ import { runPostSyncMigration } from "./framework-hooks";
27
28
  const options = parseOptions(), projectRoot = p.projectPath();
28
29
  if (!existsSync(p.projectPath("storage/framework/core"))) {
29
30
  const { upgradeStacksPackages } = await import("./packages");
@@ -121,7 +122,12 @@ for (const { managed, summary } of perPath)
121
122
  console.log(` ${managed.label.padEnd(10)} +${summary.added} ~${summary.changed} -${summary.removed} (${summary.unchanged} unchanged)`);
122
123
  const runHooks = !options.noPostinstall && options.postinstall !== !1;
123
124
  if (runHooks)
124
- await runPostSyncHooks({ aggregate, perPath, projectRoot });
125
+ try {
126
+ await runPostSyncHooks({ aggregate, perPath, projectRoot });
127
+ } catch (err) {
128
+ console.error(`Post-sync hooks failed: ${err?.message || err}`);
129
+ process.exit(ExitCode.FatalError);
130
+ }
125
131
  if (ctx.channel === "canary" && !ctx.targetVersion)
126
132
  console.warn("\u26A0 Canary builds may contain bugs or breaking changes. Not recommended for production.");
127
133
  process.exit(ExitCode.Success);
@@ -426,18 +432,13 @@ async function runPostSyncHooks(args) {
426
432
  const migrationsDir = join(projectRoot, "database", "migrations");
427
433
  if (existsSync(migrationsDir)) {
428
434
  console.log("Running pending migrations...");
429
- try {
430
- const migrateScript = p.frameworkPath("core/buddy/src/cli.ts"), code = await Bun.spawn({
431
- cmd: [process.argv[0] || "bun", migrateScript, "migrate"],
432
- cwd: projectRoot,
433
- stdout: "inherit",
434
- stderr: "inherit"
435
- }).exited;
436
- if (code !== 0)
437
- console.warn(` migrate exited with code ${code} (non-fatal \u2014 DB may not be set up yet)`);
438
- } catch (err) {
439
- console.warn(` migrate failed (non-fatal): ${err?.message || err}`);
440
- }
435
+ const migrateScript = p.frameworkPath("core/buddy/src/cli.ts");
436
+ await runPostSyncMigration({
437
+ bunExecutable: process.argv[0] || "bun",
438
+ migrateScript,
439
+ projectRoot,
440
+ spawn: (spawnOptions) => Bun.spawn(spawnOptions)
441
+ });
441
442
  }
442
443
  }
443
444
  function pkgJsonInTree(dir) {
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.153",
5
+ "version": "0.70.154",
6
6
  "description": "The Stacks actions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -62,7 +62,7 @@
62
62
  "prepublishOnly": "bun run build"
63
63
  },
64
64
  "dependencies": {
65
- "@stacksjs/config": "0.70.153",
65
+ "@stacksjs/config": "0.70.154",
66
66
  "@stacksjs/bumpx": "^0.2.6",
67
67
  "@stacksjs/bunpress": "^0.1.12",
68
68
  "@stacksjs/logsmith": "^0.2.3",
@@ -70,23 +70,23 @@
70
70
  "@stacksjs/ts-md": "^0.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@stacksjs/api": "0.70.153",
74
- "@stacksjs/cli": "0.70.153",
75
- "@stacksjs/config": "0.70.153",
76
- "@stacksjs/database": "0.70.153",
73
+ "@stacksjs/api": "0.70.154",
74
+ "@stacksjs/cli": "0.70.154",
75
+ "@stacksjs/config": "0.70.154",
76
+ "@stacksjs/database": "0.70.154",
77
77
  "@stacksjs/tlsx": "^0.13.2",
78
78
  "better-dx": "^0.2.17",
79
- "@stacksjs/dns": "0.70.153",
80
- "@stacksjs/enums": "0.70.153",
81
- "@stacksjs/env": "0.70.153",
82
- "@stacksjs/error-handling": "0.70.153",
83
- "@stacksjs/logging": "0.70.153",
84
- "@stacksjs/path": "0.70.153",
85
- "@stacksjs/security": "0.70.153",
86
- "@stacksjs/storage": "0.70.153",
87
- "@stacksjs/strings": "0.70.153",
88
- "@stacksjs/utils": "0.70.153",
89
- "@stacksjs/validation": "0.70.153"
79
+ "@stacksjs/dns": "0.70.154",
80
+ "@stacksjs/enums": "0.70.154",
81
+ "@stacksjs/env": "0.70.154",
82
+ "@stacksjs/error-handling": "0.70.154",
83
+ "@stacksjs/logging": "0.70.154",
84
+ "@stacksjs/path": "0.70.154",
85
+ "@stacksjs/security": "0.70.154",
86
+ "@stacksjs/storage": "0.70.154",
87
+ "@stacksjs/strings": "0.70.154",
88
+ "@stacksjs/utils": "0.70.154",
89
+ "@stacksjs/validation": "0.70.154"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "pickier": "^0.1.35"