diff --git a/.env b/.env new file mode 100644 index 0000000..dd29b5b --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_GIT_SHA=$GIT_SHA diff --git a/package.json b/package.json index ba9e3f7..429ae7a 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "homepage": "https://oldstarchy.github.io/pandemic_tracker/", "type": "module", "scripts": { - "dev": "vite", - "build": "VITE_GIT_SHA=`git rev-parse --short HEAD` tsc -b && vite build && yarn sentry:sourcemaps", + "dev": "export GIT_SHA=\"Dev Mode\" && vite", + "build": "export GIT_SHA=$(git rev-parse --short HEAD) && echo $GIT_SHA && tsc -b && vite build && yarn sentry:sourcemaps", "lint": "eslint . --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "sentry:sourcemaps": "sentry-cli sourcemaps inject --org nicholas-sorokin --project pandemic-tracker ./dist && sentry-cli sourcemaps upload --org nicholas-sorokin --project pandemic-tracker ./dist" diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx index bda8706..3317831 100644 --- a/src/components/layout/MainLayout.tsx +++ b/src/components/layout/MainLayout.tsx @@ -175,7 +175,7 @@ export function MainLayout({ children }: { children: ReactNode }) { <Link href={newIssueLink.toString()} target="_BLANK"> Report an issue or suggest a feature </Link> - {import.meta.env.DEV && <Span>Dev Mode</Span>} + <Span>{import.meta.env.VITE_GIT_SHA ?? 'Dev Mode'}</Span> </footer> </div> );