Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec0c345
commit 4b3e631
Showing
1 changed file
with
11 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,15 @@ | ||
# Contributing | ||
# Contributions Welcome | ||
|
||
## Guidelines | ||
## PR Guidelines | ||
|
||
- [Directory structure for Javascript/Node modules](https://gist.github.com/tracker1/59f2c13044315f88bee9#file-01-directory-structure-md) | ||
- scoped pull requests (related changes only) | ||
- make sure existing tests pass | ||
- add new tests if new functionality is added | ||
|
||
## Issues | ||
## Uses | ||
|
||
Feel free to [open an issue](https://github.com/amercier/npm-package-skeleton/issues/new), | ||
or propose a [pull request](https://github.com/amercier/npm-package-skeleton/pulls). | ||
To prevent duplication, please look at [existing issues](https://github.com/amercier/npm-package-skeleton/issues?q=is%3Aissue) before posting a new one. | ||
|
||
## TL;DR | ||
|
||
| Command | Description | | ||
| -------------- | ---------------------------------------------------------------------------------------------------------- | | ||
| `npm test` | Runs test suite once using [Jest](http://jestjs.io/). | | ||
| `npm start` | Runs test once, watch for changes in dev/test files, then re-runs tests automatically when a file changes. | | ||
| `npm run lint` | Runs [ESLint](https://eslint.org/) linter. | | ||
|
||
## Getting started | ||
|
||
#### Step 1. Checkout repository | ||
|
||
_**Prerequisites:** you need to have `git`, `node` (>=6) and `npm` installed_. | ||
|
||
```bash | ||
git clone https://github.com/amercier/npm-package-skeleton.git | ||
``` | ||
|
||
_(or your clone's Git URL)_ | ||
|
||
#### Step 2. Install NPM dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
#### Step 3. Run tests (run-once mode) | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
```log | ||
> package-skeleton@1.0.4 test ./npm-package-skeleton | ||
> jest | ||
PASS specs/lib/index.spec.js | ||
myModule | ||
✓ exists (4ms) | ||
✓ returns true | ||
Test Suites: 1 passed, 1 total | ||
Tests: 2 passed, 2 total | ||
Snapshots: 0 total | ||
Time: 0.558s, estimated 1s | ||
Ran all test suites. | ||
``` | ||
|
||
**Note:** Use `npm test -- --coverage` to generate code coverage report in the `coverage` directory, and `open coverage/index.html` to view full HTML report. | ||
|
||
#### Step 4. Run tests (TDD mode) | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
||
## Coding standards | ||
|
||
This project follows [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript). It is enforced at build time by [ESLint](http://eslint.org/). | ||
|
||
```bash | ||
npm lint | ||
``` | ||
|
||
**Note:** this is automatically run before the test suite by `npm test`, but not by `npm start` | ||
|
||
## Other commands | ||
|
||
| Command | Description | | ||
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `npm run doc` | Generates API documentation in `esdoc` folder. Not expected to be run manually, since [ESDoc](https://esdoc.org/) hosting service runs it already. | | ||
| `npm run build` | Transpile all files from `src` directory to `dist`, using [Babel](https://babeljs.io/). Not expected to be run manually, since it is automatically run before NPM packaging (`package.json`'s `prepublishOnly` script). | | ||
- Husky (pre-commit hooks) | ||
- ESlint with the [Airbnb Style Guide](https://github.com/airbnb/javascript) | ||
- Prettier (recommended and unicorn/recommended) | ||
- Jest | ||
- JSDocs |