Skip to content

Commit

Permalink
Replace Vercel with GitHub pages
Browse files Browse the repository at this point in the history
This requires additional changes in the repository GitHub Pages
settings. _Source_ needs to be set to _GitHub Actions_, and a custom
domain needs to be configured.
  • Loading branch information
remcohaszing committed Oct 20, 2023
1 parent fdfe17b commit 74d612e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 205 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: website
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: Website
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with: {node-version: 18}
- run: npm ci
- run: npm run docs
- uses: actions/upload-pages-artifact@v2
with:
path: public
- uses: actions/deploy-pages@v2
id: deployment
1 change: 0 additions & 1 deletion .vercelignore

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"build": "tsc --build --clean && tsc --build && type-coverage",
"docs": "npm run docs-prep && npm run docs-generate && npm run docs-post",
"docs-css": "postcss --output public/index.css docs/_asset/index.css",
"docs-deploy": "vercel && vercel alias $(pbpaste) mdxjs.com && vercel alias $(pbpaste) www.mdxjs.com",
"docs-generate": "cross-env NODE_LOADER_CONFIG=website/loader.js node --no-warnings --loader @node-loader/core website/generate.js",
"docs-js": "npm run docs-js-default && npm run docs-js-editor",
"docs-js-default": "esbuild --bundle --conditions=browser,production --define:process.env.NODE_ENV=\\\"production\\\" --log-level=warning --minify --outfile=public/index.js --target=es2020 docs/_asset/index.js",
Expand Down
178 changes: 0 additions & 178 deletions vercel.json

This file was deleted.

25 changes: 0 additions & 25 deletions website/prep.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,6 @@ await pAll(

console.log('✔ %d redirects', Object.keys(redirect).length)

// To do: drop Vercel.
/** @type {Array<Readonly<Redirect>>} */
const vercelRedirects = []
/** @type {string} */
let redirectFrom

for (redirectFrom in redirect) {
if (Object.hasOwn(redirect, redirectFrom)) {
const source = redirectFrom.replace(/\/index.html$/, '/')
const destination = redirect[redirectFrom]
vercelRedirects.push({destination, source})
}
}

// To do: drop Vercel.
/** @type {Record<string, unknown> & {redirects: ReadonlyArray<Readonly<Redirect>>}} */
const vercelInfo = JSON.parse(String(await fs.readFile('vercel.json')))
await fs.writeFile(
'vercel.json',
JSON.stringify({...vercelInfo, redirects: vercelRedirects}, undefined, 2) +
'\n'
)

console.log('✔ `vercel.json` redirects')

/**
*
* @param {string} to
Expand Down

0 comments on commit 74d612e

Please sign in to comment.