diff --git a/README.md b/README.md index aa957ca..4bd9f29 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ # typescript-starter -[![Greenkeeper badge](https://badges.greenkeeper.io/bitjson/typescript-starter.svg)](https://greenkeeper.io/) A typescript starter for building javascript libraries and projects: * Write **standard, future javascript** – with stable es7 features – today ([stage 3](https://github.com/tc39/proposals) or [finished](https://github.com/tc39/proposals/blob/master/finished-proposals.md) features) @@ -32,27 +31,25 @@ To see how this starter can be used, check out the [`examples`](./examples) fold ## Development zen -This starter includes watch tasks which make development faster and more interactive. They're particularly helpful for [TDD](https://en.wikipedia.org/wiki/Test-driven_development)/[BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) workflows. +This starter includes a watch task which makes development faster and more interactive. It's particularly helpful for [TDD](https://en.wikipedia.org/wiki/Test-driven_development)/[BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) workflows. To start working, run: ``` -$ yarn watch:build +$ yarn watch ``` -which will build and watch the entire project for changes (to both the library source files and test source files). In another tab or terminal window, run: +which will build and watch the entire project for changes (to both the library source files and test source files). As you develop, you can add tests for new functionality – which will initially fail – before developing the new functionality. Each time you save, any changes will be rebuilt and retested. -``` -$ yarn watch:test -``` +Typescript builds on the left, tests run on the right: -As you develop, you can add tests for new functionality – which will initially fail – before developing the new functionality. Each time you save, any changes will be rebuilt and retested. +typescript and AVA watch task Since only changed files are rebuilt and retested, this workflow remains fast even for large projects. ## Enable stronger type checking (recommended) -To make getting started easier, the default `tsconfig.json` is using the `config/tsconfig.flexible` configuration. This will allow you to get started without many warning from Typescript. +To make getting started easier, the default `tsconfig.json` is using the `config/tsconfig.flexible` configuration. This will allow you to get started without many warnings from Typescript. To enable additional Typescript type checking features (a good idea for mission-critical or large projects), change the `extends` value in `tsconfig.json` to `./config/tsconfig.strict`. @@ -65,6 +62,8 @@ $ yarn cov This will create an HTML report of test coverage – source-mapped back to Typescript – and open it in your default browser. +
source-mapped typescript test coverage
+ ## Generate your API docs The src folder is analyzed and documentation is automatically generated using [typedoc](https://github.com/TypeStrong/typedoc). @@ -76,6 +75,8 @@ This command generates API documentation for your library in HTML format. Since types are tracked by Typescript, there's no need to indicate types in JSDoc format. For more information, see the [typedoc documentation](http://typedoc.org/guides/doccomments/). +
source-mapped typescript test coverage
+ For more advanced documentation generation, you can provide your own [typedoc theme](http://typedoc.org/guides/themes/), or [build your own documentation](https://blog.cloudflare.com/generating-documentation-for-typescript-projects/) using the JSON typedoc export: ```bash @@ -84,7 +85,7 @@ $ yarn docs:json ## Generate/update changelog & release -This project is tooled for [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog) to make managing releases easier. See the [standard-version](https://github.com/conventional-changelog/standard-version) documentation for more information on the workflow. +This project is tooled for [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog) to make managing releases easier. See the [standard-version](https://github.com/conventional-changelog/standard-version) documentation for more information on the workflow, or [`CHANGELOG.md`](CHANGELOG.md) for an example. ```bash # bump package.json version, update CHANGELOG.md, git tag the release @@ -112,6 +113,8 @@ unit: Run unit tests test: Lint and test the library +watch: + Watch source files, rebuild library on changes, rerun relevant tests watch:build: Watch source files, rebuild library on changes watch:unit: diff --git a/package.json b/package.json index e0a8c9f..4ace1af 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,11 @@ "build": "trash build && tsc -p tsconfig.json && tsc -p config/tsconfig-module.json", "lint": "tslint src/**/*.ts", "unit": "yarn build && nyc ava", - "check-coverage": "nyc check-coverage --lines 100 --functions 100 --branches 95", + "check-coverage": "nyc check-coverage --lines 100 --functions 100 --branches 100", "test": "yarn lint && yarn unit && yarn check-coverage", - "watch:build": "yarn build -- -w", - "watch:unit": "ava --watch --verbose", + "watch": "trash build && multiview [yarn watch:build] [yarn watch:unit]", + "watch:build": "tsc -p tsconfig.json -w", + "watch:unit": "tsc -p tsconfig.json && ava --watch --verbose", "cov": "yarn unit && yarn html-coverage && opn coverage/index.html", "html-coverage": "nyc report --reporter=html", "send-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov", @@ -30,6 +31,7 @@ "lint": "Lint all typescript source files", "unit": "Run unit tests", "test": "Lint and test the library", + "watch": "Watch source files, rebuild library on changes, rerun relevant tests", "watch:build": "Watch source files, rebuild library on changes", "watch:unit": "Watch the build, rerun relevant tests on changes", "cov": "Run tests, generate the HTML coverage report, and open it in a browser", @@ -46,6 +48,7 @@ "@types/node": "^7.0.5", "ava": "^0.18.1", "codecov": "^1.0.1", + "multiview": "^2.3.1", "npm-scripts-info": "^0.3.6", "nyc": "^10.0.0", "opn-cli": "^3.1.0",