ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

version.ts 841 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { execPromise, execPromise2 } from './core-utils.js'
  2. import { logger } from './logger.js'
  3. async function getServerCommit () {
  4. try {
  5. const tag = await execPromise2(
  6. '[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true',
  7. { stdio: [ 0, 1, 2 ] }
  8. )
  9. if (tag) return tag.replace(/^v/, '')
  10. } catch (err) {
  11. logger.debug('Cannot get version from git tags.', { err })
  12. }
  13. try {
  14. const version = await execPromise('[ ! -d .git ] || git rev-parse --short HEAD')
  15. if (version) return version.toString().trim()
  16. } catch (err) {
  17. logger.debug('Cannot get version from git HEAD.', { err })
  18. }
  19. return ''
  20. }
  21. function getNodeABIVersion () {
  22. const version = process.versions.modules
  23. return parseInt(version)
  24. }
  25. export {
  26. getServerCommit,
  27. getNodeABIVersion
  28. }