UNPKG

nativescript

Version:

Command-line interface for building NativeScript projects

46 lines 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PutFileCommand = void 0; const yok_1 = require("../../yok"); class PutFileCommand { constructor($devicesService, $stringParameter, $options, $projectData, $errors) { this.$devicesService = $devicesService; this.$stringParameter = $stringParameter; this.$options = $options; this.$projectData = $projectData; this.$errors = $errors; this.allowedParameters = [ this.$stringParameter, this.$stringParameter, this.$stringParameter, ]; } async execute(args) { await this.$devicesService.initialize({ deviceId: this.$options.device, skipInferPlatform: true, }); let appIdentifier = args[2]; if (!appIdentifier) { try { this.$projectData.initializeProjectData(); } catch (err) { // ignore the error } if (!this.$projectData.projectIdentifiers) { this.$errors.fail("Please enter application identifier or execute this command in project."); } } const action = async (device) => { appIdentifier = appIdentifier || this.$projectData.projectIdentifiers[device.deviceInfo.platform.toLowerCase()]; await device.fileSystem.putFile(args[0], args[1], appIdentifier); }; await this.$devicesService.execute(action); } } exports.PutFileCommand = PutFileCommand; yok_1.injector.registerCommand(["device|put-file", "devices|put-file"], PutFileCommand); //# sourceMappingURL=put-file.js.map