diff --git a/src/commands/install.ts b/src/commands/install.ts index 01754e2..77dccaf 100644 --- a/src/commands/install.ts +++ b/src/commands/install.ts @@ -46,6 +46,12 @@ export default class Install { const db = new lowdb.Low(adapter); await db.read(); + + if (db.data.pkgs.find((val) => val.name === getWahInfo.name)) { + console.error(chalk.red.bold`Package %s is already installed!`, getWahInfo.name); + process.exit(1); + } + db.data.pkgs.push({ name: getWahInfo.name, version: `${getWahInfo.version.major}.${getWahInfo.version.minor}.${getWahInfo.version.patch}-${getWahInfo.version.rel}`,