Easily start a npm package from scratch.
Latest commit 5ca2026 Oct 11, 2016 @IonicaBizau Updated docs
Failed to load latest commit information.
example πŸ“ Mar 26, 2016
lib πŸ“ JSDoc comments Feb 29, 2016
.gitignore Initial commit Feb 22, 2016
CONTRIBUTING.md Updated docs Apr 26, 2016
DOCUMENTATION.md Updated docs Apr 26, 2016
LICENSE Initial commit Feb 22, 2016
README.md Updated docs Oct 11, 2016
package.json ⬆️ 1.0.4 πŸŽ‰ Oct 11, 2016



Patreon PayPal AMA Version Downloads Get help on Codementor

Easily start a npm package from scratch.

☁️ Installation

$ npm i --save np-init

πŸ’‘ ProTip: You can install the cli version of this module by running npm i -g np-init-cli

πŸ“‹ Example

const init = require("np-init");

    name: "foo"
  , description: "This is a test package"
  , dirname: `${__dirname}/result`
}, (err, data) => {
    console.log(err || data);
// $ tree result
// result/
// β”œβ”€β”€ example
// β”‚Β Β  └── index.js
// β”œβ”€β”€ lib
// β”‚Β Β  └── index.js
// └── package.json
// 2 directories, 3 files

πŸ“ Documentation

init(options, callback)

Inits a new npm package.


  • Object options: An object containing the following fields:
    • name (String): The package name. This is required.
    • template (String): The template name to be used (check out js-templates). Defaults to function-export.
    • exampleFile (String): The example file path (default: example/index.js).
    • exampleTemplate (String): The example template (default: "example").
    • description (String): The package description.
    • dirname (String): The path to the directory where to create the project (default: the current directory).
    • pack (Object): The package.json information.
  • Function callback: The callback function.


  • EventEmitter An event emitter emitting the following events:
    • repo_created (data): After the repository was created.
    • package_written (data): After the package.json was written.
    • packy_done (data): After the defaults in package.json were set. Note you can do this using packy.
    • after_init_handler (data): After the afterinit handler was executed.
    • git_add (data): After git add . was executed.
    • git_commit (data): After git commit ... was executed.
    • git_remote_add (data): After git remote add ... was executed.

πŸ˜‹ How to contribute

Have an idea? Found a bug? See how to contribute.

πŸ’° Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. πŸš€

PayPal donations are appreciated too! Each dollar helps.

Thanks! ❀️

πŸ’« Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

πŸ“œ License

MIT © Ionică Bizău