ncmp v0.2.2
NCMP - NPM Client Modules Postprocessor
Deprecated - Not actively maintained!!
NCMP is a simple tool which allows you to perform some postprocessing after npm installs or updates. It is mainly designed for usage in client infrastructures. So if you use npm as your main client package manager.
Installation
npm install ncmp
Configuration
One of the goals of this project is to provide a modular as possible tool for npm postprocessing in web client infrastructures. The developers should have full control about all steps at any time.
The following snippet shows a example ncmp.json
configuration file:
{
"packages": {
"jquery": ["dist/jquery.js", "dist/jquery.min.js"],
"aurelia-framework": "dist/amd/aurelia-framework.js",
"aurelia-templating": "dist/amd/aurelia-templating.js"
},
"ignore": [
"bootstrap"
],
"plugins": []
}
packages
Contains all "registered" packages for further postprocessing. It's a mapping of package names to files for processing.
ignore
All package names listed here are ignored for further steps.
plugins
Lists a set of plugins (in their execution order) which can do more specific postprocessing.
Command-line interface
NCMP has a command-line interface. The following commands are available:
init
With ncmp init
you can initialize your local ncmp installation. It creates you a new ncmp.json
(if it does not exists) with the default values in it.
install
This is the main command from ncmp. It executes all configured plugins in a chain.
scan
Detects all new installed or uninstalled packages (listed under "dependencies" in package.json) and modifies the
ncmp.json
in this way. Use -s
or --silent
to avoid user prompts.
Plugins
Writing Plugins
There are some requirements for new plugins:
- The name of the plugin npm module has to be
ncmp-XXX-plugin
. Where XXX is the string for the "plugins" config section. - The main file has to define and export a function with this signature:
runPlugin(chain)
. The chain has to be returned directly or as promise. - To retrieve the config you have to reference
ncmp
as a peerDependency. You can fetch the config withconfigManager.load()
with the exported configManager variable. - If you want to change the config in your plugin you have to use
configManager.save(newConfig)
. - Create a pull request for this README and extend the list of plugins above.
License
MIT