@borderless/ts-scripts

Simple, mostly opinionated, scripts to build TypeScript modules

Usage no npm install needed!

<script type="module">
  import borderlessTsScripts from 'https://cdn.skypack.dev/@borderless/ts-scripts';
</script>

README

TS Scripts

NPM version NPM downloads Build status Build coverage

Simple, mostly opinionated, scripts to build TypeScript modules.

Installation

npm install @borderless/ts-scripts --save-dev

Usage

In your package.json you can use the scripts:

{
  "scripts": {
    "lint": "ts-scripts lint",
    "format": "ts-scripts format",
    "specs": "ts-scripts specs",
    "test": "ts-scripts test",
    "prepare": "ts-scripts install && ts-scripts build"
  }
}

Batteries Included

  • install - Installs husky and lint-staged
  • lint - Uses eslint --fix
  • format - Uses prettier --write
  • specs - Uses jest
  • build - Uses rimraf and tsc
  • check - Uses eslint and prettier --check
  • test - Runs check, specs, and build

Configuration

Configuration can get specified in your package.json file under ts-scripts:

  • js - Enables .js files for linting and testing (default: false)
  • react - Enables React.js for linting and testing (default: false)
  • src - An array of source directories to read (default: ["src"])
  • dist - An array of output directories to clean, i.e. outDir in tsconfig.json (default: ["dist"])
  • project An array of tsconfig.json project files for TypeScript (default: ["tsconfig.json"])
  • test An array of test configuration objects (default: [{}])
    • name The name of this test configuration (default: undefined)
    • dir An array of directories to read tests from (default: src)
    • env The environment to use for these tests (default: "node")
    • project The tsconfig.json project file to use for this test (default: "tsconfig.json")

License

MIT