4.2.1 • Published 8 years ago
npm-package-generator v4.2.1
NPM Package Generator

an opinionated npm package template
The Opinionated Parts
I follow the below set of rules in all projects, npm-package-generator ensures all those rules are followed:
- write in
ES2015,ES2016&ES2017syntax, (supports all plugins inBabelthat are consideredlatest - outputs
npmready packages supporing all LTS versions of Node & Browsers - write tests in
ES2017and run them usingtapwithout needing to compile - generate coverage reports without needing to compile
- runs tests on
travistargeting all LTS versions of Node - uses
.editorconfigfor maintaining consistent coding styles enforced byechint - uses
standardto follow JavaScript Standard Style Guide - ignores
./buildfolder fromgit - use the most permissive open source license (currently
ISC) - follow a preferred folder tree & npm's default expected file naming (see below)
- always expose your package's compiled library modules (see below)
- keep your package lean, only include useful files (compiled & sources) for developers (see
package.json>files) - use a standard template for
READMEfiles. - Testing
Folder Tree
/package-name/
├── build
│ ├── browsers (compiled to last 2 versions of top browsers)
│ │ └── index.js
│ ├── node4 (compiled to Node v4) (default export)
│ │ └── index.js
│ ├── node6 (compiled to Node v6)
│ │ └── index.js
│ └── node7 (compiled to Node v7)
│ └── index.js
├── LICENSE
├── package.json
├── README.md
├── src
│ └── index.js
└── test
├── fixtures
└── index.js/build: compiled library files, this is the default exposed output./src: source library files: all common business logic, use this folder for your code
Work in progress...
This is a work in progress, and will likely be in this state forever!
I will be updating this frequently as common practices change over time, or as I learn new trick.
please reach out to share any feedback & contribution!
Install
npm install --only=production --save npm-package-generatorUsage
$ npm-package-generator new my-awesome-package ~/Projects/my-awesome-package npm-package-generator new <name> [path] [options]
Options:
--help Show help [boolean]
--author, -a Author Name [required] [default: "Ahmad Nassri"]
--description, -d Package Description
--email, -e Author Email [required] [default: "ahmad@ahmadnassri.com"]
--github, -g Github Username [required] [default: "ahmadnassri"]
--website, -w Author Website
[required] [default: "https://www.ahmadnassri.com/"]
--install, -i Install Dependencies? [required] [default: false]API
generator(options)
import generator from 'npm-package-generator'
options = {
path: '~/Projects/my-awesome-package',
name: 'my-awesome-package',
description: 'my-awesome-package',
author: 'Ahmad Nassri',
email: 'ahmad@nassri.email',
website: 'https://www.ahmadnassri.com/',
github: 'ahmadnassri',
install: false
}
generator(options)
.then(files => console.log(files)) //-> [array of files created]options
| option | description | default |
|---|---|---|
name | package name | |
path | installation path | |
author | author name | process.env.NPM_AUTHOR_NAME |
description | package description | process.env.NPM_PACKAGE_DESCRIPTION |
author | author name | process.env.NPM_AUTHOR_NAME |
email | author email | process.env.NPM_AUTHOR_EMAIL |
website | author website | process.env.NPM_AUTHOR_WEBSITE |
github | github account | process.env.NPM_GITHUB_USERNAME |
install | run npm install and update dependencies | false |
:copyright: ahmadnassri.com · License: ISC · Github: @ahmadnassri · Twitter: @ahmadnassri
4.2.1
8 years ago
4.2.0
9 years ago
4.1.2
9 years ago
4.1.1
9 years ago
4.1.0
9 years ago
4.0.0
9 years ago
3.0.1
9 years ago
3.0.0
9 years ago
2.7.0
9 years ago
2.6.0
9 years ago
2.5.0
9 years ago
2.4.1
9 years ago
2.4.0
9 years ago
2.3.0
9 years ago
2.2.0
9 years ago
2.1.2
10 years ago
2.1.1
10 years ago
2.1.0
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago
0.0.0
10 years ago