Skip to content

Commit 2c97539

Browse files
laplace youngfatso83
authored andcommitted
fix: make build and node test scripts cross-platform
1 parent a769291 commit 2c97539

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

build.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
2+
33
const fs = require("node:fs");
44
const { execFileSync } = require("node:child_process");
55
const esbuild = require("esbuild");
@@ -8,7 +8,8 @@ const pkg = require("./package.json");
88

99
// Step 1: Run Rollup to generate lib/ from src/
1010
console.log("Generating lib/ from src/ using Rollup...");
11-
execFileSync("npx", ["rollup", "-c", "rollup.config.mjs"], {
11+
const rollupCli = require.resolve("rollup/dist/bin/rollup");
12+
execFileSync(process.execPath, [rollupCli, "-c", "rollup.config.mjs"], {
1213
stdio: "inherit",
1314
});
1415

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"scripts": {
3434
"build-artifacts": "node ./build.cjs",
3535
"pretest-node": "npm run build-artifacts",
36-
"test-node": "mocha --recursive -R dot 'test/{src,issues,scripts}/**/*-test.js'",
36+
"test-node": "mocha --recursive -R dot \"test/{src,issues,scripts}/**/*-test.js\"",
3737
"pretest-headless": "npm run build-artifacts",
3838
"test-dev": "CHOKIDAR_USEPOLLING=1 npm run test-node -- --watch",
3939
"test-headless": "node ./scripts/run-browser-suite.mjs headless",
@@ -56,7 +56,7 @@
5656
"build": "npm run build-artifacts",
5757
"build-docs": "cd docs; make build",
5858
"serve-docs": "cd docs; make livereload",
59-
"lint": "eslint --max-warnings 0 '**/*.{js,cjs,mjs}'",
59+
"lint": "eslint --max-warnings 0 \"**/*.{js,cjs,mjs}\"",
6060
"pretest-webworker": "npm run build-artifacts",
6161
"prebuild": "rimraf pkg && npm run update-compatibility",
6262
"postbuild": "run-s test-esm-support test-esm-browser-build test-contract check-dependencies",

rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function getAllFiles(dir, fileList = []) {
1111
if (fs.statSync(filePath).isDirectory()) {
1212
getAllFiles(filePath, fileList);
1313
} else if (filePath.endsWith(".js")) {
14-
fileList.push(filePath);
14+
fileList.push(filePath.split(path.sep).join("/"));
1515
}
1616
}
1717
return fileList;

0 commit comments

Comments
 (0)