1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/lib/check-node-version.js
Kevin Heis 0b1ff73a46 Update some readFileSync to await readFile with top level await (#20525)
* Update some readFileSync to await readFile with top level await

* More updates

* Update all-products.js

* Use 'lib/readfile-async.js' in runtime files for better performance

* Remove unnecessary use of 'for await...of' loops

* Revert to importing 'fs/promises'

Co-authored-by: James M. Greene <jamesmgreene@github.com>
2021-07-29 16:45:46 +00:00

14 lines
522 B
JavaScript

import semver from 'semver'
import path from 'path'
import readFileAsync from './readfile-async.js'
const packageFile = JSON.parse(await readFileAsync(path.join(process.cwd(), './package.json')))
const { engines } = packageFile
/* istanbul ignore next */
if (!semver.satisfies(process.version, engines.node)) {
console.error(`\n\nYou're using Node.js ${process.version}, but ${engines.node} is required`)
console.error('Visit nodejs.org to download an installer for the latest LTS version.\n\n')
process.exit(1)
}