import pkg from './package.json' import { execSync } from 'child_process' export default { define: { APP_TITLE: pkg.name, APP_VERSION: buildVersion(), } } // FUNCTIONS //---------- function buildVersion(): string { const version = pkg.version if (!isGitCommand()) { return version } const dirty = Number(execSync("git status -s | wc -l").toString()) return dirty > 0 ? `${version}…${dirty}` : version } function isGitCommand() { try { execSync("command -v git") return true } catch (e) { return false } }