mirror of
https://github.com/erhant/circomkit.git
synced 2026-05-05 03:00:37 -04:00
fix config merging
This commit is contained in:
@@ -75,12 +75,12 @@ async function cli(): Promise<number> {
|
||||
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<number> {
|
||||
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');
|
||||
}
|
||||
|
||||
@@ -46,11 +46,8 @@ export class Circomkit {
|
||||
readonly config: CircomkitConfig;
|
||||
|
||||
constructor(overrides: Partial<CircomkitConfig> = {}) {
|
||||
// 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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user