removing a directory before cordova build : in my hybrid project i have a node modules directory which does not need to participate in the apk construction. 

by reading the [cordova documentation about hooks][1] i ended up with the following script:

    #!/usr/bin/env node
    
    // before_build_android.js
    
    console.log("*** running before build ***");
    const spawn = require('child_process').execSync;
    console.log(spawn("pwd").toString("utf-8"));
    console.log(spawn("rm -rf ./platforms/android/assets/www/node_modules").toString("utf-8"));
    console.log("*** done ***");

and in my config.xml i have it referenced:

    <!-- ... -->
    <platform name="android">
        <hook type="before_build" src="hooks/before_build_android.js"/>
        <allow-intent href="market:*" />
    </platform>
    <!-- ... -->

however it does not work.

any guidance about how to remove this in order to avoid it to be added to the .apk file? node_modules is too big and all i need is the build.js generated by browserify.


  [1]: http://cordova.apache.org/docs/en/dev/guide/appdev/hooks/index.html#Hooks%20Guide
