Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import path from 'path'; import fs from 'fs'; import shell from 'shelljs'; import chalk from 'chalk'; import { isPlatformSupported, cleanNodeModules, isBuildSchemeSupported, isPlatformSupportedSync, getConfig, logTask, logComplete, checkSdk, logError, getAppFolder, logDebug, logErrorPlatform, isSdkInstalled, logWarning, configureIfRequired, cleanPlatformIfRequired } from '../common'; import { askQuestion, generateOptions, finishQuestion } from '../systemTools/prompt'; import { IOS } from '../constants'; import { executeAsync, execCLI } from '../systemTools/exec'; import { executePipe } from '../projectTools/buildHooks'; import appRunner, { copyRuntimeAssets } from './app'; import { listTemplates, addTemplate, getTemplateOptions, getInstalledTemplateOptions, applyTemplate } from '../templateTools'; const LIST = 'list'; const ADD = 'add'; const REMOVE = 'remove'; const APPLY = 'apply'; const PIPES = { ADD_BEFORE: 'add:before', ADD_AFTER: 'add:after', }; // ########################################## // PUBLIC API // ########################################## const run = (c) => { logTask('run'); switch (c.subCommand) { case LIST: return _templateList(c); case ADD: return _templateAdd(c); case APPLY: return _templateApply(c); default: return Promise.reject(`cli:template Command ${c.command} not supported`); } }; // ########################################## // PRIVATE // ########################################## const _templateList = c => new Promise((resolve, reject) => { logTask('_templateList'); listTemplates(c) .then(() => resolve()) .catch(e => reject(e)); }); const _templateAdd = c => new Promise((resolve, reject) => { logTask('_templateAdd'); const opts = getTemplateOptions(c); askQuestion(`Pick which template to install : \n${opts.asString}`) .then(v => opts.pick(v)) .then(() => addTemplate(c, opts)) .then(() => resolve()) .catch(e => reject(e)); }); const _templateApply = c => new Promise((resolve, reject) => { logTask(`_templateApply:${c.program.template}`); if (c.program.template) { applyTemplate(c, c.program.template) .then(() => resolve()) .catch(e => reject(e)); } else { const opts = getInstalledTemplateOptions(c); askQuestion(`Pick which template to apply ${chalk.yellow('(NOTE: your project content will be overriden!)')}: \n${opts.asString}`) .then(v => opts.pick(v)) .then((v) => { finishQuestion(); return Promise.resolve(); }) .then(() => applyTemplate(c, opts.selectedOption)) .then(() => resolve()) .catch(e => reject(e)); } }); export { PIPES }; export default run; |