Meta NPM Packages
Managing tons of NodeJS modules/projects easily.
About Me
- Nicolas Froidure, JavaScript developer
@7Digital - Blogging at InsertAfter
- Tweeting as @nfroidure
The Context
More and more NPM modules.
State of the Node developers
Why ?
- Separation of concerns
- UNIX philosophy
- Reusable
- Community review
- Glory and fame
Downsides
- discoverability issues
- JavaScript fatigue
- maintenance nightmare (until...)
Let's DRY
Metapak
Authoring modules easily
Why ya module?
- 70 NPM modules to manage
- Micro-services at work with
a lot of similar projects - Nothing fitting my needs
- Willing to share & learn from
the community feedback - Feeling guilty to abandon modules
- Maintenance headaches were
limiting my will to innovate
A journey
on metapak internals
The `metapak` Module
- helps to create meta packages
- helps tranforming:
- package.json files
- assets
- git hooks - highly customizable
package.json
- add dependencies
(linter, test framework, CI) - add utility scripts
- manage common fields
(author, engines supports)
Assets
- add licenses
- add CI files
(Dockerfile, circle.yml ...) - template anything
(READMEs, CONTRIBUTING ...)
Git hooks
No bullshit in your repos
Building your own
in 4 simple steps
Focus on creating `metapak-*` modules
Step 1: Bootstrap
- create a `metapak-*` module
- install `npm i --save-dev metapak`
Step 2:
Apply `package.json`
tranformations
Step 3
Step 4
Add Git Hooks
Optionnal
Finally
Add it to your NPM modules:
npm i --save-dev metapak metapak-*; npm i
Advantages
- Don't version what you can compute
- Apply your standards with a simple `npm i`
- Avoid wasting your time on tasks no-one loves!
- composable: you can add several metapackages
to a single module.