diff --git a/TODO.md b/TODO.md index ee79ff5..2d6331e 100644 --- a/TODO.md +++ b/TODO.md @@ -1,12 +1,14 @@ TODO ==== ## ARCHI + * [ ] composition API * [ ] eslint * [ ] WindyCss ## FEATURE + * [ ] login/logout * [ ] fake rest api * [ ] i18n diff --git a/src/App.vue b/src/App.vue index 51d8f9d..b3ce79e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,27 @@ diff --git a/src/main.ts b/src/main.ts index b0b7995..3ae6187 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,9 +2,5 @@ import { createApp } from 'vue' import App from './App.vue' import './index.css' -console.log("Starting vite ...") -document.title = "YOUPI" - -createApp(App).mount('#app') - -console.log(`main.ts loaded`) +document.title = APP_TITLE +createApp(App).mount('#app') \ No newline at end of file diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index c821b24..1b483ad 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -2,4 +2,4 @@ declare module "*.vue" { import { defineComponent } from "vue" const Component: ReturnType export default Component -} \ No newline at end of file +} diff --git a/vite.config.ts b/vite.config.ts index 94d4feb..4b04f83 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,30 @@ import pkg from './package.json' import { execSync } from 'child_process' -const gitVersion = execSync("git describe --tags `git rev-list --tags --max-count=1`").toString() -console.log(gitVersion) -console.log(`vite.config.js loaded ${JSON.stringify(pkg.version)}`) \ No newline at end of file +export default { + define: { + APP_TITLE: pkg.name, + APP_VERSION: buildVersion(), + } +} + +// FUNCTIONS +//---------- + +function buildVersion(): string { + const version = pkg.version + if (!isGitCommand()) { + return version + } + const dirty = execSync("git status -s | wc -l").toString() + return `${version}…${dirty}` +} + +function isGitCommand() { + try { + execSync("command -v git") + return true + } catch (e) { + return false + } +} \ No newline at end of file