You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to copy some files after in a post-install script using the following code
const mappings = [{
name:"",
mappings: {
from: "", to: "", up: 2
}
}];
mappings
.forEach(({ name, mappings: fileMappings }) => {
process.chdir(dirname); // derived from name
console.log("-- chdir ", dirname);
fileMappings.forEach(({ from, to, up }) => {
to = path.resolve(rootDir, to);
copyfiles([from, to], {
up: up || 0,
verbose: true,
}, (result) => {
console.log(result);
})
console.log("-- copy files successful");
});
})
From the logs it appears that the copyfiles function executes asynchronously and copies all the files at the end. Since, I am changing the directory with each mapping, the last directory gets picked up for all the mappings. Is there a way to force copyfiles to run synchronously?
The text was updated successfully, but these errors were encountered:
I am trying to copy some files after in a post-install script using the following code
From the logs it appears that the copyfiles function executes asynchronously and copies all the files at the end. Since, I am changing the directory with each mapping, the last directory gets picked up for all the mappings. Is there a way to force copyfiles to run synchronously?
The text was updated successfully, but these errors were encountered: