|
@ -5,40 +5,40 @@ import WindiCSS from 'vite-plugin-windicss' |
|
|
import { resolve } from "path" |
|
|
import { resolve } from "path" |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
plugins: [ |
|
|
|
|
|
vue(), |
|
|
|
|
|
WindiCSS() |
|
|
|
|
|
], |
|
|
|
|
|
define: { |
|
|
|
|
|
APP_TITLE: JSON.stringify(pkg.name), |
|
|
|
|
|
APP_VERSION: JSON.stringify(buildVersion()), |
|
|
|
|
|
APP_REPOSITORY: JSON.stringify(pkg.repository), |
|
|
|
|
|
APP_LICENSE: JSON.stringify(pkg.license), |
|
|
|
|
|
}, |
|
|
|
|
|
resolve: { |
|
|
|
|
|
alias: { |
|
|
|
|
|
"@": resolve(__dirname, "src"), |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
plugins: [ |
|
|
|
|
|
vue(), |
|
|
|
|
|
WindiCSS() |
|
|
|
|
|
], |
|
|
|
|
|
define: { |
|
|
|
|
|
APP_TITLE: JSON.stringify(pkg.name), |
|
|
|
|
|
APP_VERSION: JSON.stringify(buildVersion()), |
|
|
|
|
|
APP_REPOSITORY: JSON.stringify(pkg.repository), |
|
|
|
|
|
APP_LICENSE: JSON.stringify(pkg.license), |
|
|
|
|
|
}, |
|
|
|
|
|
resolve: { |
|
|
|
|
|
alias: { |
|
|
|
|
|
"@": resolve(__dirname, "src"), |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// FUNCTIONS
|
|
|
// FUNCTIONS
|
|
|
//----------
|
|
|
//----------
|
|
|
|
|
|
|
|
|
function buildVersion(): string { |
|
|
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 |
|
|
|
|
|
|
|
|
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(): boolean { |
|
|
function isGitCommand(): boolean { |
|
|
try { |
|
|
|
|
|
execSync("command -v git") |
|
|
|
|
|
return true |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
execSync("command -v git") |
|
|
|
|
|
return true |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
} |
|
|
} |