Archived
0
0
Fork 0

feat: don't install if package already exists

This commit is contained in:
Daryl Ronningen 2022-09-06 10:14:54 -07:00
parent f773cd13e6
commit 7cb1ee9c20
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B

View file

@ -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}`,