diff --git a/scripts/deadLinkChecker.js b/scripts/deadLinkChecker.js index e91b46c25..90593b878 100644 --- a/scripts/deadLinkChecker.js +++ b/scripts/deadLinkChecker.js @@ -10,18 +10,7 @@ const PUBLIC_DIR = path.join(__dirname, '../public'); const fileCache = new Map(); const anchorMap = new Map(); // Map> const contributorMap = new Map(); // Map -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= const redirectMap = new Map(); // Map ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= -const redirectMap = new Map(); // Map ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= -const redirectMap = new Map(); // Map ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 let errorCodes = new Set(); async function readFileWithCache(filePath) { @@ -174,14 +163,6 @@ async function validateLink(link) { return {valid: true}; } -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= -======= ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 // Check for redirects if (redirectMap.has(urlWithoutAnchor)) { const redirectDestination = redirectMap.get(urlWithoutAnchor); @@ -198,13 +179,6 @@ async function validateLink(link) { return validateLink(redirectedLink); } -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 // Check if it's an error code link const errorCodeMatch = urlWithoutAnchor.match(/^\/errors\/(\d+)$/); if (errorCodeMatch) { @@ -338,32 +312,12 @@ async function fetchErrorCodes() { } const codes = await response.json(); errorCodes = new Set(Object.keys(codes)); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes\n`)); -======= - console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`)); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= - console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`)); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= console.log(chalk.gray(`Fetched ${errorCodes.size} React error codes`)); ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 } catch (error) { throw new Error(`Failed to fetch error codes: ${error.message}`); } } -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= -======= ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 async function buildRedirectsMap() { try { const vercelConfigPath = path.join(__dirname, '../vercel.json'); @@ -388,30 +342,12 @@ async function buildRedirectsMap() { } } -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 async function main() { const files = getMarkdownFiles(); console.log(chalk.gray(`Checking ${files.length} markdown files...`)); await fetchErrorCodes(); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= await buildRedirectsMap(); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= - await buildRedirectsMap(); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= - await buildRedirectsMap(); ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 await buildContributorMap(); await buildAnchorMap(files); @@ -421,18 +357,7 @@ async function main() { const totalLinks = results.reduce((sum, r) => sum + r.totalLinks, 0); if (deadLinks.length > 0) { -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= - console.log('\n'); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= - console.log('\n'); ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= console.log('\n'); ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 for (const link of deadLinks) { console.log(chalk.yellow(`${link.file}:${link.line}:${link.column}`)); console.log(chalk.reset(` Link text: ${link.text}`)); diff --git a/src/content/learn/add-react-to-an-existing-project.md b/src/content/learn/add-react-to-an-existing-project.md index 570d9b56f..5d3d44005 100644 --- a/src/content/learn/add-react-to-an-existing-project.md +++ b/src/content/learn/add-react-to-an-existing-project.md @@ -20,23 +20,11 @@ Let's say you have an existing web app at `example.com` built with another serve Here's how we recommend to set it up: -1. **Build the React part of your app** using one of the [React-based frameworks](/learn/creating-a-react-app). +1. **Build the React part of your app** using one of the [React-based frameworks](/learn/start-a-new-react-project). 2. **Specify `/some-app` as the *base path*** in your framework's configuration (here's how: [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath), [Gatsby](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/)). 3. **Configure your server or a proxy** so that all requests under `/some-app/` are handled by your React app. -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -This ensures the React part of your app can [benefit from the best practices](/learn/creating-a-react-app#full-stack-frameworks) baked into those frameworks. -======= This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks. ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= -This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks. ->>>>>>> e07ac94bc2c1ffd817b13930977be93325e5bea9 -======= -This ensures the React part of your app can [benefit from the best practices](/learn/build-a-react-app-from-scratch#consider-using-a-framework) baked into those frameworks. ->>>>>>> e9a7cb1b6ca1659b42d81555ecef0cd554b7a983 Many React-based frameworks are full-stack and let your React app take advantage of the server. However, you can use the same approach even if you can't or don't want to run JavaScript on the server. In that case, serve the HTML/CSS/JS export ([`next export` output](https://nextjs.org/docs/advanced-features/static-html-export) for Next.js, default for Gatsby) at `/some-app/` instead. @@ -161,7 +149,7 @@ root.render(); Notice how the original HTML content from `index.html` is preserved, but your own `NavigationBar` React component now appears inside the `