refactor script again to read paths from package.json files