Skip to content

Commit

Permalink
feat: proxy theme request
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed Jan 17, 2024
1 parent 0dc585a commit ca3edca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vitepress/update-theme.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execSync } from 'child_process'

const THEME_URL = `https://github.com/NativeScript/docs/releases/download/vitepress-theme/vitepress-theme.tgz`
const THEME_URL = `https://docs.nativescript.org/__/vitepress-theme.tgz`

execSync('yarn remove @nativescript/vitepress-theme')
execSync(`yarn add -D ${THEME_URL}?${Date.now()}`)
12 changes: 12 additions & 0 deletions functions/__/vitepress-theme.tgz.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export async function onRequest(context) {
let response = await fetch(
'https://github.com/NativeScript/docs/releases/download/vitepress-theme/vitepress-theme.tgz'
)
response = new Response(response.body, response)

// Set CORS headers
response.headers.set('Access-Control-Allow-Origin', '*')
response.headers.set('Access-Control-Allow-Methods', 'GET, OPTIONS')

return response
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"update-theme": "node ./.vitepress/update-theme.mjs"
},
"devDependencies": {
"@nativescript/vitepress-theme": "https://github.com/NativeScript/docs/releases/download/vitepress-theme/vitepress-theme.tgz?1696967568385",
"@nativescript/vitepress-theme": "https://docs.nativescript.org/__/vitepress-theme.tgz?1696967568385",
"@types/node": "18.11.9",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
Expand Down

0 comments on commit ca3edca

Please sign in to comment.