A collection of Node.js project templates to get you up and running quickly.
- Support for ES2015/ES2016 using Babel
- Writes sourcemaps for debugging and stack traces
- ESLint for static analysis and code style
- API documentation via ESDoc
- Unit tests using Mocha
- Code coverage using Istanbul
- Unit test assertions using Chai and Sinon
Note: some templates require Node.js 4 or newer. Support for Node.js 0.10 and 0.12 can be achieved using
babel-preset-es2015
instead ofbabel-preset-nodejs-lts
.
-
gulp build
ornpm run build
Cleans the
dist
directory, lints your code, transpiles your code using Babel, and writes sourcemaps. -
gulp test
ornpm test
Runs your unit tests using Mocha and displays the report.
-
gulp coverage
ornpm run coverage
Same as
gulp test
except it instruments your code with Istanbul, then runs the tests and displays a summary. Writes lcov report (JSON and HTML formatted) to thecoverage
directory. -
gulp clean
Removes all generated files such as transpiled code, sourcemaps, API docs, and code coverage results.
-
gulp lint-src
andgulp lint-test
Lints your source and unit tests.
-
gulp docs
ornpm run docs
Generates API docs into the
docs
directory.
Here's a general list of how to use these project templates:
- Copy the entire template directory somewhere and rename the directory to the name of your project
- Edit the
package.json
and update thename
and git repository name - Run
git init
- Run
npm install
- Write your code in the
src
directory - Run
gulp test
orgulp coverage
- To publish your package to NPM, run
npm publish
which will trigger thegulp build
task before publishing
Please feel free to add new project templates or fix any issues. Please keep
these project templates consistent. For example, if you add something to
.gitignore
for one template, add it to all other relevant templates.