vars.mjs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import * as path from 'path'
  2. import * as fs from 'fs'
  3. import * as semver from 'semver'
  4. import * as childProcess from 'child_process'
  5. process.env.ARCH = ((process.env.ARCH || process.arch) === 'arm') ? 'armv7l' : process.env.ARCH || process.arch
  6. import * as url from 'url'
  7. const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
  8. const electronInfo = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../node_modules/electron/package.json')))
  9. export let version = childProcess.execSync('git describe --tags', { encoding:'utf-8' })
  10. version = version.substring(1).trim()
  11. version = version.replace('-', '-c')
  12. if (version.includes('-c')) {
  13. version = semver.inc(version, 'prepatch').replace('-0', `-nightly.${process.env.REV ?? 0}`)
  14. }
  15. export const builtinPlugins = [
  16. 'tabby-core',
  17. 'tabby-settings',
  18. 'tabby-terminal',
  19. 'tabby-web',
  20. 'tabby-community-color-schemes',
  21. 'tabby-ssh',
  22. 'tabby-serial',
  23. 'tabby-telnet',
  24. 'tabby-local',
  25. 'tabby-electron',
  26. 'tabby-plugin-manager',
  27. 'tabby-linkifier',
  28. ]
  29. export const packagesWithDocs = [
  30. ['.', 'tabby-core'],
  31. ['terminal', 'tabby-terminal'],
  32. ['local', 'tabby-local'],
  33. ['settings', 'tabby-settings'],
  34. ]
  35. export const allPackages = [
  36. ...builtinPlugins,
  37. 'web',
  38. 'tabby-web-demo',
  39. ]
  40. export const bundledModules = [
  41. '@angular',
  42. '@ng-bootstrap',
  43. ]
  44. export const electronVersion = electronInfo.version
  45. export const keygenConfig = {
  46. provider: 'keygen',
  47. account: 'a06315f2-1031-47c6-9181-e92a20ec815e',
  48. channel: 'stable',
  49. product: {
  50. win32: {
  51. x64: 'f481b9d6-d5da-4970-b926-f515373e986f',
  52. arm64: '950999b9-371c-419b-b291-938c5e4d364c',
  53. }[process.env.ARCH],
  54. darwin: {
  55. arm64: '98fbadee-c707-4cd6-9d99-56683595a846',
  56. x86_64: 'f5a48841-d5b8-4b7b-aaa7-cf5bffd36461',
  57. x64: 'f5a48841-d5b8-4b7b-aaa7-cf5bffd36461',
  58. }[process.env.ARCH],
  59. linux: {
  60. x64: '7bf45071-3031-4a26-9f2e-72604308313e',
  61. arm64: '39e3c736-d4d4-4fbf-a201-324b7bab0d17',
  62. armv7l: '50ae0a82-7f47-4fa4-b0a8-b0d575ce9409',
  63. armhf: '7df5aa12-04ab-4075-a0fe-93b0bbea9643',
  64. }[process.env.ARCH],
  65. }[process.platform],
  66. }
  67. if (!keygenConfig.product) {
  68. throw new Error(`Unrecognized platform ${process.platform}/${process.env.ARCH}`)
  69. }