nativescript
Version:
Command-line interface for building NativeScript projects
34 lines • 1.64 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddPlatformCommand = void 0;
const command_base_1 = require("./command-base");
const yok_1 = require("../common/yok");
class AddPlatformCommand extends command_base_1.ValidatePlatformCommandBase {
constructor($options, $platformCommandHelper, $platformValidationService, $projectData, $platformsDataService, $errors) {
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$platformCommandHelper = $platformCommandHelper;
this.$errors = $errors;
this.allowedParameters = [];
this.$projectData.initializeProjectData();
}
async execute(args) {
await this.$platformCommandHelper.addPlatforms(args, this.$projectData, this.$options.frameworkPath);
}
async canExecute(args) {
if (!args || args.length === 0) {
this.$errors.failWithHelp("No platform specified. Please specify a platform to add.");
}
let canExecute = true;
for (const arg of args) {
this.$platformValidationService.validatePlatform(arg, this.$projectData);
if (!this.$platformValidationService.isPlatformSupportedForOS(arg, this.$projectData)) {
this.$errors.fail(`Applications for platform ${arg} cannot be built on this OS`);
}
canExecute = await super.canExecuteCommandBase(arg);
}
return canExecute;
}
}
exports.AddPlatformCommand = AddPlatformCommand;
yok_1.injector.registerCommand("platform|add", AddPlatformCommand);
//# sourceMappingURL=add-platform.js.map
;