mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 10:50:58 +00:00
fix(dev): rebuild dist after HEAD changes (#56510)
This commit is contained in:
@@ -211,10 +211,10 @@ const shouldBuild = (deps) => {
|
||||
|
||||
const currentHead = resolveGitHead(deps);
|
||||
if (currentHead && !stamp.head) {
|
||||
return hasSourceMtimeChanged(stamp.mtime, deps);
|
||||
return true;
|
||||
}
|
||||
if (currentHead && stamp.head && currentHead !== stamp.head) {
|
||||
return hasSourceMtimeChanged(stamp.mtime, deps);
|
||||
return true;
|
||||
}
|
||||
if (currentHead) {
|
||||
const dirty = hasDirtySourceTree(deps);
|
||||
|
||||
@@ -319,6 +319,27 @@ describe("run-node script", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("rebuilds when git HEAD changes even if source mtimes do not exceed the old build stamp", async () => {
|
||||
await withTempDir(async (tmp) => {
|
||||
await setupTrackedProject(tmp, {
|
||||
files: {
|
||||
[ROOT_SRC]: "export const value = 1;\n",
|
||||
},
|
||||
oldPaths: [ROOT_SRC, ROOT_TSCONFIG, ROOT_PACKAGE],
|
||||
buildPaths: [DIST_ENTRY, BUILD_STAMP],
|
||||
});
|
||||
|
||||
const { spawnCalls, spawn, spawnSync } = createSpawnRecorder({
|
||||
gitHead: "def456\n",
|
||||
gitStatus: "",
|
||||
});
|
||||
const exitCode = await runStatusCommand({ tmp, spawn, spawnSync });
|
||||
|
||||
expect(exitCode).toBe(0);
|
||||
expect(spawnCalls).toEqual([expectedBuildSpawn(), statusCommandSpawn()]);
|
||||
});
|
||||
});
|
||||
|
||||
it("skips rebuilding when extension package metadata is newer than the build stamp", async () => {
|
||||
await withTempDir(async (tmp) => {
|
||||
await setupTrackedProject(tmp, {
|
||||
|
||||
Reference in New Issue
Block a user