nodejs-pkj-template

The template for manager Node.js package

Usage no npm install needed!

<script type="module">
  import nodejsPkjTemplate from 'https://cdn.skypack.dev/nodejs-pkj-template';
</script>

README

nodejs-pkj-template

This is the template for starting a Node.js package

Quick Start

Create the app:

mkdir /tmp/foo && cd $_;
npm init -y;

Since the package is ESM, install ESM:

npm i -S esm;

Install nodejs-pkj-template:

npm i -S nodejs-pkj-template;

Create main module:

vi /tmp/foo/app.js;
/* /tmp/foo/app.js */
import {add, sub, div, mul} from 'nodejs-pkj-template';
console.log(`add(1,2)=${add(1,2)}`);
console.log(`sub(1,2)=${sub(1,2)}`);
console.log(`div(1,2)=${div(1,2)}`);
console.log(`mul(1,2)=${mul(1,2)}`);

Run the main module:

cd /tmp/foo/;
node -r esm app;

Unit test the package

Test nodejs-pkj-template:

cd ./node_modules/nodejs-pkj-template/;
npx jest --coverage;
#npm run test;

License

MIT

Author

  • Github: sasadango mail to: caution.sk@gmail.com