daburu-js-npm
This is an npm template for Javascript.
Last updated 2 years ago by patdaburu .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install daburu-js-npm 
SYNC missed versions from official npm registry.

daburu-js-npm

This is a simple boiler-plate for an NPM module written in JavaScript. In addition to the basics required to publish the module, it also contains setup for unit testing with Mocha, Chai, and Istanbul.

After setting up your npm account and .nprmc file, run the following npm scripts:

npm install
npm publish

eslint

This project includes an .eslintrc.json file and eslint is included as a development dependency. You can lint the project manually by running the following npm script:

npm run lint

Setting up the IDE to Use tslint

If you're using WebStorm, you may need to enable eslint. You can do so by performing the following steps:

    • Hit Ctrl+Alt+2 to open Settings.
  • Under Languages and Frameworks | Javascript | Code Quality Tools | ESLint click the Enable checkbox.

Spaces, or tabs?

The eslint configuration in this project assumes the use of tabs instead of spaces. This may or may not be what you want. You can change that preference by editing the indent rule.

If you're using WebStorm, your default configuration may prefer spaces. If so, perform the following steps:

  • Hit Ctrl+Alt+2 to open Settings.
  • Under Editor | Code Style | TypeScript look at the Tabs and Indent tab.
  • Check the Use tab character box.

Running and Debugging Tests

As we mentioned above, the project includes a unit testing and code coverage frameworks. There are a number of ways to run and debug the tests.

Run the Tests with npm

You can run the test from an npm script like so:

npm run test

This will run the tests and produce a code coverage report.

Runing Tests in WebStorm

This project uses Mocha and it just so happens that WebStorm has nice support for this platform.

To run or debug a single test, you can simply right-click on a test file and run (or debug) it from the context menu.

To create a run/debug configuration for all the tests, perform these steps:

  • From the main menu, go to Run | Edit Configurations...
  • Click the Add New Configuration button (or hit Alt+Insert).
  • Select Mocha from the menu that appears.
  • The default options are typically fine, though you'll need to add a bit of information:
    • Select All in directory
    • Test directory: the path to the test directory
    • Check Include subdirectories

When you run a configuration using the Run with Coverage options, the IDE will produce a coverage report and mark up your code files coverage indicators.

Document Your Code

This project is configured with jsdoc to produce API documentation from the source code.

You can generate the documentation by itself by running the following npm script:

npm run build:doc

This script is also run as part of the normal build process.

Current Tags

  • 1.0.10                                ...           latest (2 years ago)

10 Versions

  • 1.0.10                                ...           2 years ago
  • 1.0.9                                ...           2 years ago
  • 1.0.7                                ...           2 years ago
  • 1.0.6                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |