Skip to content

Commit fa2386e

Browse files
authored
fix(cli-init): config creation and output (#54)
1 parent 21c9ecf commit fa2386e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ yargs.command(
101101
if (await createMigrationDir(<string>migrationDir)) {
102102
process.stdout.write(`Created ${chalk.cyan(<string>migrationDir)}\n`);
103103
}
104-
createConfig({
104+
await createConfig({
105105
migrationDir: <string>migrationDir,
106106
migrationOutDir: <string>migrationOutDir || './migrations'
107107
});

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ export async function isMerkelRepository(): Promise<boolean> {
171171
/**
172172
* Creates the migration directory
173173
*/
174-
export async function createMigrationDir(migrationDir: string) {
175-
await new Promise((resolve, reject) => mkdirp(migrationDir, (err, made) => err ? reject(err) : resolve(made)));
174+
export function createMigrationDir(migrationDir: string): Promise<boolean> {
175+
return new Promise((resolve, reject) => mkdirp(migrationDir, (err, made) =>
176+
/* istanbul ignore next */
177+
err ? reject(err) : resolve(!!made)
178+
));
176179
}
177180

178181
/**

0 commit comments

Comments
 (0)