genpack
v1.8.0
Published
GenPack is a package generator
Downloads
10
Readme
Description
GenPack is a package generator for npm
Installation
npm install genpack -g
Usage
genpack
Quick Start
To quickly generate an npm module, create a cjs folder + an index.cjs file.
e.g.
📁 package-root
│
└───📁 cjs
│
└─── 📝 index.cjs
📝 index.cjs content ↴
const add = function (a, b)
{
return a + b;
}
module.exports.add = add;
From the CLI, go to the directory, then run:
💻 ↴
$ genpack
You will obtain an NPM hybrid package working with cjs, esm and typescript.
Options
| Options | default | Expect | Description | |---------------|-------------|------------------------------------|--------------------------------------------| | --version, -v | false | boolean | Display GenPack version | | --repo | | string | Repo URL | | --cli | false | boolean | To have the generated module support CLI | | --author | | string | Author name | | --email | | string | Author email | | --license | | mit, cc0_1, bsd, isc, bsd-2-clause | To generate a license for the module |
Commands
To update the esm/index.mjs file after modifying the cjs/index.cjs file, run:
$ npm run genpack:build:esm
To update the tests after modifying unit-test.cjs:
$ npm run genpack:build:test
To run the tests:
$ npm run genpack:test