diff --git a/docs/docs/dev_docs/contracts/compiling.md b/docs/docs/dev_docs/contracts/compiling.md index 0ea0be008eae..43f7f6b6cdd7 100644 --- a/docs/docs/dev_docs/contracts/compiling.md +++ b/docs/docs/dev_docs/contracts/compiling.md @@ -8,15 +8,12 @@ We'll also cover how to generate a helper [TypeScript interface](#typescript-int ## Prerequisites -You will need the Noir build tool `nargo`, which you can install via [`noirup`](https://github.com/noir-lang/noirup). Make sure you install the `aztec` version of nargo: +You will need the Noir build tool `nargo`, which you can install via [`noirup`](https://github.com/noir-lang/noirup). Make sure you install the correct version of nargo: -```bash -curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash -noirup -v aztec -``` + :::info -You can re-run `noirup -v aztec` whenever you want to update to the latest version of Noir supported by the Aztec Network. +You can run `aztec-cli get-node-info` to query the version of nargo that corresponds to your current installation. ::: ## Compile using the CLI diff --git a/docs/docs/dev_docs/getting_started/noir_contracts.md b/docs/docs/dev_docs/getting_started/noir_contracts.md index 65e27c146430..683bf5e99b7f 100644 --- a/docs/docs/dev_docs/getting_started/noir_contracts.md +++ b/docs/docs/dev_docs/getting_started/noir_contracts.md @@ -13,11 +13,9 @@ If you haven't read [Aztec Sandbox](./sandbox.md), we recommend going there firs ### Dependencies #### `nargo` Nargo is Noir's build tool. On your terminal, run: -```bash -curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash -noirup -v aztec -``` -This ensures you are on the aztec branch of nargo. + + + #### Aztec Sandbox You need to setup the [aztec sandbox](./sandbox.md) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index fbf68ecafed2..8244b8923298 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -5,6 +5,8 @@ const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); const math = require("remark-math"); const katex = require("rehype-katex"); +const path = require("path"); +const fs = require("fs"); /** @type {import('@docusaurus/types').Config} */ const config = { @@ -73,6 +75,33 @@ const config = { }, ], plugins: [ + async function loadVersions(context, options) { + // ... + return { + name: "load-versions", + async loadContent() { + try { + const noirVersionPath = path.resolve( + __dirname, + "../yarn-project/noir-compiler/src/noir-version.json" + ); + const noirVersion = JSON.parse( + fs.readFileSync(noirVersionPath).toString() + ).tag; + return { noir: noirVersion }; + } catch (err) { + throw new Error( + `Error loading Noir version from noir-compiler in docusaurus build. Check load-versions in docusaurus.config.js.\n${err}` + ); + } + }, + async contentLoaded({ content, actions }) { + // await actions.createData("versions.json", JSON.stringify(content)); + actions.setGlobalData({ versions: content }); + }, + /* other lifecycle API */ + }; + }, [ "@docusaurus/plugin-ideal-image", { diff --git a/docs/src/components/InstallNargoInstructions/index.js b/docs/src/components/InstallNargoInstructions/index.js new file mode 100644 index 000000000000..2ee7437259b1 --- /dev/null +++ b/docs/src/components/InstallNargoInstructions/index.js @@ -0,0 +1,12 @@ +import React from "react"; +import CodeBlock from "@theme/CodeBlock"; +import { NoirVersion } from "@site/src/components/Version"; + +export default function InstallNargoInstructions() { + return ( + + {`curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +noirup -v ${NoirVersion()}`} + + ); +} diff --git a/docs/src/components/Version/index.js b/docs/src/components/Version/index.js new file mode 100644 index 000000000000..47f934142430 --- /dev/null +++ b/docs/src/components/Version/index.js @@ -0,0 +1,10 @@ +import React from "react"; +import { usePluginData } from "@docusaurus/useGlobalData"; + +const Versions = () => usePluginData("load-versions").versions; + +export default function Version({ what }) { + return Versions()[what]; +} + +export const NoirVersion = () => Versions()["noir"]; diff --git a/docs/src/theme/MDXComponents.js b/docs/src/theme/MDXComponents.js new file mode 100644 index 000000000000..3d40619c5cc6 --- /dev/null +++ b/docs/src/theme/MDXComponents.js @@ -0,0 +1,14 @@ +import React from "react"; +import MDXComponents from "@theme-original/MDXComponents"; +import Version, { NoirVersion } from "@site/src/components/Version"; +import InstallNargoInstructions from "@site/src/components/InstallNargoInstructions"; +import CodeBlock from "@theme/CodeBlock"; + +// https://docusaurus.io/docs/markdown-features/react#mdx-component-scope +export default { + ...MDXComponents, + Version, + NoirVersion, + InstallNargoInstructions, + CodeBlock, +};