diff --git a/docs/README.md b/docs/README.md index 3467d96ccd3..823ccd4552f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -67,8 +67,18 @@ yarn workspace docs build This command generates static content into the _build_ directory and can be served using any static contents hosting service. -3. Verify build by serve a preview of the docs locally: +3. Verify build by serving a preview locally: ```sh yarn workspace docs serve ``` + +## Production Testing + +The site will be deployed at `noir-lang.org/docs/`. Test production configuration locally: + +### Simple Test +```sh +yarn workspace docs production:serve +``` +Access at: `http://localhost:3000/docs/` \ No newline at end of file diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index f74481d4c05..13e03a13496 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -12,7 +12,7 @@ export default { tagline: 'The Universal ZK Circuit Language', favicon: 'img/favicon.svg', url: 'https://noir-lang.org', - baseUrl: '/', + baseUrl: process.env.ENV === 'dev' ? '/' : '/docs/', onBrokenLinks: 'throw', onBrokenMarkdownLinks: process.env.ENV === 'dev' ? 'warn' : 'throw', trailingSlash: false, @@ -28,7 +28,7 @@ export default { docs: { path: process.env.ENV === 'dev' ? 'docs' : 'processed-docs', sidebarPath: './sidebars.js', - routeBasePath: '/docs', + routeBasePath: '/', remarkPlugins: [math], rehypePlugins: [katex], versions: { @@ -149,12 +149,30 @@ export default { name: 'resolve-react', configureWebpack() { return { + output: { + publicPath: process.env.ENV === 'dev' ? '/' : '/docs/', + }, optimization: { innerGraph: false, }, }; }, }), + // Create Netlify redirects only for production/staging + () => ({ + name: 'netlify-redirects', + async postBuild({ outDir }) { + if (process.env.ENV !== 'dev') { + const { writeFileSync } = await import('fs'); + const { join } = await import('path'); + const redirectsContent = `# Netlify redirects for /docs/ routing +/docs/assets/* /assets/:splat 200 +/docs/img/* /img/:splat 200 +/docs/* /:splat 200`; + writeFileSync(join(outDir, '_redirects'), redirectsContent); + } + }, + }), [ 'docusaurus-plugin-typedoc', { diff --git a/docs/package.json b/docs/package.json index 66b1d2cb10e..0bb19d14cb9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,6 +9,7 @@ "clean": "rm -rf ./processed-docs ./processed-docs-cache ./build", "version::stables": "ts-node ./scripts/setStable.ts", "serve": "serve build", + "production:serve": "mkdir -p temp-serve/docs && cp -r build/* temp-serve/docs/ && serve temp-serve -l 3000 && rm -rf temp-serve", "swizzle": "docusaurus swizzle", "cut_version": "yarn version::stables && ./scripts/cut_version.sh" }, diff --git a/docs/src/pages/index.jsx b/docs/src/pages/index.jsx deleted file mode 100644 index 84b4c26ce62..00000000000 --- a/docs/src/pages/index.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import Layout from '@theme/Layout'; -import Link from '@docusaurus/Link'; - -import headerPic from '@site/static/img/homepage_header_pic.jpg'; - -export default function Landing() { - return ( - -
-
-
-

- Noir -

-

- Noir is a language for private and verifiable computing. It enables creating succinct proofs of successful - program execution. More technically, Noir is a Domain Specific Language for SNARK proving systems. It has - been designed to use any ACIR compatible proving system. Its design choices are influenced heavily by Rust - and focuses on a simple, familiar syntax. -

- -
-
- - - -
-
-
-
- - ); -}