Skip to content

Commit

Permalink
Add option to skip updating ignore file (#1005)
Browse files Browse the repository at this point in the history
Facilitate skipping the prompt to update gitignore file for the generated query builder code. We should always check for isTTY before prompting, and also added an option to explicitly opt out of checking.
  • Loading branch information
scotttrinh authored May 6, 2024
1 parent c46ea2c commit 9c4b038
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/generate/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ const run = async () => {
case "--force-overwrite":
options.forceOverwrite = true;
break;
case "--no-update-ignore-file":
options.updateIgnoreFile = false;
break;
default:
exitWithError(`Unknown option: ${flag}`);
}
Expand Down Expand Up @@ -435,6 +438,8 @@ OPTIONS:
When used with the 'queries' generator, also changes output to single-file mode
--force-overwrite
Overwrite <path> contents without confirmation
--no-update-ignore-file
Do not prompt to update gitignore with generated code
`);
}
run();
5 changes: 3 additions & 2 deletions packages/generate/src/edgeql-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ project to exclude these files.`
!RegExp(`^${vcsLine}$`, "m").test(gitIgnoreFile) // not already ignored
) {
if (
await promptBoolean(
isTTY() &&
(await promptBoolean(
gitIgnoreFile === null
? `Checking the generated query builder into version control
is not recommended. Would you like to create a .gitignore file to ignore
Expand All @@ -327,7 +328,7 @@ the query builder directory? The following line will be added:
${vcsLine}\n\n`,
true
)
))
) {
await fs.appendFile(
gitIgnorePath,
Expand Down

0 comments on commit 9c4b038

Please sign in to comment.