Merge branch 'cli-version'
This commit is contained in:
commit
c2264c42fc
|
|
@ -9,6 +9,7 @@ import { join } from 'path'
|
|||
|
||||
const DIST_DIR = join(import.meta.dir, '..', 'dist')
|
||||
const ENTRY_POINT = join(import.meta.dir, '..', 'src', 'cli', 'index.ts')
|
||||
const GIT_SHA = Bun.spawnSync(['git', 'rev-parse', '--short', 'HEAD']).stdout.toString().trim() || 'unknown'
|
||||
|
||||
interface BuildTarget {
|
||||
arch: string
|
||||
|
|
@ -40,6 +41,7 @@ async function buildCurrent() {
|
|||
'bun',
|
||||
'--minify',
|
||||
'--sourcemap=external',
|
||||
`--define=__GIT_SHA__="${GIT_SHA}"`,
|
||||
'--outfile',
|
||||
output,
|
||||
], {
|
||||
|
|
@ -73,6 +75,7 @@ async function buildTarget(target: BuildTarget) {
|
|||
`bun-${target.os}-${target.arch}`,
|
||||
'--minify',
|
||||
'--sourcemap=external',
|
||||
`--define=__GIT_SHA__="${GIT_SHA}"`,
|
||||
'--outfile',
|
||||
output,
|
||||
], {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { program } from 'commander'
|
|||
import color from 'kleur'
|
||||
|
||||
import pkg from '../../package.json'
|
||||
import { SHA } from './version'
|
||||
import {
|
||||
cronList,
|
||||
cronLog,
|
||||
|
|
@ -29,7 +30,7 @@ import {
|
|||
|
||||
program
|
||||
.name('toes')
|
||||
.version(`v${pkg.version}`, '-v, --version')
|
||||
.version(`v${pkg.version}-${SHA}`, '-v, --version')
|
||||
.addHelpText('beforeAll', (ctx) => {
|
||||
if (ctx.command === program) {
|
||||
return color.bold().cyan('🐾 Toes') + color.gray(' - personal web appliance\n')
|
||||
|
|
|
|||
3
src/cli/version.ts
Normal file
3
src/cli/version.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
declare var __GIT_SHA__: string
|
||||
|
||||
export const SHA: string = typeof __GIT_SHA__ !== 'undefined' ? __GIT_SHA__ : 'dev'
|
||||
Loading…
Reference in New Issue
Block a user