pleroma-fe/build/check-versions.js
tusooa 2ad5c3d3fe Do not check npm version
This project does not make use of npm at all. In addition, corepack's
npm will refuse to run in a project that defines packageManager in
package.json to be yarn. If we are using standalone yarn legacy,
it will just run fine. If using corepack, it will automatically
download (if needed) and use yarn v1.
2025-01-07 20:51:14 -05:00

40 lines
1 KiB
JavaScript

var semver = require('semver')
var chalk = require('chalk')
var packageConfig = require('../package.json')
var exec = function (cmd) {
return require('child_process')
.execSync(cmd).toString().trim()
}
var versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
module.exports = function () {
var warnings = []
for (var i = 0; i < versionRequirements.length; i++) {
var mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (var i = 0; i < warnings.length; i++) {
var warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}