According to this documentation
npm supports the "scripts" property of the package.json file, for the
following scripts:
install, postinstall: Run AFTER the package is installed.
So in your package.json
file of your own library, add a section like this:
package.json:
{
"name": "app",
"version": "0.0.0",
"scripts": {
"install": "run some script in any language like node-js or python,..."
}
// ...
}
Then you can write a script file (for example in node-js) to do some jobs like copying your assets to wherever you want, compiling some files, etc.
So final changes would be something like this:
package.json:
{
"name": "app",
"version": "0.0.0",
"scripts": {
"install": "node install-assets.js"
}
// ...
}
And in your install-assets.js
file you can write codes to copy your files:
var ncp = require('ncp').ncp; // ~ npm i ncp
ncp('sourcePath', 'destPath', function (err) {
if (err) {
return console.error(err);
}
console.log('done!');
});