diff --git a/version-check.js b/version-check.js index 43a0a7ed60..68bfb74a19 100644 --- a/version-check.js +++ b/version-check.js @@ -1,9 +1,13 @@ // This script is supposed to be run in travis to check package version matches -// because of this it is designed to be run on a "clean" git checkout +// because of this it is designed to be run on a "clean" git checkout // this will fail if run after npm install (since npm install updates package-lock) -const packageVersion = require('./package.json').version -const lockVersion = require('./package-lock.json').version +import { createRequire } from 'node:module'; +const require = createRequire(import.meta.url); +const packageVersion = require('./package.json').version; +const lockVersion = require('./package-lock.json').version; if (packageVersion != lockVersion) { - console.log(`version in package.json (${packageVersion}) does not match package-lock.json (${lockVersion})`); + console.log( + `version in package.json (${packageVersion}) does not match package-lock.json (${lockVersion})`, + ); process.exit(1); }