generator-node 0,0 editorconfig travis-ci gulp npm

Create a Node.js module

3 years after

Node Generator Build Status Gitter OpenCollective

generator-node creates a base template to start a new Node.js module.

It is also easily composed into your own generators so you can only target your efforts at your generator's specific features.

Maintained by Hemanth.HM.

Install

$ npm install --global generator-node

Usage

$ yo node

Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.

That'll generate a project with all the common tools setup. This includes:

Running tests

Once the project is scaffolded, inside the project folder run:

$ npm test

You can also directly use mocha to run test on single files:

$ npm -g install mocha
$ mocha test/name.js

Publishing your code

Once your tests are passing (ideally with a Travis CI green run), you might be ready to publish your code to npm. We recommend you using npm version to tag release correctly.

$ npm version major
$ git push --follow-tags
# ATTENTION: There is no turning back here.
$ npm publish

Extend this generator

First of all, make sure you're comfortable with Yeoman composability feature. Then in your own generator:

module.exports = generators.Base.extend({
  default: function () {
    this.composeWith('node:app', {
      options: {/* provide the options you want */}
    }, {
      local: require.resolve('generator-node/generators/app')
    });
  }
});

Options

Here's a list of our supported options:

  • boilerplate (Boolean, default true) include or not the boilerplate files (lib/index.js, test/index.js).
  • babel (Boolean, default true) include or not a .babelrc file.
  • cli (Boolean, default false) include or not a lib/cli.js file.
  • editorconfig (Boolean, default true) include or not a .editorconfig file.
  • git (Boolean, default true) include or not the git files (.gitattributes, .gitignore).
  • gulp (Boolean, default true) include or not a gulpfile.
  • license (Boolean, default true) include or not a LICENSE file.
  • travis (Boolean, default true) include or not a .travis.yml file.
  • githubAccount (String) Account name for GitHub repo location.
  • readme (String) content of the README.md file. Given this option, generator-node will still generate the title (with badges) and the license section.

Sub generators

If you don't need all the features provided by the main generator, you can still use a limited set of features by composing with our sub generators directly.

Remember you can see the options of each sub generators by running yo node:sub --help.

  • node:boilerplate
  • node:babel
  • node:cli
  • node:editorconfig
  • node:eslint
  • node:git
  • node:gulp
  • node:readme

Backers

Love Yeoman work and community? Help us keep it alive by donating funds to cover project expenses!
[Become a backer]

License

MIT © Yeoman team (http://yeoman.io)

Related Repositories

generator-node-typescript

generator-node-typescript

A minimal Yeoman Generator for creating NodeJS modules using TypeScript ...

generator-node-express

generator-node-express

A Yeoman Generator for Express Apps ...

generator-node-gulp

generator-node-gulp

Create a Node.js module with yo, including gulp and Mocha unit tests. ...

generator-node-bahmutov

generator-node-bahmutov

My personal Node project boilerplate generator ...

generator-node-module

generator-node-module

A Yeoman module to author Node libraries with Prettier, Jest, Flow and Babel. ...


Top Contributors

SBoudrias hemanth sindresorhus addyosmani zckrs stevemao kevva arthurvr passy shama huei90 eddiemonge melonmanchan zenorocha stefanbuck rhettl seriema Oblongmana mieszko4 amitport aardmark stephenplusplus tjwebb danielchatfield iamstarkov adamzr amirdt22 faustman appleboy canercandan

Dependencies

package version
chalk ^1.1.3
generator-jest ^1.3.0
generator-license ^5.1.0
generator-travis ^1.5.2
git-remote-origin-url ^2.0.0
github-username ^4.0.0
inquirer-npm-name ^2.0.0
lodash ^4.17.4
parse-author ^2.0.0
yeoman-generator ^1.1.1
dev coveralls ^2.13.1
eslint ^4.1.0
eslint-config-xo-space ^0.16.0
jest ^20.0.4
jest-cli ^20.0.4
nsp ^2.6.3
yeoman-assert ^3.0.0
yeoman-test ^1.5.1

Releases

-   v1.11.0 zip tar
-   v1.10.2 zip tar
-   v1.10.1 zip tar
-   v1.10.0 zip tar
-   v1.9.0 zip tar
-   v1.8.3 zip tar
-   v1.8.2 zip tar
-   v1.8.1 zip tar
-   v1.8.0 zip tar
-   v1.7.1 zip tar
-   v1.7.0 zip tar
-   v1.6.1 zip tar
-   v1.6.0 zip tar
-   v1.5.2 zip tar
-   v1.5.1 zip tar
-   v1.5.0 zip tar
-   v1.4.0 zip tar
-   v1.3.1 zip tar
-   v1.3.0 zip tar
-   v1.2.1 zip tar
-   v1.2.0 zip tar
-   v1.1.2 zip tar
-   v1.1.1 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.7.0 zip tar
-   v0.6.0 zip tar
-   v0.5.0 zip tar
-   v0.4.4 zip tar
-   v0.4.3 zip tar