@ethereumjs/config-typescript

2.0.0 • Public • Published

@ethereumjs/config-typescript

Common TypeScript configuration for EthereumJS libraries.

Tool: TypeScript

Exposed CLI commands:

  • ethereumjs-config-ts-compile
  • ethereumjs-config-ts-build

Usage

The three files below compose the functionality built into ./cli/ts-build.sh and ./cli/ts-compile.sh. Note that the browser build is optional, and in the case it's not present in your project, browser builds will be ignored.

Add tsconfig.json:

{
  "extends": "@ethereumjs/config-typescript/tsconfig.json",
  "include": ["src/**/*.ts", "test/**/*.ts"]
}

Add tsconfig.prod.json:

{
  "extends": "@ethereumjs/config-typescript/tsconfig.prod.json",
  "include": ["src/**/*.ts"],
  "compilerOptions": {
    "outDir": "./dist"
  }
}

Add tsconfig.browser.json:

{
  "extends": "@ethereumjs/config-typescript/tsconfig.browser.json",
  "include": ["src/**/*.ts"],
  "compilerOptions": {
    "outDir": "./dist.browser"
  }
}

Note: the outDir property is mandatory to generate assets to a directory.

Use CLI commands above in your package.json:

  "scripts": {
    "tsc":   "ethereumjs-config-ts-compile",
    "build": "ethereumjs-config-ts-build"
  }

The default production target is ES2017. To support shipping the ES5 target for browsers, add to your package.json:

  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "browser": "dist.browser/index.js",
  "files": [
    "dist",
    "dist.browser"
  ]

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @ethereumjs/config-typescript

      Weekly Downloads

      4

      Version

      2.0.0

      License

      MIT

      Unpacked Size

      4.79 kB

      Total Files

      8

      Last publish

      Collaborators

      • acolytec3
      • g11tech
      • axic
      • holgerd77