Skip to content

Commit

Permalink
fix: remove module side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
jessecollier committed Nov 27, 2023
1 parent 66e8707 commit 2b9c5a7
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
1 change: 0 additions & 1 deletion packages/api-key-stamper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest",
"typecheck": "tsc -p tsconfig.typecheck.json"
},
Expand Down
17 changes: 9 additions & 8 deletions packages/api-key-stamper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ export type TApiKeyStamperConfig = {
/**
* Signature function abstracting the differences between NodeJS and web environments for signing with API keys.
*/
let signWithApiKey: (input: {
export const signWithApiKey = async (input: {
content: string;
publicKey: string;
privateKey: string;
}) => string;

if (typeof globalThis?.crypto?.subtle !== "undefined") {
signWithApiKey = require("./webcrypto").signWithApiKey;
} else {
signWithApiKey = require("./nodecrypto").signWithApiKey;
}): Promise<string> => {
if (typeof globalThis?.crypto?.subtle !== "undefined") {
const fn = await import("./webcrypto").then((m) => m.signWithApiKey);
return fn(input);
} else {
const fn = await import("./nodecrypto").then((m) => m.signWithApiKey);
return fn(input);
}
}
export { signWithApiKey };

/**
* Stamper to use with `@turnkey/http`'s `TurnkeyClient`
Expand Down
1 change: 0 additions & 1 deletion packages/cosmjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest --passWithNoTests",
"typecheck": "tsc -p tsconfig.typecheck.json"
},
Expand Down
1 change: 0 additions & 1 deletion packages/ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"compile:contracts": "hardhat compile",
"test": "jest",
"typecheck": "tsc -p tsconfig.typecheck.json"
Expand Down
1 change: 0 additions & 1 deletion packages/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest",
"typecheck": "tsc -p tsconfig.typecheck.json"
},
Expand Down
1 change: 0 additions & 1 deletion packages/iframe-stamper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest",
"typecheck": "tsc -p tsconfig.typecheck.json"
},
Expand Down
1 change: 0 additions & 1 deletion packages/viem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest",
"anvil": "anvil",
"typecheck": "tsc -p tsconfig.typecheck.json",
Expand Down
1 change: 0 additions & 1 deletion packages/webauthn-stamper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"prepublishOnly": "pnpm -w run clean-all && pnpm -w run build-all",
"build": "rollup -c",
"clean": "rimraf ./dist ./.cache",
"pack": "npm pack && mv *.tgz /Users/jessecollier/git/test-app-1/",
"test": "jest",
"typecheck": "tsc -p tsconfig.typecheck.json"
},
Expand Down

0 comments on commit 2b9c5a7

Please sign in to comment.