Npm

Description

Task to process npm, the node package manager.

Npm task parameters

Attribute Description Value Required
install install package no
todir install output dir default: current dir no
run json file package.json yes, with target
target npm run <target> 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"/>
  </target>
  
  <target name="run-npm"> 
  <npm run="path/to/package.json" target="compile"/>
  </target>
                    </project>