Manage and query NPM packages.
salt.modules.npm.
cache_clean
(path=None, runas=None, env=None)¶Clean cached NPM packages.
If no path for a specific package is provided the entire cache will be cleared.
env
format as the cmd.run
execution
function.CLI 范例:
salt '*' npm.cache_clean
salt.modules.npm.
cache_list
(path=None, runas=None, env=None)¶List NPM cached packages.
If no path for a specific package is provided this will list all the cached packages.
env
format as the cmd.run
execution
function.CLI 范例:
salt '*' npm.cache_clean
salt.modules.npm.
cache_path
(runas=None, env=None)¶List path of the NPM cache directory.
env
format as the cmd.run
execution
function.CLI 范例:
salt '*' npm.cache_path
salt.modules.npm.
install
(pkg=None, pkgs=None, dir=None, runas=None, registry=None, env=None, dry_run=False, silent=True)¶Install an NPM package.
If no directory is specified, the package will be installed globally. If no package is specified, the dependencies (from package.json) of the package in the given directory will be installed.
A list of package names in the same format as the name
parameter
2014.7.0 新版功能.
The NPM registry to install the package from.
2014.7.0 新版功能.
Environment variables to set when invoking npm. Uses the same env
format as the cmd.run
execution
function.
2014.7.0 新版功能.
Whether or not to run NPM install with --silent flag.
2016.3.0 新版功能.
Whether or not to run NPM install with --dry-run flag.
2015.8.4 新版功能.
Wether or not to run NPM install with --silent flag.
2015.8.5 新版功能.
CLI 范例:
salt '*' npm.install coffee-script
salt '*' npm.install coffee-script@1.0.1
salt.modules.npm.
list
(pkg=None, dir=None, runas=None, env=None)¶List installed NPM packages.
If no directory is specified, this will return the list of globally- installed packages.
The user to run NPM with
2014.7.0 新版功能.
Environment variables to set when invoking npm. Uses the same env
format as the cmd.run
execution
function.
2014.7.0 新版功能.
CLI 范例:
salt '*' npm.list
salt.modules.npm.
uninstall
(pkg, dir=None, runas=None, env=None)¶Uninstall an NPM package.
If no directory is specified, the package will be uninstalled globally.
Environment variables to set when invoking npm. Uses the same env
format as the cmd.run
execution
function.
2015.5.3 新版功能.
CLI 范例:
salt '*' npm.uninstall coffee-script