I have a line in my package.json
"deploy": "yarn build && cd ../../..
build script that should change directory (cd ../../..
) after running the first command (yarn build)
. However, this doesn't seem to trigger changing directory to the root of the project. I have also tried using a separate node task to do so using process.chdir('../../..');
or process.cwd('../../..');
, but these don't work either.
I've also tried using a separate node.js file (changedirectory.js) with the following to change directory in my build command "deploy": "yarn build && node changedirectory.js && cf login
:
try {
process.chdir('../../../');
console.log(`New directory: ${process.cwd()}`);
} catch (err) {
console.error(`chdir: ${err}`);
}
This does show the correct new directory in terminal, but doesn't actually change the working directory.
Is there something I'm missing or can this not be done with node?