Skip to content

Commit 96b8663

Browse files
authored
Astro (#66)
* convert to astro * remove old page * Update site and base configuration in astro.config.mjs * Refactor application structure to integrate App component, replacing Sidebar and Output components in index.astro * use accordion * update * Set filled state to false in App component * regroup sidebar * remove leftover custom context * single source of defaults * add stylesheet * remove title * refactor Sidebar component to enhance font upload functionality and improve state management * update lockfile * add deployments * fix: update import statement for App component to include file extension * fix: update base path in Astro config for PR preview * fix: add React integration to Astro config for PR preview
1 parent 640b638 commit 96b8663

File tree

19 files changed

+10140
-1494
lines changed

19 files changed

+10140
-1494
lines changed

.github/workflows/pages.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Deploy Astro site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # or your default branch
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install dependencies
17+
run: npm ci
18+
19+
- name: Build Astro site
20+
run: npm run build
21+
22+
- name: Deploy to GitHub Pages
23+
uses: peaceiris/actions-gh-pages@v4
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./dist
27+
exclude_assets: 'pr-preview/**'

.github/workflows/pr-preview.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: PR Preview
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened, closed]
7+
8+
jobs:
9+
deploy-preview:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
if: github.event.action != 'closed'
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
25+
- name: Install dependencies
26+
if: github.event.action != 'closed'
27+
run: npm ci
28+
29+
- name: Update Astro config for PR preview
30+
if: github.event.action != 'closed'
31+
run: |
32+
cat > astro.config.mjs << 'EOF'
33+
import { defineConfig } from 'astro/config';
34+
import react from '@astrojs/react';
35+
36+
// https://astro.build/config
37+
export default defineConfig({
38+
integrations: [react()],
39+
site: 'https://danmarshall.github.io',
40+
base: '/google-font-to-svg-path/pr-preview/pr-${{ github.event.pull_request.number }}',
41+
});
42+
EOF
43+
44+
- name: Build Astro site
45+
if: github.event.action != 'closed'
46+
run: npm run build
47+
48+
- name: Deploy PR Preview
49+
uses: rossjrw/pr-preview-action@v1
50+
with:
51+
source-dir: ./dist
52+
preview-branch: gh-pages
53+
umbrella-dir: pr-preview

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ jspm_packages
3939
#jekyll
4040
_site
4141
.jekyll-cache
42+
# Astro
43+
.astro/
44+
dist/

astro.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from 'astro/config';
2+
import react from '@astrojs/react';
3+
4+
export default defineConfig({
5+
integrations: [react()],
6+
site: 'https://danmarshall.github.io',
7+
base: '/google-font-to-svg-path',
8+
});

index.html

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)