Skip to content

Commit

Permalink
adding a npx create command
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Feb 1, 2024
1 parent 5960b89 commit 142938f
Show file tree
Hide file tree
Showing 5 changed files with 504 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/scripts/latest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { writeFileSync } = require('fs');

const GITHUB_PAGES = 3;

async function main() {
Expand Down
39 changes: 39 additions & 0 deletions npx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env node
import { Command } from 'commander';
import select from '@inquirer/select';
import input from '@inquirer/input';
const program = new Command();
import tiged from 'tiged';

program.action(async () => {
const appType = await select({
message: 'Please choose an option:',
choices: [
{ value: 'vite-hardhat', name: 'Browser App using Vite' },
{ value: 'with-foundry', name: 'Solidity App using Foundry' },
],
});

console.log(`You chose: ${appType}`);

const appName = await input({
message: 'Your app name:',
default: 'my-noir-app',
});

const emitter = tiged(`noir-lang/noir-starter/${appType}`, {
disableCache: true,
force: true,
verbose: true,
});

emitter.on('info', info => {
console.log(info.message);
});

emitter.clone(`./${appName}`).then(() => {
console.log('done');
});
});

program.parse();
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "create-noir",
"version": "0.1.1",
"type": "module",
"description": "This is a reference repo to help you get started with writing zero-knowledge circuits with [Noir](https://noir-lang.org/).",
"bin": "npx.js",
"author": "",
"license": "ISC",
"dependencies": {
"@inquirer/input": "^1.2.16",
"@inquirer/select": "^1.3.3",
"commander": "^11.1.0",
"tiged": "^2.12.6"
}
}
2 changes: 1 addition & 1 deletion vite-hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This example uses [Vite](https://vite.dev/) as the frontend framework, and

Want to get started in a pinch? Start your project in a free Github Codespace!

[![Start your project in a free Github Codespace!](https://github.com/codespaces/badge.svg)](https://codespaces.new/noir-lang/noir-starter)
[![Start your project in a free Github Codespace!](https://github.com/codespaces/badge.svg)](https://codespaces.new/noir-lang/noir-starter/tree/main)

In the meantime, follow these simple steps to work on your own machine:

Expand Down
Loading

0 comments on commit 142938f

Please sign in to comment.