Skip to content

Commit c912492

Browse files
style(Rest): Standardize double quotes and refine execSync formatting
Align the `Rest.js` CLI wrapper with the project's strict code style conventions by converting all string literals to double quotes and reordering Node.js imports into the canonical sequence: `child_process`, `fs`, `path`, `url`. Refactor the `execSync` invocation to use multi-line formatting for the argument mapping logic. This improves readability while maintaining strict binary path escaping for cross-platform execution. The change ensures consistency with recent standardization efforts across the `Rest` component's tooling and shell scripts.
1 parent 3ca1a6d commit c912492

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

bin/Rest.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22
/**
33
* Rest.js - CLI wrapper for Rest compiler binary
44
*/
5-
6-
import { execSync } from 'node:child_process';
7-
import { join, dirname } from 'node:path';
8-
import { fileURLToPath } from 'node:url';
9-
import { existsSync } from 'node:fs';
5+
import { execSync } from "node:child_process";
6+
import { existsSync } from "node:fs";
7+
import { dirname, join } from "node:path";
8+
import { fileURLToPath } from "node:url";
109

1110
const __dirname = dirname(fileURLToPath(import.meta.url));
1211

1312
// Determine the binary path based on platform
1413
const platform = process.platform;
15-
const binaryName = platform === 'win32' ? 'Rest.exe' : 'Rest';
14+
const binaryName = platform === "win32" ? "Rest.exe" : "Rest";
1615
const binaryPath = join(__dirname, binaryName);
1716

1817
if (!existsSync(binaryPath)) {
19-
console.error(`[Rest] Binary not found at: ${binaryPath}`);
20-
console.error('[Rest] Please run: npm install or npm rebuild');
21-
process.exit(1);
18+
console.error(`[Rest] Binary not found at: ${binaryPath}`);
19+
console.error("[Rest] Please run: npm install or npm rebuild");
20+
process.exit(1);
2221
}
2322

2423
// Execute the binary with all arguments
2524
try {
26-
execSync(`"${binaryPath}" ${process.argv.slice(2).map(a => `"${a}"`).join(' ')}`, {
27-
stdio: 'inherit',
28-
});
25+
execSync(
26+
`"${binaryPath}" ${process.argv
27+
.slice(2)
28+
.map((a) => `"${a}"`)
29+
.join(" ")}`,
30+
{
31+
stdio: "inherit",
32+
},
33+
);
2934
} catch (error) {
30-
process.exit(error.status || 1);
35+
process.exit(error.status || 1);
3136
}

0 commit comments

Comments
 (0)