Skip to content

Instantly share code, notes, and snippets.

@waghcwb
Created September 26, 2019 01:37
Show Gist options
  • Save waghcwb/5833ab5534c912683eabfeadd1ca999f to your computer and use it in GitHub Desktop.
Save waghcwb/5833ab5534c912683eabfeadd1ca999f to your computer and use it in GitHub Desktop.
<!-- 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