Skip to content

Commit

Permalink
Merge pull request #119 from ipfs/coverage
Browse files Browse the repository at this point in the history
Latest coverage updates and npmignore
  • Loading branch information
daviddias committed Apr 18, 2016
2 parents ceed6e1 + 59bf4ad commit 12fed82
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 11 deletions.
31 changes: 31 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# These are only shipped with npm
dist
lib
30 changes: 30 additions & 0 deletions examples/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Do not ship tests
test
1 change: 1 addition & 0 deletions examples/circle.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ machine:
node:
version: stable

# Up to date Chrome
dependencies:
pre:
- google-chrome --version
Expand Down
14 changes: 14 additions & 0 deletions examples/travis.example.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
sudo: false
language: node_js
node_js:
- 4
- 5

# Make sure we have new NPM.
before_install:
- npm install -g npm

script:
- npm run lint
- npm test
- npm run coverage

addons:
firefox: 'latest'

# Setup xvfb for headless Firefox
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- npm run coverage-publish
33 changes: 22 additions & 11 deletions js-project-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ If you prefer using npm scripts, you can set them up in your package.json:
"test": "aegir-test",
"test:node": "aegir-test node",
"test:browser": "aegir-test browser",
"release": "aegir-release"
"release": "aegir-release",
"coverage": "aegir-coverage",
"coverage-publish": "aegir-coverage publish"
}
}
```
Expand Down Expand Up @@ -163,6 +165,8 @@ To reduce the amount of configuration aegir expects your source code to be in th
├── CONTRIBUTING.md
├── circle.yml
├── .travis.yml
├── .npmignore
├── .gitignore
└── node_modules
```

Expand All @@ -179,17 +183,24 @@ Inside the package.json, the main file exported is the one from the auto-generat

Here you can find samples for [Travis](examples/travis.example.yml) and [circle](examples/circle.example.yml).

We also use [coveralls.io](https://coveralls.io/) to automatically publish coverage reports. This is done from travis using

```yml
script:
- npm run coverage
after_success:
- npm run coverage-publish
```
##### `.gitignore`

To avoid checking in the dist and lib folders, the `.gitignore` file should at least contain:
To avoid checking in unwanted files, the `.gitignore` file should follow
this [example](examples/.gitignore).

```sh
dist
lib
**/node_modules
**/*.log
coverage
```
##### `.npmignore`

Npm uses the `.gitignore` by default, so we have to add a `.npmignore` file
to ensure we actually ship `lib` and `dist` files. You can use this [example](examples/.npmignore) to get started.

##### Dependency management

Expand Down Expand Up @@ -223,13 +234,13 @@ You can use [npmcdn](https://npmcdn.com/) to include those:
If you install the module through npm and require it, you receive the ES5 version ready to be used in Node.js or a module bundler like browserify.

```js
var API = require(ipfs-api)
var API = require('ipfs-api')
```

If you use a module bundler that understands ES2015 like webpack@2 or rollup you can use this syntax to get the original ES2015 source.

```js
const API = require(ipfs-api/src)
const API = require('ipfs-api/src')
```

## FAQ
Expand Down

0 comments on commit 12fed82

Please sign in to comment.