nativescript
Version:
Command-line interface for building NativeScript projects
57 lines • 2.65 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenerateSplashScreensCommand = exports.GenerateIconsCommand = exports.GenerateCommandBase = void 0;
const yok_1 = require("../common/yok");
class GenerateCommandBase {
constructor($options, $injector, $projectData, $stringParameterBuilder, $assetsGenerationService) {
this.$options = $options;
this.$injector = $injector;
this.$projectData = $projectData;
this.$stringParameterBuilder = $stringParameterBuilder;
this.$assetsGenerationService = $assetsGenerationService;
this.allowedParameters = [
this.$stringParameterBuilder.createMandatoryParameter("You have to provide path to image to generate other images based on it."),
];
this.$projectData.initializeProjectData();
}
async execute(args) {
const [imagePath] = args;
await this.generate(imagePath, this.$options.background);
}
}
exports.GenerateCommandBase = GenerateCommandBase;
class GenerateIconsCommand extends GenerateCommandBase {
constructor($options, $injector, $projectData, $stringParameterBuilder, $assetsGenerationService) {
super($options, $injector, $projectData, $stringParameterBuilder, $assetsGenerationService);
this.$options = $options;
this.$projectData = $projectData;
this.$stringParameterBuilder = $stringParameterBuilder;
}
async generate(imagePath, background) {
await this.$assetsGenerationService.generateIcons({
imagePath,
background,
projectDir: this.$projectData.projectDir,
});
}
}
exports.GenerateIconsCommand = GenerateIconsCommand;
yok_1.injector.registerCommand("resources|generate|icons", GenerateIconsCommand);
class GenerateSplashScreensCommand extends GenerateCommandBase {
constructor($options, $injector, $projectData, $stringParameterBuilder, $assetsGenerationService) {
super($options, $injector, $projectData, $stringParameterBuilder, $assetsGenerationService);
this.$options = $options;
this.$projectData = $projectData;
this.$stringParameterBuilder = $stringParameterBuilder;
}
async generate(imagePath, background) {
await this.$assetsGenerationService.generateSplashScreens({
imagePath,
background,
projectDir: this.$projectData.projectDir,
});
}
}
exports.GenerateSplashScreensCommand = GenerateSplashScreensCommand;
yok_1.injector.registerCommand("resources|generate|splashes", GenerateSplashScreensCommand);
//# sourceMappingURL=generate-assets.js.map