Npm task
Npm task
Description
Task to process npm, the node package manager.
Npm task parameters
Attribute | Description | Value | Required |
---|---|---|---|
install | install package | no | |
link | link package | no | |
todir | install output dir | default: current dir | no |
run | json file | package.json | yes, with target |
target | npm run <target> | no | |
pack | json file | package.json | no |
Examples
/!\ npm must be installed on the system and set up in the PATH.
<project name="npm task">
<taskdef name="npm"
classname="net.sourceforge.ant4x.taskdefs.javascript.NpmTask"
classpath="PATH/TO/ant4x.jar"/>
<target name="install-npm-package">
<npm install="gulp" todir="project-dir/node_modules"/>
</target>
<target name="run-npm">
<npm run="path/to/package.json" target="compile"/>
</target>
<target name="pack-npm">
<npm pack="dir/to/pack/with/package.json"/>
</target>
</project>