logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

check-versions.js (1063B)


  1. var semver = require('semver')
  2. var chalk = require('chalk')
  3. var packageConfig = require('../package.json')
  4. var exec = function (cmd) {
  5. return require('child_process')
  6. .execSync(cmd).toString().trim()
  7. }
  8. var versionRequirements = [
  9. {
  10. name: 'node',
  11. currentVersion: semver.clean(process.version),
  12. versionRequirement: packageConfig.engines.node
  13. }
  14. ]
  15. module.exports = function () {
  16. var warnings = []
  17. for (var i = 0; i < versionRequirements.length; i++) {
  18. var mod = versionRequirements[i]
  19. if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
  20. warnings.push(mod.name + ': ' +
  21. chalk.red(mod.currentVersion) + ' should be ' +
  22. chalk.green(mod.versionRequirement)
  23. )
  24. }
  25. }
  26. if (warnings.length) {
  27. console.log('')
  28. console.log(chalk.yellow('To use this template, you must update following to modules:'))
  29. console.log()
  30. for (var i = 0; i < warnings.length; i++) {
  31. var warning = warnings[i]
  32. console.log(' ' + warning)
  33. }
  34. console.log()
  35. process.exit(1)
  36. }
  37. }