Files
MES_Manage_View_V20/build/check-versions.js
MESWORK 885e70b9fc init: MES_Manage_View_V20 v1.1.0 项目初始化
- Vue 2.7 + Element UI + Webpack 5 前端
- SQL Server 数据库脚本 (script.sql)
- 4份技术文档 (技术分析/功能映射/使用说明书/用户操作手册)
- 存储过程修复 (fix_生产管理_外协报表_查询.sql)
2026-05-21 09:31:44 +08:00

64 lines
1.3 KiB
JavaScript

const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec(cmd) {
return require('child_process')
.execSync(cmd)
.toString()
.trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
// if (shell.which('npm')) {
// versionRequirements.push({
// name: 'npm',
// currentVersion: exec('npm --version'),
// versionRequirement: packageConfig.engines.npm
// })
// }
module.exports = function() {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const 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 (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}