From 6b3f554103fc7e14418f0d6b12750cc4aa245c82 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Tue, 31 Mar 2026 03:16:30 +0800 Subject: [PATCH] fix(ci): make bun checks path-safe across runners --- META.generate.js | 5 +++-- META.run.js | 3 ++- META.test.js | 5 ++++- workflow.test.js | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/META.generate.js b/META.generate.js index ba6f885..9acccdd 100644 --- a/META.generate.js +++ b/META.generate.js @@ -1,9 +1,10 @@ const fs = require("node:fs"); +const path = require("node:path"); const vm = require("node:vm"); const yaml = require("yaml"); function loadMain() { - const content = fs.readFileSync("./META.js", "utf8"); + const content = fs.readFileSync(path.join(__dirname, "META.js"), "utf8"); const wrapped = `${content} module.exports = { main };`; @@ -28,7 +29,7 @@ function main() { throw new Error(config.error); } - fs.writeFileSync("./META.yaml", yaml.stringify(config)); + fs.writeFileSync(path.join(__dirname, "META.yaml"), yaml.stringify(config)); console.log("Generated META.yaml"); } diff --git a/META.run.js b/META.run.js index a7f7f0b..3d73cee 100644 --- a/META.run.js +++ b/META.run.js @@ -1,8 +1,9 @@ const fs = require("node:fs"); +const path = require("node:path"); const vm = require("node:vm"); function loadMetaModule() { - const content = fs.readFileSync("./META.js", "utf8"); + const content = fs.readFileSync(path.join(__dirname, "META.js"), "utf8"); const wrapped = `${content} module.exports = { diff --git a/META.test.js b/META.test.js index a49fb30..5b61e67 100644 --- a/META.test.js +++ b/META.test.js @@ -1,10 +1,13 @@ const test = require("node:test"); const assert = require("node:assert/strict"); const fs = require("node:fs"); +const path = require("node:path"); const vm = require("node:vm"); +const repoRoot = __dirname; + function loadMetaModule() { - const content = fs.readFileSync("E:/github/meta/META.js", "utf8"); + const content = fs.readFileSync(path.join(repoRoot, "META.js"), "utf8"); const wrapped = `${content} module.exports = { diff --git a/workflow.test.js b/workflow.test.js index 8f97640..239ba69 100644 --- a/workflow.test.js +++ b/workflow.test.js @@ -4,7 +4,7 @@ const fs = require("node:fs"); const path = require("node:path"); const childProcess = require("node:child_process"); -const repoRoot = "E:/github/meta"; +const repoRoot = __dirname; const workflowPath = path.join(repoRoot, ".github", "workflows", "run.yml"); const runScriptPath = path.join(repoRoot, "META.run.js");