Skip to content

Commit

Permalink
fix: cli import
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalakkal committed Nov 28, 2023
1 parent a051a3e commit 30bc8cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/halo2-browser-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
working-directory: halo2-lib-js
run: |
npm install
npm add @axiom-crypto/[email protected].4
npm add @axiom-crypto/[email protected].5
- name: Test halo2-lib-js/halo2-wasm VK equivalence
working-directory: halo2-lib-js
run: npm run test:vk
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axiom-crypto/halo2-wasm-cli",
"version": "0.1.4",
"version": "0.1.5",
"description": "Halo2 Javascript library",
"main": "index.js",
"scripts": {
Expand Down
11 changes: 8 additions & 3 deletions cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function getFunctionFromTs(relativePath: string, shouldCircuitFunct
return require("@axiom-crypto/halo2-lib-js");
}
else {
const npmRoot = execSync('npm root -g').toString().trim();
const npmRoot = execSync('npm root').toString().trim();
return require(`${npmRoot}/${moduleName}`);
}
} catch (e) {
Expand Down Expand Up @@ -68,8 +68,13 @@ export async function getRunCircuitFromTs(relativePath: string | undefined) {
const script = new vm.Script(result.outputText);
const customRequire = (moduleName: string) => {
try {
const npmRoot = execSync('npm root -g').toString().trim();
return require(`${npmRoot}/${moduleName}`);
if (moduleName === "@axiom-crypto/halo2-lib-js") {
return require("@axiom-crypto/halo2-lib-js");
}
else {
const npmRoot = execSync('npm root').toString().trim();
return require(`${npmRoot}/${moduleName}`);
}
} catch (e) {
throw new Error(`Cannot find module '${moduleName}'.\n Try installing it globally with 'npm install -g ${moduleName}'`);
}
Expand Down

0 comments on commit 30bc8cb

Please sign in to comment.