You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Zero-setup. After running `npm install` things will be setup for you :wink:
94
+
-**[Webpack 2](https://webpack.js.org/)** for UMD bundle, with [Tree-shaking](https://webpack.js.org/guides/tree-shaking/) dead code elimination
95
+
- Tests, coverage and interactive watch mode using **[Jest](http://facebook.github.io/jest/)**
96
+
-**[TSLint](https://palantir.github.io/tslint/)** ([standard-config](https://github.com/blakeembrey/tslint-config-standard)) for your code styling
97
+
-**Docs automatic generation and deployment** to `gh-pages`, using **[TypeDoc](http://typedoc.org/)**
98
+
- Automatic types `(*.d.ts)` file generation
99
+
-**[Travis](https://travis-ci.org)** integration and **[Coveralls](https://coveralls.io/)** report
100
+
- (Optional) **Automatic releases and changelog**, using [Semantic release](https://github.com/semantic-release/semantic-release), [Commitizen](https://github.com/commitizen/cz-cli), [Conventional changelog](https://github.com/conventional-changelog/conventional-changelog) and [Husky](https://github.com/typicode/husky) (for the git hooks)
101
+
102
+
#### NPM scripts
103
+
104
+
-`npm t`: Run test suite
105
+
-`npm run test:watch`: Run test suite in [interactive watch mode](http://facebook.github.io/jest/docs/cli.html#watch)
106
+
-`npm run test:prod`: Run linting + generate coverage
107
+
-`npm run build`: Bundles code, create docs and generate typings
108
+
-`npm run build:dev`: Same than `build`, but code is not minified
109
+
-`npm run commit`: Commit using conventional commit style ([husky](https://github.com/typicode/husky) will tell you to use it if you haven't :wink:)
110
+
111
+
#### Automatic releases
112
+
113
+
If you'd like to have automatic releases with Semantic Versioning, follow these simple steps.
114
+
115
+
_**Prerequisites**: you need to create/login accounts and add your project to:_
116
+
- npm
117
+
- Travis
118
+
- Coveralls
119
+
120
+
Set up the git hooks (see [Git hooks section](#git-hooks) for more info):
121
+
122
+
```bash
123
+
node tools/init-hooks
124
+
```
125
+
126
+
Install semantic release and run it (answer NO to "Generate travis.yml").
127
+
128
+
```bash
129
+
npm install -g semantic-release-cli
130
+
semantic-release setup
131
+
# IMPORTANT!! Answer NO to "Generate travis.yml" question. Is already prepared for you :P
132
+
```
133
+
134
+
From now on, you'll need to use `npm run commit`, which is a convenient way to create conventional commits.
135
+
136
+
Automatic releases are possible thanks to [semantic release](https://github.com/semantic-release/semantic-release), which publishes your code automatically on github and npm, plus generates automatically a changelog. This setup is highly influenced by [Kent C. Dodds course on egghead.io](https://egghead.io/courses/how-to-write-an-open-source-javascript-library)
137
+
138
+
#### Git Hooks
139
+
140
+
By default, there are 2 disabled git hooks. You can enable them by running `node tools/init-hooks` (which uses [husky](https://github.com/typicode/husky)). They make sure:
141
+
- You follow a [conventional commit message](https://github.com/conventional-changelog/conventional-changelog)
142
+
- Your build is not gonna fail in [Travis](https://travis-ci.org) (or your CI server), since it's runned locally before `git push`
143
+
144
+
This makes more sense in combination of [automatic releases](#automatic-releases)
145
+
146
+
#### FAQ
147
+
148
+
##### Why using TypeScript and Babel?
149
+
150
+
In most cases, you can compile TypeScript code to ES5, or even ES3. But in some cases, where you use "functional es2015+ features", such as `Array.prototype.find`, `Map`, `Set`... then you need to set `target` to "es6". This is by design, since TypeScript only provides down-emits on syntactical language features (such as `const`, `class`...), but Babel does. So it's set up in a 2 steps build so you can use es2015+ features.
151
+
152
+
This should be transparent for you and you shouldn't even notice. But if don't need this, you can remove Babel from the build:
153
+
- Set target to "es5" or "es3" in `tsconfig.json`
154
+
- Remove `"useBabel": true` from `tsconfig.json`
155
+
156
+
More info in [https://github.com/Microsoft/TypeScript/issues/6945](https://github.com/Microsoft/TypeScript/issues/6945)
157
+
158
+
##### What if I don't want git-hooks, automatic releases or semantic-release?
159
+
160
+
Then you may want to:
161
+
- Remove `commitmsg`, `postinstall` scripts from `package.json`. That will not use those git hooks to make sure you make a conventional commit
162
+
- Remove `npm run semantic-release` from `.travis.yml`
163
+
164
+
##### What if I don't want to use coveralls or report my coverage?
165
+
166
+
Remove `npm run report-coverage` from `.travis.yml`
167
+
168
+
##### What is `npm install` doing the first time runned?
169
+
170
+
It runs the script `tools/init` which sets up everything for you. In short, it:
171
+
- Configures webpack for the build, which creates the umd library, generate docs, etc.
172
+
- Configures `package.json` (typings file, main file, etc)
173
+
- Renames main src and test files
174
+
175
+
## Credits
176
+
177
+
Made with :heart: by [GUCCI-swallow](https://github.com/GUCCI-swallow) and all these wonderful contributors ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
178
+
179
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
0 commit comments