I am using copyfiles as an npm scirpt
copyfiles -u 2 /src/app/conf.dev.json dist/config/
but in the end I want to get the file renamed
Ho
You must define the callback function:
fs.rename('oldFile.txt', 'newFile.txt', (err) => {
if (err) throw err;
console.log('Rename complete!');
});
Something like that:
"copy": "copyfiles -u 2 /src/app/conf.dev.json dist/config/ && node -e require('fs').rename('dist/config/conf.prod.json','dist/config/conf.json' , (err) => { (err? console.log(err) : console.log('Rename complete!') ) } )"
@see https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback