Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!-- i needed to run webpack from ant build, so this was the solution -->
<macrodef name="nodejs">
<attribute name="module" description="The name of the NodeJS module to execute" />
<attribute name="failonerror" default="true" description="Fail if the exit code is not 0" />
<attribute name="dir" description="Directory to execute task" />
<element name="args" implicit="yes" description="Argument to pass to the exec task" />
<sequential>
<exec executable="cmd.exe" dir="@{dir}" failonerror="@{failonerror}" osfamily="winnt">
<arg line="/c @{module}" />
<args />
</exec>
<exec executable="@{module}" dir="@{dir}" failonerror="@{failonerror}" osfamily="unix" logError="true">
<args />
</exec>
</sequential>
</macrodef>
<nodejs dir="${pathToPackageJson}" module="npm" failonerror="true" >
<arg value="run" />
<arg value="build" />
</nodejs>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment