mirror of
https://github.com/mdx-js/mdx.git
synced 2024-08-16 18:30:27 +03:00
Add redirects to vercel.json
(#1722)
This commit is contained in:
parent
fcdd6debce
commit
dcf56e302a
164
vercel.json
164
vercel.json
@ -1,4 +1,166 @@
|
||||
{
|
||||
"public": true,
|
||||
"trailingSlash": true
|
||||
"trailingSlash": true,
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/about/",
|
||||
"destination": "/community/about/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/",
|
||||
"destination": "/guides/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/api/",
|
||||
"destination": "/packages/mdx/#api"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/ast/",
|
||||
"destination": "/packages/remark-mdx/#syntax-tree"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/components/",
|
||||
"destination": "/using-mdx/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/contributing/",
|
||||
"destination": "/community/contribute/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/custom-loader/",
|
||||
"destination": "/guides/frontmatter/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/retext-plugins/",
|
||||
"destination": "/extending-mdx/#using-plugins"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/plugins/",
|
||||
"destination": "/extending-mdx/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/runtime/",
|
||||
"destination": "/packages/mdx/#evaluatefile-options"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/specification/",
|
||||
"destination": "/packages/remark-mdx/#syntax-tree"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/sync-api/",
|
||||
"destination": "/packages/mdx/#api"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/transform-content/",
|
||||
"destination": "/packages/remark-mdx/"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/typescript/",
|
||||
"destination": "/getting-started/#types"
|
||||
},
|
||||
{
|
||||
"source": "/advanced/writing-a-plugin/",
|
||||
"destination": "/guides/frontmatter/"
|
||||
},
|
||||
{
|
||||
"source": "/contributing/",
|
||||
"destination": "/community/contribute/"
|
||||
},
|
||||
{
|
||||
"source": "/editor-plugins/",
|
||||
"destination": "/getting-started/#editor"
|
||||
},
|
||||
{
|
||||
"source": "/editors/",
|
||||
"destination": "/getting-started/#editor"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/create-react-app/",
|
||||
"destination": "/getting-started/#create-react-app-cra"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/gatsby/",
|
||||
"destination": "/getting-started/#gatsby"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/next/",
|
||||
"destination": "/getting-started/#nextjs"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/parcel/",
|
||||
"destination": "/getting-started/#parcel"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/react-static/",
|
||||
"destination": "/getting-started/#react-static"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/table-of-components/",
|
||||
"destination": "/table-of-components/"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/typescript/",
|
||||
"destination": "/getting-started/#types"
|
||||
},
|
||||
{
|
||||
"source": "/getting-started/webpack/",
|
||||
"destination": "/getting-started/#webpack"
|
||||
},
|
||||
{
|
||||
"source": "/guides/custom-loader/",
|
||||
"destination": "/guides/frontmatter/"
|
||||
},
|
||||
{
|
||||
"source": "/guides/live-code/",
|
||||
"destination": "/guides/syntax-highlighting/#syntax-highlighting-with-the-meta-field"
|
||||
},
|
||||
{
|
||||
"source": "/guides/markdown-in-components/",
|
||||
"destination": "/mdx/"
|
||||
},
|
||||
{
|
||||
"source": "/guides/math-blocks/",
|
||||
"destination": "/guides/math/"
|
||||
},
|
||||
{
|
||||
"source": "/guides/mdx-embed/",
|
||||
"destination": "/guides/embed/#embeds-at-run-time"
|
||||
},
|
||||
{
|
||||
"source": "/guides/table-of-contents/",
|
||||
"destination": "/extending-mdx/"
|
||||
},
|
||||
{
|
||||
"source": "/guides/terminal/",
|
||||
"destination": "/getting-started/#ink"
|
||||
},
|
||||
{
|
||||
"source": "/guides/vue/",
|
||||
"destination": "/getting-started/#vue"
|
||||
},
|
||||
{
|
||||
"source": "/guides/wrapper-customization/",
|
||||
"destination": "/using-mdx/#layout"
|
||||
},
|
||||
{
|
||||
"source": "/guides/writing-a-plugin/",
|
||||
"destination": "/extending-mdx/#creating-plugins"
|
||||
},
|
||||
{
|
||||
"source": "/plugins/",
|
||||
"destination": "/extending-mdx/#using-plugins"
|
||||
},
|
||||
{
|
||||
"source": "/projects/",
|
||||
"destination": "/community/projects/"
|
||||
},
|
||||
{
|
||||
"source": "/support/",
|
||||
"destination": "/community/support/"
|
||||
},
|
||||
{
|
||||
"source": "/syntax/",
|
||||
"destination": "/getting-started/#syntax"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ import rehypeMinifyUrl from 'rehype-minify-url'
|
||||
import rehypeStringify from 'rehype-stringify'
|
||||
import {config, redirect} from '../docs/_config.js'
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
main().catch((error) => {
|
||||
throw error
|
||||
})
|
||||
@ -57,12 +59,30 @@ async function main() {
|
||||
file.value = processor.stringify(tree)
|
||||
await fs.mkdir(file.dirname, {recursive: true})
|
||||
await fs.writeFile(file.path, String(file))
|
||||
console.log(' redirect: `%s` -> `%s`', from, to)
|
||||
}),
|
||||
{concurrency: 6}
|
||||
)
|
||||
|
||||
console.log('✔ Redirect')
|
||||
console.log('✔ %d redirects', Object.keys(redirect).length)
|
||||
|
||||
const vercelRedirects = []
|
||||
let redirectFrom
|
||||
|
||||
for (redirectFrom in redirect) {
|
||||
if (own.call(redirect, redirectFrom)) {
|
||||
const source = redirectFrom.replace(/\/index.html$/, '/')
|
||||
const destination = redirect[redirectFrom]
|
||||
vercelRedirects.push({source, destination})
|
||||
}
|
||||
}
|
||||
|
||||
const vercelInfo = JSON.parse(await fs.readFile('vercel.json'))
|
||||
await fs.writeFile(
|
||||
'vercel.json',
|
||||
JSON.stringify({...vercelInfo, redirects: vercelRedirects}, null, 2) + '\n'
|
||||
)
|
||||
|
||||
console.log('✔ `vercel.json` redirects')
|
||||
}
|
||||
|
||||
function buildRedirect(to) {
|
||||
|
Loading…
Reference in New Issue
Block a user