Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest coverage updates and npmignore #119

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word should is a bit hard. This should be reworded to say 'A .gitignore is useful. An example is provided in examples'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, not having this .gitignore can mess up a lot of the rest in this document, and create a lot of other problems, so having if is a "should" surley

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document isn't only for large js-ipfs-* style projects. It is also for small javascript projects that frankly do not need all of these things. The .gitignore here seems excessively bloated for some smaller repos. For example, dnslink-deploy is a JS repo that doesn't need this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the .gitignore you see is pretty much the .gitignore you get when you create a repo on github and select "Node.js" as the type of project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it also has unnecessary things, like .grunt. I feel that it is overkill, and thus we shouldn't use the word should. Do you see what I mean? Am I being unreasonable, here?


```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