docs: add script to catch bad redirects (#12361)
* docs: add script to catch bad redirects * add missing dependency
This commit is contained in:
1 parent
e4d853185f
commit
f25a4a5e34
9 files changed
+35
-6
No files matched your search
@@ -7,6 +7,7 @@ import {
|
||||
crossProjectLinksPlugin,
|
||||
} from "remark-rehype-plugins"
|
||||
import path from "path"
|
||||
import { catchBadRedirects } from "build-scripts"
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
@@ -23,13 +24,13 @@ const nextConfig = {
|
||||
optimizePackageImports: ["docs-utils"],
|
||||
},
|
||||
async redirects() {
|
||||
return [
|
||||
return catchBadRedirects([
|
||||
{
|
||||
source: "/api/download/:path",
|
||||
destination: "/download/:path",
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
])
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
"@types/pluralize": "^0.0.33",
|
||||
"@types/react": "npm:types-react@rc",
|
||||
"@types/react-dom": "npm:types-react@rc",
|
||||
"build-scripts": "*",
|
||||
"eslint": "^9.13.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react-hooks": "^5.0.0",
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import path from "path"
|
||||
import redirects from "./utils/redirects.mjs"
|
||||
import { generatedSidebars } from "./generated/sidebar.mjs"
|
||||
import { catchBadRedirects } from "build-scripts"
|
||||
|
||||
const withMDX = mdx({
|
||||
extension: /\.mdx?$/,
|
||||
@@ -168,7 +169,11 @@ const nextConfig = {
|
||||
],
|
||||
}
|
||||
},
|
||||
redirects,
|
||||
redirects: async () => {
|
||||
const result = await redirects()
|
||||
|
||||
return catchBadRedirects(result)
|
||||
},
|
||||
outputFileTracingIncludes: {
|
||||
"/md\\-content/\\[\\.\\.\\.slug\\]": ["./app/**/*.mdx"],
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @returns {Promise<import("next").Redirect[]>}
|
||||
* @type {import("next").NextConfig["redirects"]}
|
||||
*/
|
||||
const redirects = async () => {
|
||||
return [
|
||||
|
||||
@@ -10,6 +10,7 @@ import bundleAnalyzer from "@next/bundle-analyzer"
|
||||
import mdx from "@next/mdx"
|
||||
import mdxPluginOptions from "./mdx-options.mjs"
|
||||
import path from "node:path"
|
||||
import { catchBadRedirects } from "build-scripts"
|
||||
|
||||
const withMDX = mdx({
|
||||
extension: /\.mdx?$/,
|
||||
@@ -62,7 +63,7 @@ const nextConfig = {
|
||||
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/resources",
|
||||
async redirects() {
|
||||
return [
|
||||
return catchBadRedirects([
|
||||
{
|
||||
source: "/commerce-modules/order/relations-to-other-modules",
|
||||
destination: "/commerce-modules/order/links-to-other-modules",
|
||||
@@ -228,7 +229,7 @@ const nextConfig = {
|
||||
destination: "/references/user/events",
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
])
|
||||
},
|
||||
outputFileTracingExcludes: {
|
||||
"*": ["node_modules/@medusajs/icons"],
|
||||
|
||||
Reference in new issue
Block a user