Bail when uninstalling if package.json for TL packages does not exist

It is on purpose that the message is the same than when a package was not installed. From a user standpoint, it only matters that this specific package was not installed.
This commit is contained in:
Jérémie Astori 2018-01-06 01:34:41 -05:00
parent 3971ecff63
commit d2388dc623
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8

View File

@ -23,6 +23,13 @@ program
const packagesPath = Helper.getPackagesPath();
const packagesParent = path.dirname(packagesPath);
const packagesConfig = path.join(packagesParent, "package.json");
const packageWasNotInstalled = `${colors.green(packageName)} was not installed.`;
if (!fs.existsSync(packagesConfig)) {
log.warn(packageWasNotInstalled);
return;
}
const npm = child.spawn(
process.platform === "win32" ? "npm.cmd" : "npm",
@ -59,7 +66,7 @@ program
if (hasUninstalled) {
log.info(`${colors.green(packageName)} has been successfully uninstalled.`);
} else {
log.warn(`${colors.green(packageName)} was not installed.`);
log.warn(packageWasNotInstalled);
}
});
});