https://github.com/metonym/template-lib-react
Template for developing React libraries
https://github.com/metonym/template-lib-react
library reactjs template typescript
Last synced: 2 months ago
JSON representation
Template for developing React libraries
- Host: GitHub
- URL: https://github.com/metonym/template-lib-react
- Owner: metonym
- License: mit
- Created: 2019-07-02T13:04:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T04:55:29.000Z (over 3 years ago)
- Last Synced: 2025-07-01T15:13:12.863Z (about 1 year ago)
- Topics: library, reactjs, template, typescript
- Language: TypeScript
- Homepage:
- Size: 1.66 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# template-lib-react
[![Build][build]][build-badge]
[![Coverage][codecov-shield]][codecov]
> Template for developing React libraries in TypeScript and publishing to [npm](https://www.npmjs.com/).
## Getting Started
Clone the template and install its dependencies:
```bash
git clone git@github.com:metonym/template-lib-react.git
cd template-lib-react
yarn install
```
## Available Scripts
### `yarn build`
Builds the project for production.
#### Linting, formatting and committing
To ensure that committed code follows conventions, this project uses `prettier`, `tslint` and git hooks (via `husky`) to automate the linting and formatting of code and commit messages.
### `yarn test`
Runs test using [Jest](https://jestjs.io/) and generates a code coverage report.
### `yarn test:tdd`
Runs tests in "Test-driven Development Mode."
## Publishing to NPM
You must create an NPM account before publishing packages on the NPM registry.
In [package.json](package.json), customize the following metadata before publishing to NPM.
```json
{
"repository": {
"type": "git",
"url": "https://github.com/{USER-NAME}/{REPO-NAME}.git"
},
"homepage": "https://github.com/{USER-NAME}/{REPO-NAME}",
"keywords": ["..."],
"bugs": "https://github.com/{USER-NAME}/{REPO-NAME}/issues"
}
```
### `yarn publish`
Runs the `prepublishOnly` command, which first builds the project for production before publishing the library.
## Linting, formatting and committing
To ensure that committed code follows conventions, this project uses `prettier`, `tslint` and git hooks (via `husky`) to automate the linting and formatting of code and commit messages.
## Tips
When building a React component or library, do not include `react` and `react-dom` as direct dependencies. Instead, include them as `devDependencies` and `peerDependencies`.
## License
[MIT](LICENSE)
[build]: https://travis-ci.com/metonym/template-lib-react.svg?branch=master
[build-badge]: https://travis-ci.com/metonym/template-lib-react
[codecov]: https://codecov.io/gh/metonym/template-lib-react
[codecov-shield]: https://img.shields.io/codecov/c/github/metonym/template-lib-react.svg