PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.1.4
Plugin Detective – Troubleshooting Conflicts v1.1.4
1.2.35 1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 All 54 releases
plugin-detective / troubleshoot / app / build / check-versions.js

check-versions.js in Plugin Detective – Troubleshooting Conflicts 1.1.4, at troubleshoot/app/build/check-versions.js

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var chalk = require('chalk')
2 var semver = require('semver')
3 var packageConfig = require('../package.json')
4 var shell = require('shelljs')
5 function exec (cmd) {
6 return require('child_process').execSync(cmd).toString().trim()
7 }
8
9 var versionRequirements = [
10 {
11 name: 'node',
12 currentVersion: semver.clean(process.version),
13 versionRequirement: packageConfig.engines.node
14 }
15 ]
16
17 if (shell.which('npm')) {
18 versionRequirements.push({
19 name: 'npm',
20 currentVersion: exec('npm --version'),
21 versionRequirement: packageConfig.engines.npm
22 })
23 }
24
25 module.exports = function () {
26 var warnings = []
27 for (var i = 0; i < versionRequirements.length; i++) {
28 var mod = versionRequirements[i]
29 if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30 warnings.push(mod.name + ': ' +
31 chalk.red(mod.currentVersion) + ' should be ' +
32 chalk.green(mod.versionRequirement)
33 )
34 }
35 }
36
37 if (warnings.length) {
38 console.log('')
39 console.log(chalk.yellow('To use this template, you must update following to modules:'))
40 console.log()
41 for (var i = 0; i < warnings.length; i++) {
42 var warning = warnings[i]
43 console.log(' ' + warning)
44 }
45 console.log()
46 process.exit(1)
47 }
48 }
49