From 9cb35cca632fae67414bfca5b586cea975b57e62 Mon Sep 17 00:00:00 2001 From: Bobby Galli Date: Thu, 18 Apr 2024 19:57:55 -0400 Subject: [PATCH] fix: support database in package.json --- bin/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/index.ts b/bin/index.ts index 2f74932..3f9c50a 100644 --- a/bin/index.ts +++ b/bin/index.ts @@ -156,14 +156,18 @@ async function fileExists(path: string): Promise { async function getCommandLineOptions(argDefinitions: Array): Promise { const options = commandLineArgs(argDefinitions); - let { application, version } = options; + let { database, application, version } = options; let packageJson; - - if (!application || !version) { + + if (!database || !application || !version) { const packageJsonPath = './package.json'; packageJson = await fileExists(packageJsonPath) ? JSON.parse((await readFile(packageJsonPath)).toString()) : null; } + if (!database && packageJson) { + database = packageJson.database; + } + if (!application && packageJson) { application = packageJson.name; } @@ -174,6 +178,7 @@ async function getCommandLineOptions(argDefinitions: Array