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
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+97-2Lines changed: 97 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,47 @@ This library uses following libraries for development:
15
15
-[yarn](https://yarnpkg.com/lang/en/) for package management
16
16
-[npm scripts](https://docs.npmjs.com/misc/scripts) for executing tasks
17
17
18
+
### 🧪 Tests
19
+
20
+
Test are written and run via Jest 💪
21
+
22
+
```sh
23
+
# Run whole test suite once
24
+
yarn test
25
+
# Run test in watch mode
26
+
yarn test:watch
27
+
# Ged code coverage
28
+
yarn test:coverage
29
+
```
30
+
31
+
### 💅 Style guides
32
+
33
+
Style guides are enforced by robots _(I meant prettier and tslint of course 🤖 )_, so they'll let you know if you screwed something, but most of the time, they'll autofix things for you. Magic right ?
34
+
35
+
Lint and format codebase via npm-script:
36
+
37
+
```sh
38
+
#Format and fix lint errors
39
+
yarn ts:style:fix
40
+
```
41
+
42
+
#### Commit conventions (via commitizen)
43
+
44
+
- this is preferred way how to create conventional-changelog valid commits
45
+
- if you prefer your custom tool we provide a commit hook linter which will error out, it you provide invalid commit message
46
+
- if you are in rush and just wanna skip commit message validation just prefix your message with `WIP: something done` ( if you do this please squash your work when you're done with proper commit message so standard-version can create Changelog and bump version of your library appropriately )
- build will creates 4 standard "package" formats:
@@ -26,7 +30,7 @@ This npm library starter:
26
30
-> `types` field in package.json
27
31
-`sideEffects` 👉 [support proper tree-shaking](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) for whole library ( Webpack >= 4). Turn this off or adjust as needed if your modules are not pure!
28
32
29
-
## Start coding in 2 steps !
33
+
## ✌️ start coding in 2 steps
30
34
31
35
1.`git clone https://github.com/Hotell/typescript-lib-starter <your-libary-folder-name> && cd $_`
32
36
@@ -36,7 +40,7 @@ This npm library starter:
36
40
37
41
Yes that's it. Happy coding ! 🖖
38
42
39
-
## Consumption of published library:
43
+
## 💉 Consumption of published library:
40
44
41
45
1. install it 🤖
42
46
@@ -85,7 +89,7 @@ render(App, mountPoint)
85
89
</html>
86
90
```
87
91
88
-
### UMD/ES2015 module aware browsers (no bundler)
92
+
### UMD/ES2015 module aware browsers (no bundler)
89
93
90
94
```html
91
95
<html>
@@ -133,91 +137,29 @@ render(App, mountPoint)
133
137
</html>
134
138
```
135
139
136
-
## Publish your library
137
-
138
-
> #### NOTE:
139
-
>
140
-
> you have to create npm account and register token on your machine
141
-
> 👉 `npm adduser`
142
-
>
143
-
> If you are using scope ( you definitely should 👌) don't forget to [`--scope`](https://docs.npmjs.com/cli/adduser#scope)
144
-
145
-
Execute `yarn release` which will handle following tasks:
146
-
147
-
- bump package version and git tag
148
-
- update/(create if it doesn't exist) CHANGELOG.md
149
-
- push to github master branch + push tags
150
-
- publish build packages to npm
151
-
152
-
> **NOTE:**
153
-
>
154
-
> all package files are gonna be within `/dist` folder from where `npm publish` will be executed
155
-
156
-
> releases are handled by awesome [standard-version](https://github.com/conventional-changelog/standard-version)
See what commands would be run, without committing to git or updating files
179
-
180
-
`yarn release --dry-run`
181
-
182
-
## Check what files are gonna be published to npm
183
-
184
-
-`cd dist && yarn pack` OR `yarn release:preflight` which will create a tarball with everything that would get published to NPM
185
-
186
-
## Check size of your published NPM bundle
187
-
188
-
`yarn size`
189
-
190
-
## Format and fix lint errors
191
-
192
-
`yarn ts:style:fix`
193
-
194
-
## Generate documentation
195
-
196
-
`yarn docs`
197
-
198
-
## Commit ( via commitizen )
199
-
200
-
- this is preferred way how to create conventional-changelog valid commits
201
-
- if you prefer your custom tool we provide a commit hook linter which will error out, it you provide invalid commit message
202
-
- if you are in rush and just wanna skip commit message validation just prefix your message with `WIP: something done` ( if you do this please squash your work when you're done with proper commit message so standard-version can create Changelog and bump version of your library appropriately )
203
-
204
-
`yarn commit` - will invoke [commitizen CLI](https://github.com/commitizen/cz-cli)
205
-
206
-
### Troubleshooting
146
+
## 🕵️♀️ Troubleshooting
207
147
208
148
#### dynamic `import()`
209
149
210
-
This starter uses latest **TypeScript >=2.9** which has support for lazy loading chunks/modules via `import()` and also definition acquisition via [`import('../path-to-module').TypeFoo`](http://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#import-types)
150
+
This starter uses latest **TypeScript >=3.x** which has support for lazy loading chunks/modules via `import()` and also definition acquisition via [`import('../path-to-module').TypeFoo`](http://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#import-types)
211
151
212
152
Before TS 2.9, it wasn't possible to properly generate ambient definitions if you used dynamic `import()`. This works now as expected without any hacks ❤️ !
213
153
214
-
---
215
-
216
-
> ### Before TS 2.9
154
+
> #### Before TS 2.9
217
155
>
218
156
> Please note that if you wanna use that feature, compiler will complain because declaration generation is turned on, and currently TS can't handle type generation with types that will be loaded in the future ( lazily )
219
157
>
220
158
> **How to solve this:**
221
159
>
222
160
> - turn of type checking and don't generate types for that lazy import: `import('./components/button') as any`
223
161
> - or you can use this [temporary workaround](https://github.com/Microsoft/TypeScript/issues/16603#issuecomment-310208259)
0 commit comments