UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

34 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResourcesUpdateCommand = void 0; const yok_1 = require("../../common/yok"); class ResourcesUpdateCommand { constructor($projectData, $errors, $androidResourcesMigrationService) { this.$projectData = $projectData; this.$errors = $errors; this.$androidResourcesMigrationService = $androidResourcesMigrationService; this.allowedParameters = []; this.$projectData.initializeProjectData(); } async execute(args) { await this.$androidResourcesMigrationService.migrate(this.$projectData.getAppResourcesDirectoryPath()); } async canExecute(args) { if (!args || args.length === 0) { // Command defaults to migrating the Android App_Resources, unless explicitly specified args = ["android"]; } for (const platform of args) { if (!this.$androidResourcesMigrationService.canMigrate(platform)) { this.$errors.fail(`The ${platform} does not need to have its resources updated.`); } if (this.$androidResourcesMigrationService.hasMigrated(this.$projectData.getAppResourcesDirectoryPath())) { this.$errors.fail("The App_Resources have already been updated for the Android platform."); } } return true; } } exports.ResourcesUpdateCommand = ResourcesUpdateCommand; yok_1.injector.registerCommand("resources|update", ResourcesUpdateCommand); //# sourceMappingURL=resources-update.js.map