Skip to content

Commit

Permalink
add error catching for schema-sync folder check
Browse files Browse the repository at this point in the history
  • Loading branch information
adelinn authored Dec 6, 2023
1 parent 27bfe5c commit fc0c76e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/copyConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export async function copyConfig(force: boolean) {
const srcDir = path.resolve(__dirname, 'install');
const targetDir = process.cwd();

// Test if it doesn't already exist then if it does show a warning with 3s before continuing
// Test if it doesn't already exist then if it does exit
if (!force) {
await fs.access(path.resolve(targetDir, 'schema-sync')).then(() => {
console.log('Config folder already exists, use --force to override');
process.exit(0);
}).catch(() => {
console.log('Config folder not found. Installing...');
});
}

Expand Down

0 comments on commit fc0c76e

Please sign in to comment.