diff --git a/src/bin/index.ts b/src/bin/index.ts index 75ed4e7..d733715 100644 --- a/src/bin/index.ts +++ b/src/bin/index.ts @@ -75,12 +75,12 @@ async function cli(): Promise { case 'info': { circomkit.log('\n=== Circuit information ===', 'title'); const info = await circomkit.info(process.argv[3]); - circomkit.log(` # of Wires: ${info.variables}`); - circomkit.log(` # of Constraints: ${info.constraints}`); - circomkit.log(` # of Private Inputs: ${info.privateInputs}`); - circomkit.log(` # of Public Inputs: ${info.publicInputs}`); - circomkit.log(` # of Labels: ${info.labels}`); - circomkit.log(` # of Outputs: ${info.outputs}`); + circomkit.log(`Number of of Wires: ${info.variables}`); + circomkit.log(`Number of Constraints: ${info.constraints}`); + circomkit.log(`Number of Private Inputs: ${info.privateInputs}`); + circomkit.log(`Number of Public Inputs: ${info.publicInputs}`); + circomkit.log(`Number of Labels: ${info.labels}`); + circomkit.log(`Number of Outputs: ${info.outputs}`); break; } @@ -142,12 +142,12 @@ async function cli(): Promise { circomkit.log('\n=== Initializing project ===', 'title'); const baseDir = process.argv[3] || '.'; await Promise.all( - [initFiles.circuit, initFiles.circuits, initFiles.input, initFiles.tests].map(item => { + Object.values(initFiles).map(item => { const path = `${baseDir}/${item.dir}/${item.name}`; if (!existsSync(path)) { mkdirSync(`${baseDir}/${item.dir}`, {recursive: true}); writeFileSync(path, item.content); - circomkit.log('Created: ' + path, 'success'); + circomkit.log('Created: ' + path); } else { circomkit.log(path + ' exists, skipping.', 'error'); } diff --git a/src/circomkit.ts b/src/circomkit.ts index d05cdd3..a4bdb18 100644 --- a/src/circomkit.ts +++ b/src/circomkit.ts @@ -46,11 +46,8 @@ export class Circomkit { readonly config: CircomkitConfig; constructor(overrides: Partial = {}) { - // override default options, if any - const config: CircomkitConfig = { - ...defaultConfig, - ...overrides, - }; + // override default options with the user-provided ones + const config: CircomkitConfig = Object.assign({}, overrides, defaultConfig); // sanitize this.config = config; diff --git a/src/utils/initFiles.ts b/src/utils/initFiles.ts index 6f3b033..6b7dc7b 100644 --- a/src/utils/initFiles.ts +++ b/src/utils/initFiles.ts @@ -12,7 +12,7 @@ */ export const initFiles = { circuit: { - dir: './circuits', + dir: 'circuits', name: 'multiplier.circom', content: `pragma circom 2.0.0; @@ -32,7 +32,7 @@ template Multiplier(N) { }`, }, input: { - dir: './inputs/multiplier_3', + dir: 'inputs/multiplier_3', name: '80.json', content: `{ "in": [2, 4, 10] @@ -52,7 +52,7 @@ template Multiplier(N) { `, }, tests: { - dir: './tests', + dir: 'tests', name: 'multiplier.test.ts', content: `import { WasmTester } from "circomkit";