Skip to content

Commit

Permalink
Debug path.resolve vs path.join & presence of build folder for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvbrae committed Nov 29, 2024
1 parent f3e2b3a commit 04d66b2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,27 @@ if (args.h || args.help || args._.length > 1) {
});

if (fs.existsSync(path.join(process.cwd(), 'queries.json'))) {
fs.renameSync(path.join(process.cwd(), 'queries.json'), path.join(process.cwd(), `${destinationPath}/queries.json`));
// Debug the difference between path.resolve and path.join on different systems in the CI
// Most likely build/ doesn't exist
console.log("path.resolve(process.cwd(), `${destinationPath}/queries.json`)");
console.log(path.resolve(process.cwd(), `${destinationPath}/queries.json`));
console.log("path.join(process.cwd(), `${destinationPath}/queries.json`)");
console.log(path.join(process.cwd(), `${destinationPath}/queries.json`));
if (! fs.existsSync(path.resolve(process.cwd(), destinationPath))) {
console.log("resolve destinationPath doesn't exist");
console.log("CREATE");
fs.mkdirSync(path.resolve(process.cwd(), destinationPath));
} else {
console.log("resolve destinationPath exists");
}
if (! fs.existsSync(path.join(process.cwd(), destinationPath))) {
console.log("join destinationPath doesn't exist");
console.log("CREATE");
fs.mkdirSync(path.join(process.cwd(), destinationPath));
} else {
console.log("join destinationPath exists");
}

fs.renameSync(path.join(process.cwd(), 'queries.json'), path.resolve(process.cwd(), `${destinationPath}/queries.json`));
};
})();

0 comments on commit 04d66b2

Please sign in to comment.