mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
fix(ci): use Windows-safe formatter spawn
This commit is contained in:
@@ -19,17 +19,22 @@ function readIfExists(filePath: string): string | null {
|
||||
function formatTypeScriptModule(source: string, outputPath: string): string {
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const formatter = spawnSync(
|
||||
process.platform === "win32" ? "pnpm.cmd" : "pnpm",
|
||||
process.platform === "win32" ? "pnpm" : "pnpm",
|
||||
["exec", "oxfmt", "--stdin-filepath", outputPath],
|
||||
{
|
||||
cwd: repoRoot,
|
||||
input: source,
|
||||
encoding: "utf8",
|
||||
// Windows requires a shell to launch package-manager shim scripts reliably.
|
||||
...(process.platform === "win32" ? { shell: true } : {}),
|
||||
},
|
||||
);
|
||||
if (formatter.status !== 0) {
|
||||
const details =
|
||||
formatter.stderr?.trim() || formatter.stdout?.trim() || "unknown formatter failure";
|
||||
formatter.stderr?.trim() ||
|
||||
formatter.stdout?.trim() ||
|
||||
formatter.error?.message ||
|
||||
"unknown formatter failure";
|
||||
throw new Error(`failed to format generated base config schema: ${details}`);
|
||||
}
|
||||
return formatter.stdout;
|
||||
|
||||
@@ -129,12 +129,14 @@ function normalizePluginManifest(raw) {
|
||||
function formatTypeScriptModule(source, { outputPath }) {
|
||||
const formatterPath = path.relative(FORMATTER_CWD, outputPath) || outputPath;
|
||||
const formatter = spawnSync(
|
||||
process.platform === "win32" ? "pnpm.cmd" : "pnpm",
|
||||
process.platform === "win32" ? "pnpm" : "pnpm",
|
||||
["exec", "oxfmt", "--stdin-filepath", formatterPath],
|
||||
{
|
||||
cwd: FORMATTER_CWD,
|
||||
input: source,
|
||||
encoding: "utf8",
|
||||
// Windows requires a shell to launch package-manager shim scripts reliably.
|
||||
...(process.platform === "win32" ? { shell: true } : {}),
|
||||
},
|
||||
);
|
||||
if (formatter.status !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user