From 1ddb579009cf349a3384af86db707929b6a86b3f Mon Sep 17 00:00:00 2001 From: Kyle Herock Date: Fri, 13 Nov 2020 20:39:57 -0500 Subject: [PATCH 1/2] fix database import for user create command --- api/src/cli/commands/users/create.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/cli/commands/users/create.ts b/api/src/cli/commands/users/create.ts index e036ab2c92..9143cf159a 100644 --- a/api/src/cli/commands/users/create.ts +++ b/api/src/cli/commands/users/create.ts @@ -1,5 +1,5 @@ export default async function usersCreate({ email, password, role }: any) { - const { default: database, schemaInspector } = require('../../../database/index').default; + const { default: database, schemaInspector } = require('../../../database/index'); const { UsersService } = require('../../../services/users'); if (!email || !password || !role) { From c0683dd7f26e4183782ec3ba0d8af46422b27192 Mon Sep 17 00:00:00 2001 From: Kyle Herock Date: Sat, 14 Nov 2020 09:27:58 -0500 Subject: [PATCH 2/2] handle CLI promise rejections and exit with non-zero exit code --- api/src/cli/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/cli/index.ts b/api/src/cli/index.ts index a501ac1f58..e23bc6e221 100644 --- a/api/src/cli/index.ts +++ b/api/src/cli/index.ts @@ -57,4 +57,7 @@ program .description('Count the amount of items in a given collection') .action(count); -program.parse(process.argv); +program.parseAsync(process.argv).catch((err) => { + console.error(err); + process.exit(1); +});