@stacksjs/actions 0.70.155 → 0.70.157

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/bump.js CHANGED
@@ -2,7 +2,7 @@ import { execSync, log, parseOptions } from "@stacksjs/cli";
2
2
  import { path as p } from "@stacksjs/path";
3
3
  import { versionBump } from "@stacksjs/bumpx";
4
4
  import { generateChangelog, loadLogsmithConfig } from "@stacksjs/logsmith";
5
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
5
+ import { existsSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { join, relative } from "node:path";
7
7
  const options = parseOptions(), allowedBumps = new Set(["patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"]), rawBump = options?.bump?.toString(), bumpArg = rawBump ? allowedBumps.has(rawBump) || /^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(rawBump) ? rawBump : null : null;
8
8
  if (rawBump && !bumpArg)
@@ -126,11 +126,19 @@ async function writeChangelog() {
126
126
  await writeChangelog();
127
127
  if (!isDryRun && isFrameworkRelease)
128
128
  pinMetaCoreDeps(nextVersion);
129
- if (!isDryRun && existsSync(p.projectPath("bun.lock")))
130
- await execSync(["bun", "install", "--lockfile-only"], {
131
- cwd: p.projectPath(),
132
- stdin: "inherit"
133
- });
129
+ if (!isDryRun && existsSync(p.projectPath("bun.lock"))) {
130
+ const lockPath = p.projectPath("bun.lock"), previousLock = readFileSync(lockPath);
131
+ unlinkSync(lockPath);
132
+ try {
133
+ await execSync(["bun", "install", "--lockfile-only"], {
134
+ cwd: p.projectPath(),
135
+ stdin: "inherit"
136
+ });
137
+ } catch (error) {
138
+ writeFileSync(lockPath, previousLock);
139
+ throw error;
140
+ }
141
+ }
134
142
  function pinMetaCoreDeps(version) {
135
143
  const metaPath = p.frameworkPath("core/package.json"), meta = JSON.parse(readFileSync(metaPath, "utf-8"));
136
144
  let pinned = 0;
@@ -1,3 +1,16 @@
1
+ /**
2
+ * The first upgrade process records the real file changes, then restarts itself
3
+ * after replacing its own framework code. The restarted process sees the
4
+ * already-synced tree as unchanged, but it still owns the post-sync work that
5
+ * the first process intentionally deferred.
6
+ */
7
+ export declare function shouldRunPostSyncHooks(changeCount: number, alreadyRestarted: boolean): boolean;
8
+ /**
9
+ * A restarted process cannot reconstruct whether a package manifest changed
10
+ * during the parent sync. Refreshing dependencies is the safe, idempotent
11
+ * choice whenever post-sync work crosses that process boundary.
12
+ */
13
+ export declare function shouldRefreshPostSyncDependencies(corePackageChanged: boolean, alreadyRestarted: boolean): boolean;
1
14
  /**
2
15
  * Run the migration hook after a vendored framework upgrade.
3
16
  *
@@ -1,3 +1,9 @@
1
+ export function shouldRunPostSyncHooks(changeCount, alreadyRestarted) {
2
+ return changeCount > 0 || alreadyRestarted;
3
+ }
4
+ export function shouldRefreshPostSyncDependencies(corePackageChanged, alreadyRestarted) {
5
+ return corePackageChanged || alreadyRestarted;
6
+ }
1
7
  export async function runPostSyncMigration(options) {
2
8
  const code = await options.spawn({
3
9
  cmd: [options.bunExecutable, options.migrateScript, "migrate", "--force"],
@@ -25,7 +25,11 @@ import {
25
25
  writeChannel,
26
26
  writeSyncedVersion
27
27
  } from "./framework-utils";
28
- import { runPostSyncMigration } from "./framework-hooks";
28
+ import {
29
+ runPostSyncMigration,
30
+ shouldRefreshPostSyncDependencies,
31
+ shouldRunPostSyncHooks
32
+ } from "./framework-hooks";
29
33
  const options = parseOptions(), projectRoot = p.projectPath();
30
34
  if (!existsSync(p.projectPath("storage/framework/core"))) {
31
35
  const { upgradeStacksPackages } = await import("./packages");
@@ -125,7 +129,7 @@ for (const { managed, summary } of perPath)
125
129
  const runHooks = !options.noPostinstall && options.postinstall !== !1;
126
130
  if (runHooks)
127
131
  try {
128
- await runPostSyncHooks({ aggregate, perPath, projectRoot });
132
+ await runPostSyncHooks({ aggregate, perPath, projectRoot, alreadyRestarted });
129
133
  } catch (err) {
130
134
  console.error(`Post-sync hooks failed: ${err?.message || err}`);
131
135
  process.exit(ExitCode.FatalError);
@@ -395,8 +399,8 @@ async function syncRootFilesFromGitHub(ref) {
395
399
  }
396
400
  }
397
401
  async function runPostSyncHooks(args) {
398
- const { aggregate, perPath, projectRoot } = args;
399
- if (aggregate.added + aggregate.changed + aggregate.removed === 0) {
402
+ const { aggregate, perPath, projectRoot, alreadyRestarted } = args, changeCount = aggregate.added + aggregate.changed + aggregate.removed;
403
+ if (!shouldRunPostSyncHooks(changeCount, alreadyRestarted)) {
400
404
  console.log("Nothing changed \u2014 skipping post-sync hooks.");
401
405
  return;
402
406
  }
@@ -407,7 +411,7 @@ async function runPostSyncHooks(args) {
407
411
  } catch (err) {
408
412
  console.warn(` auto-imports failed (non-fatal): ${err?.message || err}`);
409
413
  }
410
- if (perPath.some((entry) => {
414
+ if (shouldRefreshPostSyncDependencies(perPath.some((entry) => {
411
415
  const { managed, summary } = entry;
412
416
  if (managed.isFile)
413
417
  return !1;
@@ -416,7 +420,7 @@ async function runPostSyncHooks(args) {
416
420
  if (summary.added + summary.changed === 0)
417
421
  return !1;
418
422
  return pkgJsonInTree(join(projectRoot, managed.localPath));
419
- })) {
423
+ }), alreadyRestarted)) {
420
424
  console.log("Running `bun install` to refresh dependencies...");
421
425
  try {
422
426
  const code = await Bun.spawn({
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.155",
5
+ "version": "0.70.157",
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.155",
65
+ "@stacksjs/config": "0.70.157",
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.155",
74
- "@stacksjs/cli": "0.70.155",
75
- "@stacksjs/config": "0.70.155",
76
- "@stacksjs/database": "0.70.155",
73
+ "@stacksjs/api": "0.70.157",
74
+ "@stacksjs/cli": "0.70.157",
75
+ "@stacksjs/config": "0.70.157",
76
+ "@stacksjs/database": "0.70.157",
77
77
  "@stacksjs/tlsx": "^0.13.2",
78
78
  "better-dx": "^0.2.17",
79
- "@stacksjs/dns": "0.70.155",
80
- "@stacksjs/enums": "0.70.155",
81
- "@stacksjs/env": "0.70.155",
82
- "@stacksjs/error-handling": "0.70.155",
83
- "@stacksjs/logging": "0.70.155",
84
- "@stacksjs/path": "0.70.155",
85
- "@stacksjs/security": "0.70.155",
86
- "@stacksjs/storage": "0.70.155",
87
- "@stacksjs/strings": "0.70.155",
88
- "@stacksjs/utils": "0.70.155",
89
- "@stacksjs/validation": "0.70.155"
79
+ "@stacksjs/dns": "0.70.157",
80
+ "@stacksjs/enums": "0.70.157",
81
+ "@stacksjs/env": "0.70.157",
82
+ "@stacksjs/error-handling": "0.70.157",
83
+ "@stacksjs/logging": "0.70.157",
84
+ "@stacksjs/path": "0.70.157",
85
+ "@stacksjs/security": "0.70.157",
86
+ "@stacksjs/storage": "0.70.157",
87
+ "@stacksjs/strings": "0.70.157",
88
+ "@stacksjs/utils": "0.70.157",
89
+ "@stacksjs/validation": "0.70.157"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "pickier": "^0.1.35"