Skip to content

Commit

Permalink
refactor(npm package): cli restructure (#15)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: npm packaging, cli

* build, update tooling for editor, ci, testing
* build, readme cli additions, contributing
* build, github request templates
* cli, added bin script
* docker, cmd script updated towards cli
* tests, breakout ecma class for testing
  • Loading branch information
cdcabrera committed Apr 14, 2019
1 parent 93f1a27 commit df33695
Show file tree
Hide file tree
Showing 31 changed files with 3,738 additions and 748 deletions.
20 changes: 20 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
coverage:
precision: 2
round: down
range: "50...95"

status:
project:
default:
target: "65%"
patch:
default: off
changes:
default: off

comment:
layout: "header, reach, diff, flags, files, footer"
behavior: default
require_changes: no
require_base: no
require_head: yes
12 changes: 9 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.snap]
max_line_length = off
trim_trailing_whitespace = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false
18 changes: 12 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"parser": "babel-eslint",
"env": {
"node": true,
"es6": true
"es6": true,
"jest": true,
"node": true
},
"plugins": [
"jest",
"node",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:node/recommended",
"plugin:prettier/recommended"
],
Expand All @@ -25,22 +28,25 @@
"max-len": [
"error",
{
"code": 200,
"code": 240,
"ignoreUrls": true
}
],
"no-plusplus": 0,
"padded-blocks": 0,
"space-before-function-paren": 0,
"no-console": 0,
"no-debugger": 1,
"no-plusplus": 0,
"node/no-unsupported-features/es-syntax": 1,
"node/shebang": 0,
"node/no-unpublished-bin": 0,
"padded-blocks": 0,
"prettier/prettier": [
"error",
{
"singleQuote": true,
"printWidth": 100
}
],
"space-before-function-paren": 0,
"valid-jsdoc": [
1,
{
Expand Down
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug Report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug report
about: A clear and concise description of what the bug is.

---

## Summary:
<!-- Provide a description of the issue being raised. -->

### Steps to reproduce
<!-- List clear steps to reproduce the bug. -->
1.
1.

### Expected Result
<!-- Describe the expected behavior for the program. -->
...

## Additional Context
<!-- Append a demo/screenshot/animated gif of the problem. Package.json version, tag, or git commit information. -->
...
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature Request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest a feature, or enhancement, for this project.

---

## Feature description
As user X, I want Y to happen so that Z.

### Is your feature request related to a problem?
<!-- Provide a clear, concise description of what the problem is. -->
...

### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
...

## Acceptance Criteria

- [ ] X should happen
- [ ] Y should also happen for Z

<!-- ## Assumptions and Questions -->
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## What's included
<!-- List your changes/additions, or commits -->
...

<!-- ### Notes -->
<!-- Anything funky about your updates. Or issues that aren't resolved by this merge request, things of note? -->

## How to test
<!-- Are there directions to test/review? -->
<!--
### Coverage and basic unit test check
1. update the NPM packages with `$ yarn`
1. `$ yarn test`
### Interactive unit test check
1. update the NPM packages with `$ yarn`
1. `$ yarn test:dev`
-->
...

## Example
<!-- Append a demo/screenshot/animated gif, or a link to the aforementioned, of the cli output -->
...

## Updates issue/story
<!-- What issue/story does this update, i.e Updates #33 -->
22 changes: 18 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
.env.local
*.log
dist
# dependencies
node_modules
package-lock.json
.yarn-integrity

# coverage
lib-cov
coverage
.nyc*
docs
*.lcov

# logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
api-debug*

# misc
.env
.docs
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*
!package.json
!bin/**/*.js
!data/**/*.js
!src/**/*.js
src/**/*test.js
src/**/*.archive
!LICENSE
!README.md
!CHANGELOG.md
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js

cache: yarn

jobs:
include:
- stage: test
env:
- NAME=yarn
node_js: "10"
before_script: yarn global add codecov
script: yarn test
after_success: codecov
48 changes: 48 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contributing

## Commits
For consistency we make use of [Conventional Commits](https://www.conventionalcommits.org). It's encouraged that
commit messaging follow the format
```
<type>[optional scope]: <description>
```

### Build Requirements
To setup your work environment you'll need to use
* [NodeJS version 10+](https://nodejs.org/)
* [Yarn 1.13+](https://yarnpkg.com)
* And if you plan on making Docker contributions you may want to setup
- [Docker](https://docs.docker.com/engine/installation/)

### Developing
To start work
```shell
$ yarn
$ yarn start:dev
```

#### Testing during development
Jest is used for the unit test framework. To run unit tests during development open a terminal instance and run
```shell
$ yarn test:dev
```

This should also let you update the code snapshots.

### Code Coverage
The requirements for code coverage are currently maintained around the `60%` to `70%` mark.

Updates that drop coverage below the current threshold should have their coverage expanded before being merged.

Settings for coverage can be found in [package.json](./package.json)

#### To check test coverage
```shell
$ yarn test
```

#### Code coverage failing to update?
If you're having trouble getting an accurate code coverage report, or it's failing to provide updated results (i.e. you renamed files) you can try running
```
$ yarn test:clearCache
```
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM node:10-alpine

WORKDIR /app

COPY package.json /app/
ADD ./data/example.js /data/example.js
COPY . /app

Expand All @@ -12,7 +11,4 @@ VOLUME /docs
RUN yarn --production --non-interactive \
&& yarn cache clean

ENV PORT=8000

EXPOSE ${PORT}
CMD ["yarn", "start:container"]
CMD ["yarn", "start"]
Loading

0 comments on commit df33695

Please sign in to comment.