Skip to content

Commit 88de7f4

Browse files
committed
fix: build system on Windows (glob pattern update), also forcing NodeJS ESM (*.mjs file extension) to avoid the unnecessary CJS handling
1 parent edda8aa commit 88de7f4

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"clean-node-modules": "rimraf --glob \"packages/*/node_modules\" && rimraf \"node_modules\"",
7979
"clean-all": "yarn clean-libs && yarn clean-node-modules",
8080
"prebuild": "yarn clean-libs",
81-
"build": "cross-env VERBOSE=1 node ./scripts/build.js",
81+
"build": "cross-env VERBOSE=1 node ./scripts/build.mjs",
8282
"docs": "echo docs script not implemented",
8383
"lint": "echo lint script not implemented",
8484
"postinstall": "yarn npmVersionsCheck && yarn build && yarn patchElectronJestRunner && yarn patchElectronJestRunner_",

scripts/build.js renamed to scripts/build.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {mkdirp} from 'mkdirp';
1818
import path from 'path';
1919
import spawn from 'cross-spawn';
2020

21-
import { config, listPackages, PACKAGES_DIR } from './build-utils.js';
21+
import { config, listPackages, PACKAGES_DIR } from './build-utils.mjs';
2222

2323
const __dirname = import.meta.dirname;
2424
const babelConfig = JSON.parse(
@@ -68,18 +68,20 @@ function buildFile(file, silent) {
6868

6969
function buildPackage(pkg) {
7070
const srcDir = path.resolve(pkg, config.srcDir);
71-
const pattern = path.resolve(srcDir, '**/*');
71+
const pattern = '**/*'; // path.resolve(srcDir, '**/*').replace(/\\/g, "/");
7272
const files = glob.sync(pattern, {
7373
nodir: true,
74-
});
74+
cwd: srcDir,
75+
//windowsPathsNoEscape: true,
76+
}).map((f) => path.join(srcDir, f));
7577

7678
const verbose = process.env.VERBOSE;
7779

7880
process.stdout.write(` ${path.basename(pkg)} ${chalk.dim('...')}${verbose ? '\n' : ''}`);
7981

8082
files.forEach(file => buildFile(file, !verbose));
8183

82-
const buildScript = path.resolve(pkg, 'scripts/build.js');
84+
const buildScript = path.resolve(pkg, 'scripts/build.mjs');
8385
if (fs.existsSync(buildScript)) {
8486
spawn.sync('node', [buildScript], { stdio: 'inherit' });
8587
}

scripts/watch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import { execSync } from 'child_process';
1212
import fs = from 'fs';
1313
import path from 'path';
1414

15-
import { listPackages } from './build-utils';
15+
import { listPackages } from './build-utils.mjs';
1616

1717
const __dirname = import.meta.dirname;
18-
const BUILD_CMD = `node ${path.resolve(__dirname, './build.js')}`;
18+
const BUILD_CMD = `node ${path.resolve(__dirname, './build.mjs')}`;
1919

2020
let filesToBuild = new Map();
2121

0 commit comments

Comments
 (0)