get-pkg-version.js 501 B

1234567891011121314151617
  1. // This script file outputs the version in the package.json of project dir,
  2. // and optionally add nightly postfix.
  3. //
  4. // It is used as a helper by the continuous integration.
  5. const path = require('path')
  6. const process = require('process')
  7. const ver = require(path.join(__dirname, '../package.json')).version
  8. if (process.argv[2] === 'nightly') {
  9. const today = new Date()
  10. console.log(
  11. ver + '+nightly.' + today.toISOString().split('T')[0].replaceAll('-', '')
  12. )
  13. } else {
  14. console.log(ver)
  15. }