nativescript
Version:
Command-line interface for building NativeScript projects
47 lines (46 loc) • 2.01 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, $packageInstallationManager, $settingsService) {
this.$analyticsService = $analyticsService;
this.$extensibilityService = $extensibilityService;
this.$fs = $fs;
this.$packageInstallationManager = $packageInstallationManager;
this.$settingsService = $settingsService;
this.allowedParameters = [];
}
async execute(args) {
const isIntentionalUninstall = (0, helpers_1.doesCurrentNpmCommandMatch)([
/^uninstall$/,
/^remove$/,
/^rm$/,
/^r$/,
/^un$/,
/^unlink$/,
]);
await this.$analyticsService.trackEventActionInGoogleAnalytics({
action: "Uninstall CLI",
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() {
return Promise.resolve();
}
}
exports.PreUninstallCommand = PreUninstallCommand;
yok_1.injector.registerCommand("dev-preuninstall", PreUninstallCommand);