UNPKG

maestro-cli-roku

Version:

command line tools for maestro-roku projects

61 lines (60 loc) 3.85 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ProcessorConfig_1 = require("./lib/fileProcessing/ProcessorConfig"); var ProjectProcessor_1 = require("./lib/fileProcessing/ProjectProcessor"); var CreateViewCommand_1 = require("./lib/projectCommands/CreateViewCommand"); var InstallFrameworkCommand_1 = require("./lib/projectCommands/InstallFrameworkCommand"); var program = require('commander'); var pkg = require('../package.json'); var path = require('path'); program .version(pkg.version) .description("\n Command Line Interface for Maestro projects.\n Read more here https://github.com/georgejecook/maestro/blob/master/docs/index.md#maestro-cli\n"); //compile program .command('compile <config>') .alias('c') .option('-s, --sourcePath [path]', "Root path of project/build folder (e.g. roku-deploy staging folder).\n All files under this folder will be duplicated") .option('-S, --sourcePaths [paths]', "Array of source paths, they will be layered in the order they are given (e.g. last path overwrites first when duplicates are encountered)") .option('-o, --outputPath [path]', "Path where the processed project will be duplicated to.\n This is the code you will deploy on your roku/distribute") .option('-f, --filePattern [value]', "Array of globs corresponding to files to process.\n Relative to sourcePath") // tslint:disable-next-line:max-line-length .option('-x, --nonCheckedImports [value]', "Array of paths, relative to pkg:/root, indicating\n any files you do not want to be checked for existence when checking imports.\n This is important for interoperation with other parts of your build chain,\n which might not yet be in your build folder") .option('-l, --loglevel [value]', "From 0 to 3 (error, warn, info, verbose) - default info") // tslint:disable-next-line:max-line-length .option('-b, --buildTimeImports [value]', "map of key, to array of strings, which are package paths to include in your build. This feature allows you to dynamically include imports for a file, which are not known until you build, for example, when have some management class that includes third party sources that are configured by a build server. In your code, do 'import \"build:/keyName\", which will import all the build time imports as provided for 'keyName'") .option('-t, --createRuntimeFiles [value]', "if true, then system runtime files are added and created to your scopes, default is true'") .description("\n Compiles the given project's xml bindings and '.bs' brighterscript files.\n It's a destructive operation that should be performed on built output.\n") .action(function (options) { console.log("Processing...."); console.time('Finished in:'); var configJson = {}; if (options.config) { try { configJson = require(path.resolve(process.cwd(), options.config)); } catch (e) { console.log(e.message); process.exit(1); } } else { var sourcePaths = options.sourcePaths || [options.sourcePath]; configJson = { sourcePaths: sourcePaths, filePattern: options.filePattern, outputPath: options.outputPath, logLevel: options.logLevel, buildTimeImports: options.buildTimeImports, createRuntimeFiles: options.createRuntimeFiles }; } var processorConfig = ProcessorConfig_1.createProcessorConfig(configJson); var processor = new ProjectProcessor_1.ProjectProcessor(processorConfig); processor.processFiles(); console.timeEnd('Finished in:'); }); InstallFrameworkCommand_1.addInstallFrameworkCommand(program); CreateViewCommand_1.addCreateViewCommand(program); program.parse(process.argv);