diff --git a/package.json b/package.json index be875774fad..ab9bf0c9bd8 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "test": "jest", "test:watch": "jest --watch", - "build": "rimraf dist && tsc --project .", + "build": "rimraf dist && tsc --project tsconfig.build.json", "build:watch": "yarn build --watch", "build:link": "yarn build && cd dist && yarn link && rm -rf node_modules && cd ..", "doc": "typedoc && touch docs/.nojekyll" diff --git a/src/dependencies.d.ts b/src/dependencies.d.ts deleted file mode 100644 index f94a6499a99..00000000000 --- a/src/dependencies.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// TODO: Add types to each of these packages, replace them, or add full types here. - -declare module '@metamask/contract-metadata'; - -declare module '@metamask/metamask-eth-abis'; - -declare module 'eth-ens-namehash'; - -declare module 'eth-json-rpc-infura/src/createProvider'; - -declare module 'eth-keyring-controller'; - -declare module 'eth-phishing-detect/src/config.json'; - -declare module 'eth-phishing-detect/src/detector'; - -declare module 'eth-query'; - -declare module 'ethjs-provider-http'; - -declare module 'ethjs-unit'; - -declare module 'isomorphic-fetch'; - -declare module 'single-call-balance-checker-abi'; - -declare module 'web3-provider-engine'; - -declare module 'web3-provider-engine/subproviders/provider'; - -declare module 'web3-provider-engine/zero'; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000000..70df21e1651 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "./dist", + "outDir": "./dist", + "rootDir": "./src" + }, + "include": ["./src/**/*.ts"], + "exclude": ["**/*.test.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index 8db604aaa42..2887202355a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,15 @@ { "compilerOptions": { - "declaration": true, - "declarationDir": "dist", + "baseUrl": ".", "esModuleInterop": true, + "inlineSources": true, "module": "commonjs", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "./src", + "paths": { + "*": ["./types/*"] + }, "sourceMap": true, - "inlineSources": true, "strict": true, "target": "es6" - }, - "include": ["src/**/*.ts"], - "exclude": ["**/*.test.ts"] + } } diff --git a/types/@metamask/contract-metadata.d.ts b/types/@metamask/contract-metadata.d.ts new file mode 100644 index 00000000000..dfbc40c8acb --- /dev/null +++ b/types/@metamask/contract-metadata.d.ts @@ -0,0 +1 @@ +declare module '@metamask/contract-metadata'; diff --git a/types/@metamask/metamask-eth-abis.d.ts b/types/@metamask/metamask-eth-abis.d.ts new file mode 100644 index 00000000000..d26af311c1b --- /dev/null +++ b/types/@metamask/metamask-eth-abis.d.ts @@ -0,0 +1 @@ +declare module '@metamask/metamask-eth-abis'; diff --git a/types/eth-ens-namehash.d.ts b/types/eth-ens-namehash.d.ts new file mode 100644 index 00000000000..1f686f57aea --- /dev/null +++ b/types/eth-ens-namehash.d.ts @@ -0,0 +1 @@ +declare module 'eth-ens-namehash'; diff --git a/types/eth-json-rpc-infura/src/createProvider.d.ts b/types/eth-json-rpc-infura/src/createProvider.d.ts new file mode 100644 index 00000000000..53b9352d5ce --- /dev/null +++ b/types/eth-json-rpc-infura/src/createProvider.d.ts @@ -0,0 +1 @@ +declare module 'eth-json-rpc-infura/src/createProvider'; diff --git a/types/eth-keyring-controller.d.ts b/types/eth-keyring-controller.d.ts new file mode 100644 index 00000000000..7576b89189c --- /dev/null +++ b/types/eth-keyring-controller.d.ts @@ -0,0 +1 @@ +declare module 'eth-keyring-controller'; diff --git a/types/eth-phishing-detect/src/config.json.d.ts b/types/eth-phishing-detect/src/config.json.d.ts new file mode 100644 index 00000000000..6943346451f --- /dev/null +++ b/types/eth-phishing-detect/src/config.json.d.ts @@ -0,0 +1 @@ +declare module 'eth-phishing-detect/src/config.json'; diff --git a/types/eth-phishing-detect/src/detector.d.ts b/types/eth-phishing-detect/src/detector.d.ts new file mode 100644 index 00000000000..cab272fdde9 --- /dev/null +++ b/types/eth-phishing-detect/src/detector.d.ts @@ -0,0 +1 @@ +declare module 'eth-phishing-detect/src/detector'; diff --git a/types/eth-query.d.ts b/types/eth-query.d.ts new file mode 100644 index 00000000000..e857105f282 --- /dev/null +++ b/types/eth-query.d.ts @@ -0,0 +1 @@ +declare module 'eth-query'; diff --git a/types/ethjs-provider-http.d.ts b/types/ethjs-provider-http.d.ts new file mode 100644 index 00000000000..6bee27c95f9 --- /dev/null +++ b/types/ethjs-provider-http.d.ts @@ -0,0 +1 @@ +declare module 'ethjs-provider-http'; diff --git a/types/ethjs-unit.d.ts b/types/ethjs-unit.d.ts new file mode 100644 index 00000000000..9030a9770f7 --- /dev/null +++ b/types/ethjs-unit.d.ts @@ -0,0 +1 @@ +declare module 'ethjs-unit'; diff --git a/types/isomorphic-fetch.d.ts b/types/isomorphic-fetch.d.ts new file mode 100644 index 00000000000..702932253d0 --- /dev/null +++ b/types/isomorphic-fetch.d.ts @@ -0,0 +1 @@ +declare module 'isomorphic-fetch'; diff --git a/types/single-call-balance-checker-abi.d.ts b/types/single-call-balance-checker-abi.d.ts new file mode 100644 index 00000000000..7bcda047d7d --- /dev/null +++ b/types/single-call-balance-checker-abi.d.ts @@ -0,0 +1 @@ +declare module 'single-call-balance-checker-abi'; diff --git a/types/web3-provider-engine.d.ts b/types/web3-provider-engine.d.ts new file mode 100644 index 00000000000..4d03b99ed28 --- /dev/null +++ b/types/web3-provider-engine.d.ts @@ -0,0 +1 @@ +declare module 'web3-provider-engine'; diff --git a/types/web3-provider-engine/subproviders/provider.d.ts b/types/web3-provider-engine/subproviders/provider.d.ts new file mode 100644 index 00000000000..1b953f44368 --- /dev/null +++ b/types/web3-provider-engine/subproviders/provider.d.ts @@ -0,0 +1 @@ +declare module 'web3-provider-engine/subproviders/provider'; diff --git a/types/web3-provider-engine/zero.d.ts b/types/web3-provider-engine/zero.d.ts new file mode 100644 index 00000000000..a1dcda9a562 --- /dev/null +++ b/types/web3-provider-engine/zero.d.ts @@ -0,0 +1 @@ +declare module 'web3-provider-engine/zero';