From cdc105cf4fa6e7ce5b3bbd2c698e6edfa9774f0e Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 20 May 2020 11:27:42 -0700 Subject: [PATCH 1/3] remove "supported versions" in readme text --- packages/coverage/README.md | 2 -- packages/format/README.md | 4 +--- packages/typescript/README.md | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/coverage/README.md b/packages/coverage/README.md index 7ef46b4..50f02f4 100644 --- a/packages/coverage/README.md +++ b/packages/coverage/README.md @@ -4,8 +4,6 @@ Common test coverage configuration for `EthereumJS` libraries. Tool: [nyc](https://istanbul.js.org/) -Supported Version: `^11.7.0` - Exposed CLI command: - `ethereumjs-config-coverage` diff --git a/packages/format/README.md b/packages/format/README.md index b9de586..8566069 100644 --- a/packages/format/README.md +++ b/packages/format/README.md @@ -4,8 +4,6 @@ Common formatting configuration for `EthereumJS` libraries. Tool: [Prettier](https://prettier.io/) -Supported Version: `^1.15.3` - Exposed CLI commands: - `ethereumjs-config-format` @@ -16,7 +14,7 @@ Exposed CLI commands: Add `prettier.config.js`: ```javascript -module.exports = require('@ethereumjs/config-format') +module.exports = require('@ethereumjs/config-format'); ``` Add `.prettierignore`: diff --git a/packages/typescript/README.md b/packages/typescript/README.md index 5144543..fa85096 100644 --- a/packages/typescript/README.md +++ b/packages/typescript/README.md @@ -4,8 +4,6 @@ Common `TypeScript` configuration for `EthereumJS` libraries. Tool: [TypeScript](https://www.typescriptlang.org/) -Supported Version: `^3.2.2` - Exposed CLI commands: - `ethereumjs-config-ts-compile` From 61f05e97b07daaf56c8a6f76673033bff27804d9 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Wed, 20 May 2020 11:29:25 -0700 Subject: [PATCH 2/3] upgrade production target to ES2017, introduce browser build --- packages/typescript/README.md | 29 +++++++++++++++++------ packages/typescript/cli/ts-build.sh | 2 +- packages/typescript/cli/ts-compile.sh | 2 +- packages/typescript/package.json | 2 ++ packages/typescript/tsconfig.browser.json | 8 +++++++ packages/typescript/tsconfig.json | 4 ++-- packages/typescript/tsconfig.prod.json | 6 +++++ 7 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 packages/typescript/tsconfig.browser.json create mode 100644 packages/typescript/tsconfig.prod.json diff --git a/packages/typescript/README.md b/packages/typescript/README.md index fa85096..fdf9d17 100644 --- a/packages/typescript/README.md +++ b/packages/typescript/README.md @@ -15,7 +15,7 @@ Add `tsconfig.json`: ```json { - "extends": "@ethereumjs/config-typescript", + "extends": "@ethereumjs/config-typescript/tsconfig.json", "include": ["src/**/*.ts", "test/**/*.ts"] } ``` @@ -24,15 +24,21 @@ Add `tsconfig.prod.json`: ```json { - "extends": "@ethereumjs/config-typescript", - "compilerOptions": { - "outDir": "./dist" - }, + "extends": "@ethereumjs/config-typescript/tsconfig.prod.json", "include": ["src/**/*.ts"] } ``` -Use CLI commands above in `package.json`: +Add `tsconfig.browser.json`: + +```json +{ + "extends": "@ethereumjs/config-typescript/tsconfig.browser.json", + "include": ["src/**/*.ts"] +} +``` + +Use CLI commands above in your `package.json`: ```json "scripts": { @@ -41,5 +47,14 @@ Use CLI commands above in `package.json`: } ``` +The default production target is ES2017. To support shipping the ES5 target for browsers, add to your `package.json`: - +```json + "main": "dist/index.js", + "types": "dist/index.d.ts", + "browser": "dist.browser/index.js", + "files": [ + "dist", + "dist.browser" + ] +``` diff --git a/packages/typescript/cli/ts-build.sh b/packages/typescript/cli/ts-build.sh index 0b88af0..a6da330 100755 --- a/packages/typescript/cli/ts-build.sh +++ b/packages/typescript/cli/ts-build.sh @@ -1,3 +1,3 @@ #!/bin/sh set -o xtrace -exec tsc -p ./tsconfig.prod.json +tsc -p ./tsconfig.prod.json && test -f ./tsconfig.browser.json && tsc -p ./tsconfig.browser.json \ No newline at end of file diff --git a/packages/typescript/cli/ts-compile.sh b/packages/typescript/cli/ts-compile.sh index b5a5aea..93f695e 100755 --- a/packages/typescript/cli/ts-compile.sh +++ b/packages/typescript/cli/ts-compile.sh @@ -1,3 +1,3 @@ #!/bin/sh set -o xtrace -exec tsc --noEmit +tsc -p ./tsconfig.json diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 967baf6..263d865 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -7,6 +7,8 @@ "author": "Krzysztof Kaczor ", "files": [ "tsconfig.json", + "tsconfig.prod.json", + "tsconfig.browser.json", "cli" ], "bin": { diff --git a/packages/typescript/tsconfig.browser.json b/packages/typescript/tsconfig.browser.json new file mode 100644 index 0000000..4a2ad2e --- /dev/null +++ b/packages/typescript/tsconfig.browser.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist.browser", + "target": "es5", + "lib": ["dom", "es5"] + } +} diff --git a/packages/typescript/tsconfig.json b/packages/typescript/tsconfig.json index f3d1a55..7297410 100644 --- a/packages/typescript/tsconfig.json +++ b/packages/typescript/tsconfig.json @@ -11,7 +11,7 @@ "resolveJsonModule": true, "downlevelIteration": true, "strict": true, - "target": "es5", + "target": "ES2017", "lib": ["es2018"] } -} \ No newline at end of file +} diff --git a/packages/typescript/tsconfig.prod.json b/packages/typescript/tsconfig.prod.json new file mode 100644 index 0000000..f93323e --- /dev/null +++ b/packages/typescript/tsconfig.prod.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist" + } +} From 59e6bfab8b3d310a210081ad0f2939e0ce3bcae4 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Fri, 22 May 2020 06:58:10 -0400 Subject: [PATCH 3/3] typescript: minor changes in script files --- packages/typescript/cli/ts-build.sh | 1 + packages/typescript/cli/ts-compile.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript/cli/ts-build.sh b/packages/typescript/cli/ts-build.sh index a6da330..5ecea1d 100755 --- a/packages/typescript/cli/ts-build.sh +++ b/packages/typescript/cli/ts-build.sh @@ -1,3 +1,4 @@ #!/bin/sh +set -e set -o xtrace tsc -p ./tsconfig.prod.json && test -f ./tsconfig.browser.json && tsc -p ./tsconfig.browser.json \ No newline at end of file diff --git a/packages/typescript/cli/ts-compile.sh b/packages/typescript/cli/ts-compile.sh index 93f695e..a3351b3 100755 --- a/packages/typescript/cli/ts-compile.sh +++ b/packages/typescript/cli/ts-compile.sh @@ -1,3 +1,3 @@ #!/bin/sh set -o xtrace -tsc -p ./tsconfig.json +tsc -p ./tsconfig.json --noEmit