Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/.env
#	frontend/.env.development
#	frontend/env.d.ts
  • Loading branch information
rlindner81 committed Mar 25, 2023
2 parents a2feda0 + 6c437e2 commit ef069ac
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 17 deletions.
25 changes: 17 additions & 8 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
VITE_PUBLIC_DIR = public
VITE_COLOR_PRIMARY = "#1b4965"
VITE_COLOR_SECONDARY = "#1c7293"
VITE_COLOR_BACKGROUND = "#f8f9fa"
VITE_DEFAULT_LOCALE = en
VITE_FALLBACK_LOCALE = en
VITE_APP_NAME = TrackIt
VITE_FIREBASE_CONFIG = {"apiKey":"AIzaSyASZh5cjJLkhXivX2DDzX69rhvj2mYBVCQ","authDomain":"trackit-f1b79.firebaseapp.com","projectId":"trackit-f1b79","storageBucket":"trackit-f1b79.appspot.com","messagingSenderId":"191629398412","appId":"1:191629398412:web:b60e6f94b5c6e3d0f506a9"}
VITE_APP_NAME=TrackIt
VITE_COLOR_PRIMARY="#1b4965"
VITE_COLOR_SECONDARY="#1c7293"
VITE_COLOR_BACKGROUND="#f8f9fa"
VITE_DEFAULT_LOCALE=en
VITE_FALLBACK_LOCALE=en
VITE_FIREBASE_CONFIG='{
"apiKey": "AIzaSyASZh5cjJLkhXivX2DDzX69rhvj2mYBVCQ",
"authDomain": "trackit-f1b79.firebaseapp.com",
"projectId": "trackit-f1b79",
"storageBucket": "trackit-f1b79.appspot.com",
"messagingSenderId": "191629398412",
"appId": "1:191629398412:web:b60e6f94b5c6e3d0f506a9"
}'
VITE_PUBLIC_DIR=public
VITE_NPM_NAME=$npm_package_name
VITE_NPM_VERSION=$npm_package_version
17 changes: 12 additions & 5 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
VITE_PUBLIC_DIR = public.development
VITE_COLOR_PRIMARY = "#56693a"
VITE_COLOR_SECONDARY = "#779150"
VITE_APP_NAME = TrackIt-Dev
VITE_FIREBASE_CONFIG = {"apiKey":"AIzaSyBnndX-VxyIcXNEUD4njlhKAHEbYEadx7c","authDomain":"trackit-dev-fde62.firebaseapp.com","projectId":"trackit-dev-fde62","storageBucket":"trackit-dev-fde62.appspot.com","messagingSenderId":"587772691249","appId":"1:587772691249:web:0b43c740d50202d3db2610"}
VITE_APP_NAME=TrackIt-Dev
VITE_COLOR_PRIMARY="#56693a"
VITE_COLOR_SECONDARY="#779150"
VITE_FIREBASE_CONFIG='{
"apiKey": "AIzaSyBnndX-VxyIcXNEUD4njlhKAHEbYEadx7c",
"authDomain": "trackit-dev-fde62.firebaseapp.com",
"projectId": "trackit-dev-fde62",
"storageBucket": "trackit-dev-fde62.appspot.com",
"messagingSenderId": "587772691249",
"appId": "1:587772691249:web:0b43c740d50202d3db2610"
}'
VITE_PUBLIC_DIR=public.development
4 changes: 4 additions & 0 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
},
globals: {
__VITE_MODE__: false,
__GIT_COMMIT__: false,
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
Expand Down
13 changes: 9 additions & 4 deletions frontend/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/// <reference types="vite/client" />

declare const __VITE_MODE__: string;
declare const __GIT_COMMIT__: string;

interface ImportMetaEnv {
readonly VITE_PUBLIC_DIR: string;
readonly VITE_DEFAULT_LOCALE: string;
readonly VITE_FALLBACK_LOCALE: string;
readonly VITE_APP_NAME: string;
readonly VITE_FIREBASE_CONFIG: string;
readonly VITE_COLOR_PRIMARY: string;
readonly VITE_COLOR_SECONDARY: string;
readonly VITE_COLOR_BACKGROUND: string;
readonly VITE_DEFAULT_LOCALE: string;
readonly VITE_FALLBACK_LOCALE: string;
readonly VITE_FIREBASE_CONFIG: string;
readonly VITE_PUBLIC_DIR: string;
readonly VITE_NPM_NAME: string;
readonly VITE_NPM_VERSION: string;
}

interface ImportMeta {
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ app.config.globalProperties.$filters = {
readableRelativeDateTime,
};

console.log(
"running %s v%s (%s, %s)",
import.meta.env.VITE_NPM_NAME,
import.meta.env.VITE_NPM_VERSION,
__VITE_MODE__,
__GIT_COMMIT__
);

// see https://stackoverflow.com/questions/64175742/using-globalproperties-in-vue-3-and-typescript
declare module "@vue/runtime-core" {
interface ComponentCustomProperties {
Expand Down
8 changes: 8 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fileURLToPath, URL } from "node:url";
import { resolve, dirname } from "node:path";
import { execSync } from "node:child_process";

import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
Expand All @@ -8,9 +9,16 @@ import vuetify from "vite-plugin-vuetify";
import { VitePWA } from "vite-plugin-pwa";

// https://vitejs.dev/config/
// https://vitejs.dev/config/#using-environment-variables-in-config
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const gitCommit = execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
return {
// https://vitejs.dev/config/shared-options.html#define
define: {
__VITE_MODE__: JSON.stringify(mode),
__GIT_COMMIT__: JSON.stringify(gitCommit),
},
plugins: [
vue(),
VueI18nPlugin({
Expand Down

0 comments on commit ef069ac

Please sign in to comment.