Skip to content

Commit

Permalink
Merge pull request bcc-code#6 from bcc-code/fix/access-error-when-ins…
Browse files Browse the repository at this point in the history
…talling

add error catching for schema-sync folder check
  • Loading branch information
u12206050 authored Dec 7, 2023
2 parents 27bfe5c + fc0c76e commit 9f42417
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 9f42417

Please sign in to comment.