Skip to content

Commit 094c96a

Browse files
committed
fixup: define require() in version-check.js
1 parent 4aa97ae commit 094c96a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

version-check.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// This script is supposed to be run in travis to check package version matches
2-
// because of this it is designed to be run on a "clean" git checkout
2+
// because of this it is designed to be run on a "clean" git checkout
33
// this will fail if run after npm install (since npm install updates package-lock)
4-
const packageVersion = require('./package.json').version
5-
const lockVersion = require('./package-lock.json').version
4+
import { createRequire } from 'node:module';
5+
const require = createRequire(import.meta.url);
6+
const packageVersion = require('./package.json').version;
7+
const lockVersion = require('./package-lock.json').version;
68
if (packageVersion != lockVersion) {
7-
console.log(`version in package.json (${packageVersion}) does not match package-lock.json (${lockVersion})`);
9+
console.log(
10+
`version in package.json (${packageVersion}) does not match package-lock.json (${lockVersion})`,
11+
);
812
process.exit(1);
913
}

0 commit comments

Comments
 (0)