Every time I run the following function, I expect it to output the different paths embedded in my composer.json file and then perform this recursively for each package. However, it just gives me the same result over and over again. Please what am I missing here?
const packageComposer = async (node) => {
node = node ? __dirname : node;
let composer = fs.readFileSync(node + '/composer.json', 'utf8');
let dependencies = Object.keys(JSON.parse(composer).require);
console.log(node + '/composer.json');
dependencies.forEach(key => {
let dependency = key.split('/');
let dir = node + '/vendor/' + dependency[0] + '/' + dependency[1];
if (fs.existsSync(dir)) {
packageComposer(dir);
}
});
}