diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 000000000..94ddcdc46 --- /dev/null +++ b/.github/workflows/website.yml @@ -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 diff --git a/.vercelignore b/.vercelignore deleted file mode 100644 index c2658d7d1..000000000 --- a/.vercelignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/package.json b/package.json index 6eac8affc..6ad2f8b95 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/vercel.json b/vercel.json deleted file mode 100644 index 9135fd52f..000000000 --- a/vercel.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "public": true, - "trailingSlash": true, - "redirects": [ - { - "destination": "/community/about/", - "source": "/about/" - }, - { - "destination": "/guides/", - "source": "/advanced/" - }, - { - "destination": "/packages/mdx/#api", - "source": "/advanced/api/" - }, - { - "destination": "/packages/remark-mdx/#syntax-tree", - "source": "/advanced/ast/" - }, - { - "destination": "/docs/using-mdx/", - "source": "/advanced/components/" - }, - { - "destination": "/community/contribute/", - "source": "/advanced/contributing/" - }, - { - "destination": "/guides/frontmatter/", - "source": "/advanced/custom-loader/" - }, - { - "destination": "/docs/extending-mdx/#using-plugins", - "source": "/advanced/retext-plugins/" - }, - { - "destination": "/docs/extending-mdx/", - "source": "/advanced/plugins/" - }, - { - "destination": "/packages/mdx/#evaluatefile-options", - "source": "/advanced/runtime/" - }, - { - "destination": "/packages/remark-mdx/#syntax-tree", - "source": "/advanced/specification/" - }, - { - "destination": "/packages/mdx/#api", - "source": "/advanced/sync-api/" - }, - { - "destination": "/packages/remark-mdx/", - "source": "/advanced/transform-content/" - }, - { - "destination": "/docs/getting-started/#types", - "source": "/advanced/typescript/" - }, - { - "destination": "/guides/frontmatter/", - "source": "/advanced/writing-a-plugin/" - }, - { - "destination": "/community/contribute/", - "source": "/contributing/" - }, - { - "destination": "/docs/getting-started/#editor", - "source": "/editor-plugins/" - }, - { - "destination": "/docs/getting-started/#editor", - "source": "/editors/" - }, - { - "destination": "/docs/getting-started/#create-react-app-cra", - "source": "/getting-started/create-react-app/" - }, - { - "destination": "/docs/getting-started/#gatsby", - "source": "/getting-started/gatsby/" - }, - { - "destination": "/docs/getting-started/#nextjs", - "source": "/getting-started/next/" - }, - { - "destination": "/docs/getting-started/#parcel", - "source": "/getting-started/parcel/" - }, - { - "destination": "/docs/getting-started/#react-static", - "source": "/getting-started/react-static/" - }, - { - "destination": "/table-of-components/", - "source": "/getting-started/table-of-components/" - }, - { - "destination": "/docs/getting-started/#types", - "source": "/getting-started/typescript/" - }, - { - "destination": "/docs/getting-started/#webpack", - "source": "/getting-started/webpack/" - }, - { - "destination": "/docs/getting-started/", - "source": "/getting-started/" - }, - { - "destination": "/guides/frontmatter/", - "source": "/guides/custom-loader/" - }, - { - "destination": "/guides/syntax-highlighting/#syntax-highlighting-with-the-meta-field", - "source": "/guides/live-code/" - }, - { - "destination": "/docs/what-is-mdx/", - "source": "/guides/markdown-in-components/" - }, - { - "destination": "/guides/math/", - "source": "/guides/math-blocks/" - }, - { - "destination": "/guides/embed/#embeds-at-run-time", - "source": "/guides/mdx-embed/" - }, - { - "destination": "/docs/extending-mdx/", - "source": "/guides/table-of-contents/" - }, - { - "destination": "/docs/getting-started/#ink", - "source": "/guides/terminal/" - }, - { - "destination": "/docs/getting-started/#vue", - "source": "/guides/vue/" - }, - { - "destination": "/docs/using-mdx/#layout", - "source": "/guides/wrapper-customization/" - }, - { - "destination": "/docs/extending-mdx/#creating-plugins", - "source": "/guides/writing-a-plugin/" - }, - { - "destination": "/docs/what-is-mdx/", - "source": "/mdx/" - }, - { - "destination": "/docs/extending-mdx/#using-plugins", - "source": "/plugins/" - }, - { - "destination": "/community/projects/", - "source": "/projects/" - }, - { - "destination": "/community/support/", - "source": "/support/" - }, - { - "destination": "/docs/getting-started/#syntax", - "source": "/syntax/" - }, - { - "destination": "/docs/getting-started/#vue", - "source": "/vue/" - } - ] -} diff --git a/website/prep.js b/website/prep.js index 2b6e16947..5e3449256 100644 --- a/website/prep.js +++ b/website/prep.js @@ -75,31 +75,6 @@ await pAll( console.log('✔ %d redirects', Object.keys(redirect).length) -// To do: drop Vercel. -/** @type {Array>} */ -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 & {redirects: ReadonlyArray>}} */ -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