feat: don't install if package already exists
This commit is contained in:
parent
f773cd13e6
commit
7cb1ee9c20
1 changed files with 6 additions and 0 deletions
|
@ -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}`,
|
||||
|
|
Reference in a new issue