release-channel.js 488 B

12345678910111213141516171819
  1. // Given a version, figure out what the release channel is so that we can publish to the correct
  2. // channel on npm.
  3. //
  4. // E.g.:
  5. //
  6. // 1.2.3 -> latest (default)
  7. // 0.0.0-insiders.ffaa88 -> insiders
  8. // 4.1.0-alpha.4 -> alpha
  9. let version =
  10. process.argv[2] || process.env.npm_package_version || require('../package.json').version
  11. let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
  12. if (match) {
  13. console.log(match[1])
  14. } else {
  15. console.log('latest')
  16. }