Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: compile guide #1575

Merged
merged 3 commits into from
Aug 17, 2023
Merged

docs: compile guide #1575

merged 3 commits into from
Aug 17, 2023

Conversation

spalladino
Copy link
Collaborator

Fixes #1569


## Installation

To install the package, just run `yarn add @aztec/noir-compiler`.

## Usage

To run the compiler as a CLI tool, run `yarn aztec_noir_compiler compile <path_to_noir_contract_crate>`
To run the compiler as a CLI tool, first install it and then run: `yarn aztec-compile compile --help`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"..., first install the aztec-cli: npm install -g @aztec/cli and then run..."?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be used from both packages! So if you don't want the full-blown aztec cli and just want to compile, you can install the noir compiler only. I'd expect most users to just go via the aztec cli, but it's nice to have a more lightweight alternative. I've added a clarification for this here in the README.

Comment on lines 26 to 32
```
aztec-cli compile ./src/noir
```
Copy link
Contributor

@iAmMichaelConnor iAmMichaelConnor Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the path the the directory containing Nargo.toml, or the path to the src directory containing main.nr? Perhaps we could make that clearer by using a more descriptive path name (and by explicitly stating which directory above this command)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and where (which dir) should this commnd be executed from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified it, and added a reference to the directory structure doc

To generate them, include a `--typescript` option in the compile command with a path to the target folder for the typescript files:

```
aztec-cli compile --typescript ./src/ts/contracts ./src/noir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make the input path name more descriptive (as per another comment).
We might even want to have required named cli parameters for the output-dir and input-dir? (But not for this PR).

Copy link
Collaborator Author

@spalladino spalladino Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might even want to have required named cli parameters for the output-dir and input-dir?

Hmm disagree there. If there is a very specific single thing that is the target of a command, I think it makes more sense as a positional argument rather than a named one. In this case, "I want to compile this". As for output dir, I think it's better that it's optional to make the command easier, as long as we're telling the user where things were written to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting, because my intuition is that the ordering of the args (as they are ordered currently) is backwards. I would expect "the directory I'm compiling" to be the 1st argument, and "the directory I'm outputting code to" to be the 2nd argument. (Similar to the unix mv or cp commands).

It was this confusion (relative to my intuition) that led me to propose naming the arguments (to avoid the confusion).

Alternatively, we could copy solc and have a positional argument for the source directory, and an --output flag for the output directory?

Anyway, this could be a separate issue and PR (if at all). I don't want to hold up this lovely page, given that the current explanation accurately reflects the current code.

Copy link
Collaborator Author

@spalladino spalladino Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could copy solc and have a positional argument for the source directory, and an --output flag for the output directory?

That's my proposal here. The source directory is the only thing required, and the main object you are referring to. The output directory is optional, so we can keep it behind an option.

Just to make sure it's clear: in this example ./src/ts/contracts is not a positional argument, but the value of the typescript option. But if it wasn't clear to you, maybe we need to reconsider. Or perhaps something as simple as rewriting as --typescript=./src/ts would help, assuming commander supports that syntax?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhh, I misunderstood and assumed --typescript was a flag without any arguments.

Copy link
Contributor

@iAmMichaelConnor iAmMichaelConnor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@spalladino
Copy link
Collaborator Author

@iAmMichaelConnor thanks for the thorough review! Just pushed an updated version.

@iAmMichaelConnor iAmMichaelConnor merged commit d93fa96 into master Aug 17, 2023
@iAmMichaelConnor iAmMichaelConnor deleted the docs/compile-guide branch August 17, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

compiling
3 participants