Skip to content

Commit 721950e

Browse files
authored
backlinks, link upgrades (#47)
* add link parsing in backend, refactor link handling in frontend * fix performance issue * remove redundant and legacy styling and logic * improve link handling and bug fixes * attempt fix deployment * atempt fix 2 * improve env setup * upgrade convex * address comments 1 * move folder path resolution to backend * simplify link classes * fix * lint * fixes * fixes * address comments * add relative paths, clean up create functions * add test * lint
1 parent af5d0fc commit 721950e

102 files changed

Lines changed: 7367 additions & 22852 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,27 @@ jobs:
2525
cache: true
2626
- run: vp install --frozen-lockfile
2727
- name: Deploy Convex
28-
run: npx convex deploy
28+
run: |
29+
umask 077
30+
worker_env_file="$(mktemp "${RUNNER_TEMP}/worker-env.XXXXXX")"
31+
convex_env_file="$(mktemp "${RUNNER_TEMP}/convex-env.XXXXXX")"
32+
trap 'rm -f "$worker_env_file" "$convex_env_file"' EXIT
33+
34+
bash scripts/write-worker-env.sh "$worker_env_file"
35+
bash scripts/write-convex-env.sh "$convex_env_file"
36+
37+
npx convex env set --from-file "$convex_env_file"
38+
npx convex deploy
39+
vp build --mode production
40+
npx wrangler deploy --keep-vars --secrets-file "$worker_env_file"
2941
env:
3042
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_DEPLOY_KEY }}'
31-
- name: Deploy Cloudflare Workers
32-
run: vp build --mode production && npx wrangler deploy
33-
env:
3443
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
3544
VITE_CONVEX_URL: ${{ secrets.VITE_CONVEX_URL }}
3645
VITE_CONVEX_SITE_URL: ${{ secrets.VITE_CONVEX_SITE_URL }}
3746
VITE_SITE_URL: https://wizardarchive.com
47+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
48+
SITE_URL: https://wizardarchive.com
49+
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
50+
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
51+
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}

.github/workflows/preview.yml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ jobs:
2929
cache: true
3030
- run: vp install --frozen-lockfile
3131

32-
- name: Deploy Convex Preview (Create on Open)
33-
if: github.event.action == 'opened'
32+
- name: Deploy Convex Preview
3433
run: |
3534
npx convex deploy \
3635
--preview-create "pr-${{ github.event.pull_request.number }}" \
37-
--cmd 'vp build' \
36+
--cmd 'printf "VITE_CONVEX_URL=%s\n" "$VITE_CONVEX_URL" >> "$GITHUB_ENV" && vp build' \
3837
--cmd-url-env-var-name VITE_CONVEX_URL
3938
env:
4039
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}'
@@ -44,43 +43,37 @@ jobs:
4443
VITE_PR_NUMBER: ${{ github.event.pull_request.number }}
4544
VITE_GITHUB_REPOSITORY: ${{ github.repository }}
4645

47-
- name: Deploy Convex Preview (Update Existing)
48-
if: github.event.action != 'opened' && github.event.action != 'closed'
46+
- name: Configure Preview Backends And Worker
4947
run: |
50-
npx convex deploy \
51-
--preview-create "pr-${{ github.event.pull_request.number }}" \
52-
--cmd 'vp build' \
53-
--cmd-url-env-var-name VITE_CONVEX_URL
48+
umask 077
49+
worker_env_file="$(mktemp "${RUNNER_TEMP}/worker-env.XXXXXX")"
50+
convex_env_file="$(mktemp "${RUNNER_TEMP}/convex-env.XXXXXX")"
51+
trap 'rm -f "$worker_env_file" "$convex_env_file"' EXIT
52+
53+
bash scripts/write-worker-env.sh "$worker_env_file"
54+
bash scripts/write-convex-env.sh "$convex_env_file"
55+
56+
npx convex env set --from-file "$convex_env_file" \
57+
--preview-name "pr-${{ github.event.pull_request.number }}"
58+
npx wrangler deploy \
59+
--keep-vars \
60+
--secrets-file "$worker_env_file" \
61+
--name "${{ env.WORKER_NAME }}" \
62+
--route "preview-${{ github.event.pull_request.number }}.wizardarchive.com/*"
5463
env:
5564
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}'
65+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
66+
VITE_CONVEX_URL: ${{ env.VITE_CONVEX_URL }}
5667
VITE_CONVEX_SITE_URL: ${{ secrets.VITE_CONVEX_SITE_URL }}
5768
VITE_SITE_URL: ${{ env.PREVIEW_URL }}
5869
VITE_IS_PREVIEW: 'true'
5970
VITE_PR_NUMBER: ${{ github.event.pull_request.number }}
6071
VITE_GITHUB_REPOSITORY: ${{ github.repository }}
61-
62-
- name: Set Preview Environment Variables
63-
run: |
64-
npx convex env set BETTER_AUTH_SECRET "${{ secrets.BETTER_AUTH_SECRET }}" \
65-
--preview-name "pr-${{ github.event.pull_request.number }}"
66-
npx convex env set SITE_URL "${{ env.PREVIEW_URL }}" \
67-
--preview-name "pr-${{ github.event.pull_request.number }}"
68-
npx convex env set GOOGLE_CLIENT_ID "${{ secrets.GOOGLE_CLIENT_ID }}" \
69-
--preview-name "pr-${{ github.event.pull_request.number }}"
70-
npx convex env set GOOGLE_CLIENT_SECRET "${{ secrets.GOOGLE_CLIENT_SECRET }}" \
71-
--preview-name "pr-${{ github.event.pull_request.number }}"
72-
npx convex env set RESEND_API_KEY "${{ secrets.RESEND_API_KEY }}" \
73-
--preview-name "pr-${{ github.event.pull_request.number }}"
74-
env:
75-
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}'
76-
77-
- name: Deploy Cloudflare Workers Preview
78-
run: |
79-
npx wrangler deploy \
80-
--name ${{ env.WORKER_NAME }} \
81-
--route "preview-${{ github.event.pull_request.number }}.wizardarchive.com/*"
82-
env:
83-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
72+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
73+
SITE_URL: ${{ env.PREVIEW_URL }}
74+
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
75+
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
76+
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
8477

8578
- name: Comment Preview URL
8679
uses: marocchino/sticky-pull-request-comment@v2
@@ -109,6 +102,6 @@ jobs:
109102
# Convex previews are automatically deleted after 7 days, so we don't need to do anything here
110103

111104
- name: Delete Cloudflare Workers Preview
112-
run: npx wrangler delete --name ${{ env.WORKER_NAME }} --force
105+
run: npx wrangler delete --name "${{ env.WORKER_NAME }}" --force
113106
env:
114107
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ coverage/
4040
CLAUDE.md
4141
AGENTS.md
4242
.codex/
43+
.agents/
4344

4445

4546
# wrangler files
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"guidelinesHash": "62d72acb9afcc18f658d88dd772f34b5b1da5fa60ef0402e57a784d97c458e57",
3+
"agentsMdSectionHash": "bbf30bd25ceea0aefd279d62e1cb2b4c207fcb712b69adf26f3d02b296ffc7b2",
4+
"claudeMdHash": "bbf30bd25ceea0aefd279d62e1cb2b4c207fcb712b69adf26f3d02b296ffc7b2",
5+
"agentSkillsSha": "231a67aa8a5b29cc2794cbc8298335a71aaa6d0e",
6+
"installedSkillNames": [
7+
"convex",
8+
"convex-create-component",
9+
"convex-migration-helper",
10+
"convex-performance-audit"
11+
]
12+
}

0 commit comments

Comments
 (0)