@@ -35,159 +35,15 @@ jobs:
3535 node-version : " 18"
3636 cache : ' npm'
3737
38- - name : Create simplified vite config
39- run : |
40- cat > vite.config.js << 'EOF'
41- import { defineConfig } from "vite";
42- import react from "@vitejs/plugin-react";
43- import tailwindcss from "@tailwindcss/vite";
44- import { resolve } from 'path';
45-
46- // https://vitejs.dev/config/
47- export default defineConfig({
48- plugins: [react(), tailwindcss()],
49- build: {
50- base: "/github-copilot-usage/",
51- outDir: 'dist'
52- },
53- resolve: {
54- alias: {
55- '@': resolve(__dirname, 'src')
56- }
57- }
58- });
59- EOF
60-
61- - name : Create simplified package.json
62- run : |
63- cat > simplified-package.json << 'EOF'
64- {
65- "name": "github-copilot-usage-analyzer",
66- "private": true,
67- "version": "1.0.0",
68- "type": "module",
69- "scripts": {
70- "build": "vite build",
71- "preview": "vite preview"
72- },
73- "dependencies": {
74- "@heroicons/react": "^2.2.0",
75- "@phosphor-icons/react": "^2.1.7",
76- "@radix-ui/colors": "^3.0.0",
77- "@radix-ui/react-accordion": "^1.2.3",
78- "@radix-ui/react-alert-dialog": "^1.1.6",
79- "@radix-ui/react-aspect-ratio": "^1.1.2",
80- "@radix-ui/react-avatar": "^1.1.3",
81- "@radix-ui/react-checkbox": "^1.1.4",
82- "@radix-ui/react-collapsible": "^1.1.3",
83- "@radix-ui/react-context-menu": "^2.2.6",
84- "@radix-ui/react-dialog": "^1.1.6",
85- "@radix-ui/react-dropdown-menu": "^2.1.6",
86- "@radix-ui/react-hover-card": "^1.1.6",
87- "@radix-ui/react-label": "^2.1.2",
88- "@radix-ui/react-menubar": "^1.1.6",
89- "@radix-ui/react-navigation-menu": "^1.2.5",
90- "@radix-ui/react-popover": "^1.1.6",
91- "@radix-ui/react-progress": "^1.1.2",
92- "@radix-ui/react-radio-group": "^1.2.3",
93- "@radix-ui/react-scroll-area": "^1.2.9",
94- "@radix-ui/react-select": "^2.1.6",
95- "@radix-ui/react-separator": "^1.1.2",
96- "@radix-ui/react-slider": "^1.2.3",
97- "@radix-ui/react-slot": "^1.1.2",
98- "@radix-ui/react-switch": "^1.1.3",
99- "@radix-ui/react-tabs": "^1.1.3",
100- "@radix-ui/react-toggle": "^1.1.2",
101- "@radix-ui/react-toggle-group": "^1.1.2",
102- "@radix-ui/react-tooltip": "^1.1.8",
103- "class-variance-authority": "^0.7.1",
104- "clsx": "^2.1.1",
105- "cmdk": "^1.1.1",
106- "d3": "^7.9.0",
107- "date-fns": "^3.6.0",
108- "embla-carousel-react": "^8.5.2",
109- "framer-motion": "^12.6.2",
110- "input-otp": "^1.4.2",
111- "lucide-react": "^0.484.0",
112- "marked": "^15.0.7",
113- "react": "^19.0.0",
114- "react-day-picker": "^9.6.7",
115- "react-dom": "^19.0.0",
116- "react-hook-form": "^7.54.2",
117- "react-resizable-panels": "^2.1.7",
118- "recharts": "^2.15.1",
119- "sonner": "^2.0.1",
120- "tailwind-merge": "^3.0.2",
121- "three": "^0.175.0",
122- "tw-animate-css": "^1.2.4",
123- "uuid": "^11.1.0",
124- "vaul": "^1.1.2",
125- "zod": "^3.24.2"
126- },
127- "devDependencies": {
128- "@tailwindcss/vite": "^4.0.17",
129- "@types/react": "^19.0.10",
130- "@types/react-dom": "^19.0.4",
131- "@vitejs/plugin-react": "^4.3.4",
132- "tailwindcss": "^4.0.17",
133- "typescript": "~5.7.2",
134- "vite": "^6.3.5"
135- }
136- }
137- EOF
138- mv simplified-package.json package.json
139-
14038 - name : Install dependencies
14139 run : npm install
14240
143- - name : Create modified App with no Spark dependencies
144- run : |
145- # Create a file to replace @github/spark imports
146- mkdir -p src/spark-shims
147- cat > src/spark-shims/hooks.js << 'EOF'
148- import { useState } from 'react';
149-
150- // Simple localStorage-based shim for useKV hook
151- export function useKV(key, initialValue) {
152- const storageKey = `kv-${key}`;
153-
154- // Get from localStorage
155- const stored = localStorage.getItem(storageKey);
156- const initial = stored !== null ? JSON.parse(stored) : initialValue;
157-
158- const [value, setValue] = useState(initial);
159-
160- const setValueAndStore = (newValue) => {
161- const valueToStore = newValue instanceof Function ? newValue(value) : newValue;
162- setValue(valueToStore);
163- localStorage.setItem(storageKey, JSON.stringify(valueToStore));
164- };
165-
166- const deleteValue = () => {
167- setValue(null);
168- localStorage.removeItem(storageKey);
169- };
170-
171- return [value, setValueAndStore, deleteValue];
172- }
173- EOF
174-
175- - name : Update imports in code
176- run : |
177- # Replace imports from @github/spark/hooks with our shim
178- find src -type f -name "*.ts" -o -name "*.tsx" | xargs sed -i 's/import {.*} from "@github\/spark\/hooks"/import { useKV } from "..\/spark-shims\/hooks"/g'
179-
180- - name : Use GitHub Pages main file
181- run : |
182- # Use the main-github-pages.tsx instead of main.tsx to avoid Spark imports
183- cp src/main-github-pages.tsx src/main.tsx
41+ - name : Build for GitHub Pages
42+ run : npm run build:pages
18443
18544 - name : Setup Pages
18645 uses : actions/configure-pages@v4
18746
188- - name : Build
189- run : npm run build
190-
19147 - name : Upload artifact
19248 uses : actions/upload-pages-artifact@v3
19349 with :
19652 # Deployment job
19753 deploy :
19854 # Only deploy on main branch
199- if : github.ref == 'refs/heads/main'
55+ # if: github.ref == 'refs/heads/main'
20056 environment :
20157 name : github-pages
20258 url : ${{ steps.deployment.outputs.page_url }}
0 commit comments