Skip to content

Commit

Permalink
chore: remove noir-version.json
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Nov 1, 2023
1 parent dc4c867 commit cc25b0f
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 201 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ To build the C++ code, follow the [instructions in the circuits subdirectory](./

To build Typescript code, make sure to have [`nvm`](https://github.com/nvm-sh/nvm) (node version manager) installed.

To build noir code, make sure that you are using the version from `yarn-project/noir-compiler/src/noir-version.json`.
Install nargo by running `noirup -v TAG_FROM_THE_FILE`.
To build noir code, use `yarn-project/noir-compiler`.

## Continuous Integration

Expand Down
1 change: 0 additions & 1 deletion build_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ docs:
- ^.*.cpp$
- ^.*.ts$
- ^.release-please-manifest.json$
- ^.*/noir-version.json$
- ^.*.nr$
dependencies:
- yarn-project
55 changes: 27 additions & 28 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Aztec Network Documentation

Documentation for the Aztec Network, built with docusaurus
Expand Down Expand Up @@ -58,37 +57,37 @@ $ yarn build

This command generates static content into the `build` directory and can be served using any static contents hosting service. When run on Netlify, it will also build the typescript projects needed for extracting type information via typedoc.


## Macros

### `#include_code`

You can embed code snippets into a `.md`/`.mdx` file from code which lives elsewhere in the repo.

- In your markdown file:
- `#include_code identifier path/from/repo/root/to/file.ts language`
- E.g. `#include_code hello path/from/repo/root/to/file.ts typescript`
- See [here](docusaurus.config.js) for supported languages and the exact name to use for that language.
- `#include_code identifier path/from/repo/root/to/file.ts language`
- E.g. `#include_code hello path/from/repo/root/to/file.ts typescript`
- See [here](docusaurus.config.js) for supported languages and the exact name to use for that language.
- In the corresponding code delineate the code snippet with comments:
- ```typescript
some code
some code
// docs:start:hello
more code
more code
// this-will-error <-- you can use docusaurus highlighting comments.
this code will be highlighted red
more code
// highlight-next-line
this line will be highlighted
more code
// highlight-start
this line will be highlighted
this line will be highlighted
// highlight-end
more code
// docs:end:hello
more code
```
- ```typescript
some code
some code
// docs:start:hello
more code
more code
// this-will-error <-- you can use docusaurus highlighting comments.
this code will be highlighted red
more code
// highlight-next-line
this line will be highlighted
more code
// highlight-start
this line will be highlighted
this line will be highlighted
// highlight-end
more code
// docs:end:hello
more code
```
- You can even include chunks of the same piece of code (with different highlighting preferences) into different parts of the docs:
- ```typescript
some code
Expand All @@ -112,7 +111,7 @@ You can embed code snippets into a `.md`/`.mdx` file from code which lives elsew
// docs:end:hello
some code
some code
```
```
- Somewhere in your markdown, you can then write:
- `#include_code hello path/from/repo/root/to/file.ts typescript`
- And somewhere else, you can write:
Expand All @@ -134,9 +133,9 @@ import { AztecPackagesVersion } from "@site/src/components/Version";
<>{AztecPackagesVersion()}</>
```
### `#include_noir_version`
### `#include_noir_version`
This macros will be replaced inline with the required nargo version, which is `0.11.1-aztec.0` at the time of these writing. This value is sourced from `yarn-project/noir-compiler/src/noir-version.json`.
This macros will be replaced inline with the required nargo version, which is `0.18.0-a098541.aztec` at the time of these writing. This value is sourced from `yarn-project/noir-compiler/package.json`.
Alternatively, you can also use the `NoirVersion()` js function, which you need to import explicitly:
Expand Down
16 changes: 10 additions & 6 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ const config = {
name: "load-versions",
async loadContent() {
try {
const noirVersionPath = path.resolve(
__dirname,
"../yarn-project/noir-compiler/src/noir-version.json"
const noirCompilerPackage = JSON.parse(
fs.readFileSync(
path.resolve(
__dirname,
"../yarn-project/noir-compiler/package.json"
),
"utf-8"
)
);
const noirVersion = JSON.parse(
fs.readFileSync(noirVersionPath).toString()
).tag;
const noirVersion =
noirCompilerPackage.dependencies["@noir-lang/noir_wasm"];
const aztecVersionPath = path.resolve(
__dirname,
"../.release-please-manifest.json"
Expand Down
16 changes: 10 additions & 6 deletions docs/src/preprocess/include_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ let versions;
async function getVersions() {
if (!versions) {
try {
const noirVersionPath = path.resolve(
__dirname,
"../../../yarn-project/noir-compiler/src/noir-version.json"
const noirCompilerPackage = JSON.parse(
fs.readFileSync(
path.resolve(
__dirname,
"../../../yarn-project/noir-compiler/package.json"
),
"utf-8"
)
);
const noirVersion = JSON.parse(
fs.readFileSync(noirVersionPath).toString()
).tag;
const noirVersion =
noirCompilerPackage.dependencies["@noir-lang/noir_wasm"];
const aztecVersionPath = path.resolve(
__dirname,
"../../../.release-please-manifest.json"
Expand Down
20 changes: 12 additions & 8 deletions yarn-project/cli/src/unbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { promises as fs } from 'fs';
import JSZip from 'jszip';
import fetch from 'node-fetch';
import * as path from 'path';
import { coerce } from 'semver';

const GITHUB_OWNER = 'AztecProtocol';
const GITHUB_REPO = 'aztec-packages';
Expand Down Expand Up @@ -68,7 +69,7 @@ async function copyFolderFromGithub(data: JSZip, repositoryFolderPath: string, l
* @param repositoryFile - path of the file to copy from github repo
* @param localOutputPath - local path to copy the file to
*/
async function copyFileFromGithub(data: JSZip, repositoryFile: string, localOutputPath: string, log: LogFn) {
async function readFileFromGithub(data: JSZip, repositoryFile: string, log: LogFn): Promise<Buffer> {
log(`Downloading file from github: ${repositoryFile}`);

const file = data.files[repositoryFile];
Expand All @@ -77,11 +78,7 @@ async function copyFileFromGithub(data: JSZip, repositoryFile: string, localOutp
throw new Error(`File not found or it's a directory: ${repositoryFile}`);
}

const filename = path.basename(repositoryFile);
const targetPath = `${localOutputPath}/${filename}`;

const content = await file.async('nodebuffer');
await fs.writeFile(targetPath, content);
return await file.async('nodebuffer');
}

/**
Expand Down Expand Up @@ -120,10 +117,17 @@ async function downloadContractAndBoxFromGithub(
await copyFolderFromGithub(data, boxPath, outputPath, log);

// the expected noir version is contained in
// aztec-packages/yarn-project/noir-compiler/src/noir-version.json
// aztec-packages/yarn-project/noir-compiler/package.json
// copy it in and use to update the package.json script to install that version of noir
const noirVersionPath = `${repoDirectoryPrefix}/yarn-project/noir-compiler/src/noir-version.json`;
await copyFileFromGithub(data, noirVersionPath, outputPath, log);
const pkg = await readFileFromGithub(data, noirVersionPath, log);
const noirWasmVersion = coerce(JSON.parse(pkg.toString()).dependencies['@noir-lang/noir_wasm']);
await fs.writeFile(
path.join(outputPath, 'noir-version.json'),
JSON.stringify({
tag: `v${noirWasmVersion?.major}.${noirWasmVersion?.minor}.${noirWasmVersion?.patch}-aztec.0`,
}),
);

const contractTargetDirectory = path.join(outputPath, 'src', 'contracts');
const boxContainsNoirSource = await isDirectoryNonEmpty(contractTargetDirectory);
Expand Down
16 changes: 2 additions & 14 deletions yarn-project/noir-contracts/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash

# Install noir if it is not installed already
if ! command -v noirup &> /dev/null
then
echo "Installing noir"
source ./scripts/install_noirup.sh
fi

# Update noir
./scripts/install_noir.sh

# Use yarn script to compile and create types
yarn
yarn noir:build:all
yarn noir:build:all
19 changes: 0 additions & 19 deletions yarn-project/noir-contracts/scripts/catch.sh

This file was deleted.

8 changes: 0 additions & 8 deletions yarn-project/noir-contracts/scripts/install_noir.sh

This file was deleted.

22 changes: 0 additions & 22 deletions yarn-project/noir-contracts/scripts/install_noirup.sh

This file was deleted.

20 changes: 0 additions & 20 deletions yarn-project/noir-contracts/scripts/nargo_check.sh

This file was deleted.

62 changes: 0 additions & 62 deletions yarn-project/noir-contracts/scripts/nargo_test.sh

This file was deleted.

5 changes: 0 additions & 5 deletions yarn-project/noir-contracts/scripts/nargo_test_ci.sh

This file was deleted.

0 comments on commit cc25b0f

Please sign in to comment.