Skip to content

Commit fe74b6b

Browse files
authored
Merge branch 'ProjectDepot:main' into main
2 parents 45ec9fc + 677373b commit fe74b6b

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

astro.config.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { defineConfig } from 'astro/config';
2+
import { loadEnv } from 'vite';
23
import vue from '@astrojs/vue';
34
import tailwindcss from '@tailwindcss/vite';
45
import { nodePolyfills } from 'vite-plugin-node-polyfills';
56

6-
console.log('Using username', process.env.VITE_GITHUB_ACTOR);
7+
const env = loadEnv('', process.cwd());
8+
console.log('Using username', env.VITE_GITHUB_ACTOR);
79

810
export default defineConfig({
911
integrations: [
@@ -14,7 +16,9 @@ export default defineConfig({
1416
vite: {
1517
define: {
1618
__DEV__: process.env.NODE_ENV === 'development',
17-
VITE_GITHUB_ACTOR: process.env.VITE_GITHUB_ACTOR,
19+
GITHUB_ACTOR: JSON.stringify(
20+
env.VITE_GITHUB_ACTOR || process.env.VITE_GITHUB_ACTOR || 'gh_username'
21+
),
1822
},
1923
plugins: [tailwindcss(), nodePolyfills()],
2024
build: {

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"devDependencies": {
3333
"@eslint/js": "^9.19.0",
3434
"@tailwindcss/typography": "^0.5.16",
35+
"@vitejs/plugin-vue": "^6.0.1",
3536
"eslint": "^9.19.0",
3637
"eslint-plugin-react-hooks": "^5.0.0",
3738
"eslint-plugin-react-refresh": "^0.4.18",

src/env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/// <reference types="astro/client" />
22
declare module '*.vue';
33
declare module '*.md';
4+
5+
declare const GITHUB_ACTOR: string;

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import App from '../App.vue';
33
import config from '../config.json';
44
5-
const ghUsername = import.meta.env.VITE_GITHUB_ACTOR || 'your_username';
5+
const ghUsername = GITHUB_ACTOR || 'your_username';
66
77
let siteTitle = '';
88
if (config.siteTitle === undefined) siteTitle = "{username}'s Sites";
@@ -24,7 +24,7 @@ const description = `List of ${ghUsername}'s GitHub projects`;
2424
</head>
2525
<body class="bg-gray-100 dark:bg-gray-900 dark:text-gray-100">
2626
<div id="app">
27-
<App client:load config={config} ghUsername={import.meta.env.VITE_GITHUB_ACTOR || 'your_username'} />
27+
<App client:load config={config} ghUsername={ghUsername} />
2828
</div>
2929
</body>
3030
</html>

0 commit comments

Comments
 (0)