nativescript
Version:
Command-line interface for building NativeScript projects
55 lines • 2.42 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreUninstallCommand = void 0;
const path = require("path");
const helpers_1 = require("../helpers");
const constants_1 = require("../../constants");
const yok_1 = require("../yok");
class PreUninstallCommand {
constructor($analyticsService, $extensibilityService, $fs,
// private $opener: IOpener,
$packageInstallationManager, $settingsService) {
this.$analyticsService = $analyticsService;
this.$extensibilityService = $extensibilityService;
this.$fs = $fs;
this.$packageInstallationManager = $packageInstallationManager;
this.$settingsService = $settingsService;
// disabled for now (6/24/2020)
// private static FEEDBACK_FORM_URL = "https://www.nativescript.org/uninstall-feedback";
this.allowedParameters = [];
}
async execute(args) {
const isIntentionalUninstall = (0, helpers_1.doesCurrentNpmCommandMatch)([
/^uninstall$/,
/^remove$/,
/^rm$/,
/^r$/,
/^un$/,
/^unlink$/,
]);
await this.$analyticsService.trackEventActionInGoogleAnalytics({
action: "Uninstall CLI" /* TrackActionNames.UninstallCLI */,
additionalData: `isIntentionalUninstall${constants_1.AnalyticsEventLabelDelimiter}${isIntentionalUninstall}${constants_1.AnalyticsEventLabelDelimiter}isInteractive${constants_1.AnalyticsEventLabelDelimiter}${!!(0, helpers_1.isInteractive)()}`,
});
if (isIntentionalUninstall) {
await this.handleIntentionalUninstall();
}
this.$fs.deleteFile(path.join(this.$settingsService.getProfileDir(), "KillSwitches", "cli"));
await this.$analyticsService.finishTracking();
}
async handleIntentionalUninstall() {
this.$extensibilityService.removeAllExtensions();
this.$packageInstallationManager.clearInspectorCache();
await this.handleFeedbackForm();
}
async handleFeedbackForm() {
// disabled for now (6/24/2020)
// if (isInteractive()) {
// this.$opener.open(PreUninstallCommand.FEEDBACK_FORM_URL);
// }
return Promise.resolve();
}
}
exports.PreUninstallCommand = PreUninstallCommand;
yok_1.injector.registerCommand("dev-preuninstall", PreUninstallCommand);
//# sourceMappingURL=preuninstall.js.map
;