All Projects → ungoldman → module-init

ungoldman / module-init

Licence: ISC license
🏁 Create a new node module with all the right stuff.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to module-init

Oji
(◕‿◕) Text Emoticons Maker
Stars: ✭ 668 (+840.85%)
Mutual labels:  package, module
Pdf Lib
Create and modify PDF documents in any JavaScript environment
Stars: ✭ 3,426 (+4725.35%)
Mutual labels:  create, creation
QuestPDF
QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API.
Stars: ✭ 2,872 (+3945.07%)
Mutual labels:  create, creation
Xcframeworks
Demonstration of creating and integrating xcframeworks and their co-op with static libraries and Swift packages
Stars: ✭ 272 (+283.1%)
Mutual labels:  package, module
Try
Dead simple CLI tool to try Python packages - It's never been easier! 📦
Stars: ✭ 588 (+728.17%)
Mutual labels:  package, module
Nest.land
🦕 The nest.land website
Stars: ✭ 294 (+314.08%)
Mutual labels:  package, module
Cli
🆑📍 Setup automated semver compliant package publishing
Stars: ✭ 272 (+283.1%)
Mutual labels:  package, module
Lass
👧 Lass scaffolds a modern package boilerplate for Node.js
Stars: ✭ 615 (+766.2%)
Mutual labels:  package, module
Sao Nm
Scaffold out a node module.
Stars: ✭ 30 (-57.75%)
Mutual labels:  package, module
dataset
qri dataset definition
Stars: ✭ 16 (-77.46%)
Mutual labels:  package
publish
Publish your module with one command in Deno.
Stars: ✭ 16 (-77.46%)
Mutual labels:  package
go-checksum
Simple tool to calc Golang module checksum of go.mod and module dir.
Stars: ✭ 45 (-36.62%)
Mutual labels:  module
app-version-laravel
Laravel application versioning
Stars: ✭ 24 (-66.2%)
Mutual labels:  package
lvim
My config for LunarVim
Stars: ✭ 71 (+0%)
Mutual labels:  init
gpkg
🌎 A global Node binary manager written in Rust
Stars: ✭ 53 (-25.35%)
Mutual labels:  package
laravel-web-push
Laravel package for sending out push notifications
Stars: ✭ 14 (-80.28%)
Mutual labels:  package
i3blocks-crypto
💵 View your favorite coins' ticker prices with i3blocks.
Stars: ✭ 30 (-57.75%)
Mutual labels:  module
MCM2017
MCM 2017
Stars: ✭ 17 (-76.06%)
Mutual labels:  module
silverstripe-base
A base module for my SilverStripe projects
Stars: ✭ 17 (-76.06%)
Mutual labels:  module
es-cookie
A simple, lightweight module for handling cookies
Stars: ✭ 36 (-49.3%)
Mutual labels:  module

module-init

Create a new node module with all the right stuff.

npm travis standard downloads

Overview

module-init is a command-line tool for generating a new node module.

The following list of files are created based on user input:

  • README.md
    • Automatically generates title, description, and some tasteful badges (version, build status, code style).
    • Auto-populates install, usage, contributing, and license sections with relevant info.
  • LICENSE.md
    • Options: Apache-2.0, BSD-3-Clause, CC0-1.0, ISC, MIT, UNLICENSED.
  • CHANGELOG.md
  • CONTRIBUTING.md
    • Optionally generates contributing guidelines based on CONTRIBUTING.md boilerplate.
  • package.json
  • .travis.yml
    • Covers Node.js 4 and 6.
  • .gitignore
    • Ignores node_modules directory.
  • index.js
    • A blank module entry point file.
  • test/index.js
    • A boilerplate test file using tape.

Optionally runs git init and npm install in the new module directory.

Install

npm install module-init -g

Usage

CLI

$ module-init --help
Usage: module-init [options]
    --dir, -d             specify module directory (default: cwd)
    --version, -v         show version information
    --force, -f           skip prompt and init with defaults
    --help, -h            show help

Example

~ $ module-init -d new-project
? name: new-project
? version: 1.0.0
? description:
? keywords:
? license: ISC
? private: No
? CONTRIBUTING.md: Yes
? linter: standard
? git init: Yes
? npm install: Yes
Initialized empty Git repository in /Users/yourname/new-project/.git/
✓ .gitignore created
✓ .travis.yml created
✓ CHANGELOG.md created
✓ CONTRIBUTING.md created
✓ LICENSE created
✓ README.md created
✓ package.json created
✓ index.js created
✓ test/index.js created
[email protected] node_modules/tape
...
[email protected] node_modules/tap-spec
...
[email protected] node_modules/standard
...
✓ new-project initialized

Node API

module-init can also be required as a regular node module.

Configuration properties from other sources (.gitconfig, current working directory) will not be automatically used as defaults in this mode. All required properties need to be passed in explicitly.

var moduleInit = require('module-init')

var options = {
  pkgName: 'cool-package',          // required
  pkgVersion: '1.0.0',              // required
  usrName: 'Your Name',             // required
  usrEmail: '[email protected]',       // required
  usrGithub: 'githubUsername'       // required
  pkgDescription: 'description',    // optional
  pkgKeywords: 'one, two, three',   // optional
  pkgContributing: true,            // optional, default: true
  pkgLinter: 'standard',            // optional, default: standard
  pkgLicense: 'ISC',                // optional, default: ISC
  private: true,                    // optional, default: false (omitted if false)
  dir: 'project-directory'          // optional: default: cwd
}

moduleInit(options)
  .on('create', function (filename) {
    console.log(`${filename} created`)
    // file created
  })
  .on('warn', function (message) {
    console.log(`warning: ${message}`)
    // something weird but non-critical happened
  })
  .on('err', function (err) {
    console.error(err)
    process.exit(1)
    // something went horribly wrong! stop everything!
  })
  .on('done', function (result) {
    console.log(result) // object containing module metadata
    // done!
  })
  .run() // run the thing

moduleInit returns an event emitter that emits create, warn, err, and done.

moduleInit.on(string, function) works as demonstrated in the example above.

moduleInit.run() runs the initialization process. It also calls moduleInit.validate() internally before proceeding and will emit an err event if required options are missing. Event listeners need to be set before moduleInit.run() is called.

moduleInit.validate() returns an array of missing required options. It returns an empty array if everything's fine. This method is really just for internal use, but is exposed for testing and convenience.

Take a look at bin/cli.js to see how the API is being used by the CLI.

Contributing

Contributions welcome! Please read the contributing guidelines before getting started.

Collaborators

module-init is only possible due to the excellent work of the following collaborators:

bcomnesGitHub/bcomnes
FletGitHub/Flet
paulcpedersonGitHub/paulcpederson
ungoldmanGitHub/ungoldman

See Also

License

ISC

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].