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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | 3x 27x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 4x 4x 3x 3x 3x 3x 3x 17x 3x 3x 3x 3x 3x 3x 3x 447x 447x 447x 3x 3x 2x 3x 3x 3x 609x 535x 3x 3x 3x 3x 3x 3x 3x 2x 2x 2x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x | import _chalk from 'chalk'; import { generateOptions } from './prompt';EEE const _chalkCols = { white: v => v, green: v => v, red: v => v, yellow: v => v, default: v => v, gray: v => v, grey: v => v, blue: v => v, magenta: v => v, }; const _chalkMono = { ..._chalkCols, bold: _chalkCols }; let chalk = _chalk; const RNV_START = 'š ReNative'; let RNV = 'ReNative'; const LINE = chalk.bold.white('----------------------------------------------------------'); const LINE2 = chalk.gray('----------------------------------------------------------'); export const logWelcome = () => { let str = _defaultColor(` āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā ā ${chalk.red('āāāāāāā')} āāāāāāāā${chalk.red('āāāā āāā')} āāāāāā āāāāāāāāāāāā${chalk.red('āāā āāā')}āāāāāāāā ā ā ${chalk.red('āāāāāāāā')}āāāāāāāā${chalk.red('āāāāā āāā')}āāāāāāāāāāāāāāāāāāāā${chalk.red('āāā āāā')}āāāāāāāā ā ā ${chalk.red('āāāāāāāā')}āāāāāā ${chalk.red('āāāāāā āāā')}āāāāāāāā āāā āāā${chalk.red('āāā āāā')}āāāāāā ā ā ${chalk.red('āāāāāāāā')}āāāāāā ${chalk.red('āāāāāāāāāā')}āāāāāāāā āāā āāā${chalk.red('āāāā āāāā')}āāāāāā ā ā ${chalk.red('āāā āāā')}āāāāāāāā${chalk.red('āāā āāāāāā')}āāā āāā āāā āāā${chalk.red(' āāāāāāā ')}āāāāāāāā ā ā ${chalk.red('āāā āāā')}āāāāāāāā${chalk.red('āāā āāāāā')}āāā āāā āāā āāā${chalk.red(' āāāāā ')}āāāāāāāā ā ā ā `); if (_c?.files?.rnv?.package?.version) { _c.rnvVersion = _c.files.rnv.package.version; str += printIntoBox(` Version: ${chalk.green(_c.rnvVersion)}`, 1); if (_c.rnvVersion.includes('alpha')) { str += printIntoBox(` ${chalk.yellow('WARNING: this is a prerelease version.')}`, 1); str += printIntoBox(` ${chalk.yellow('Use "npm install rnv" for stable one.')}`, 1); } } str += printIntoBox(` ${chalk.grey('https://renative.org')}`, 1); str += printIntoBox(` š ${chalk.yellow('Firing up!...')}`, 1); str += printIntoBox(` ${getCurrentCommand()}`); if (_c?.timeStart) str += printIntoBox(` Start Time: ${_c.timeStart.toLocaleString()}`); str += printIntoBox(''); str += printBoxEnd(); str += '\n'; console.log(str); }; let _messages = []; let _currentCommand; let _currentProcess; let _isInfoEnabled = false; let _c; let _isMono = false; let _defaultColor; let _highlightColor; export const configureLogger = (c, process, command, subCommand, isInfoEnabled) => { _messages = []; _c = c; _c.timeStart = new Date(); _currentProcess = process; _currentCommand = command; _currentSubCommand = subCommand; _isInfoEnabled = isInfoEnabled; _isMono = c.program.mono; if (_isMono) { chalk = _chalkMono; } _updateDefaultColors(); RNV = getCurrentCommand(); }; const _updateDefaultColors = () => { _defaultColor = chalk.gray; _highlightColor = chalk.green; }; _updateDefaultColors(); export const logAndSave = (msg, skipLog) => { E if (_messages && !_messages.includes(msg)) _messages.push(msg); E if (!skipLog) console.log(`${msg}`); }; const PRIVATE_PARAMS = ['-k', '--key']; export const getCurrentCommand = (excludeDollar = false) => { if (!_c) return '_c is undefined'; const argArr = _c.process.argv.slice(2); let hideNext = false; const output = argArr.map((v) => { if (hideNext) { hideNext = false; return '********'; } if (PRIVATE_PARAMS.includes(v)) { hideNext = true; } return v; }).join(' '); const dollar = excludeDollar ? '' : '$ '; return `${dollar}rnv ${output}`; }; export const logToSummary = (v) => { _messages.push(`\n${v}`); }; export const logSummary = () => { let logContent = printIntoBox('All good as š¦ '); if (_messages && _messages.length) { logContent = ''; _messages.forEach((m) => { logContent += `ā ${m}\n`; }); } let timeString = ''; if (_c) { _c.timeEnd = new Date(); timeString = `| ${_c.timeEnd.toLocaleString()}`; } let str = printBoxStart(`š SUMMARY ${timeString}`, getCurrentCommand()); if (_c) { if (_c.files.project.package) { str += printIntoBox(`Project Name: ${_highlightColor(_c.files.project.package.name)}`, 1); str += printIntoBox(`Project Version: ${_highlightColor(_c.files.project.package.version)}`, 1); } if (_c.buildConfig) { str += printIntoBox(`App Config: ${_highlightColor(_c.buildConfig._meta?.currentAppConfigId)}`, 1); str += printIntoBox(`Workspace: ${_highlightColor(_c.buildConfig.workspaceID)}`, 1); } if (_c.files.project.config) { const defaultProjectConfigs = _c.files.project.config.defaults; if (defaultProjectConfigs?.supportedPlatforms) { const plats = []; generateOptions(_c.buildConfig?.defaults?.supportedPlatforms, true, null, (i, obj, mapping, defaultVal) => { let isEjected = ''; if (_c.paths.project.platformTemplatesDirs) { isEjected = _c.paths.project.platformTemplatesDirs[obj].includes(_c.paths.rnv.platformTemplates.dir) ? '' : '(ejected)'; } plats.push(`${defaultVal}${isEjected}`); }); str += printArrIntoBox(plats, 'Supported Platforms: '); } if (defaultProjectConfigs?.template) { str += printIntoBox(`Master Template: ${_highlightColor(defaultProjectConfigs.template)}`, 1); } } if (_c.process) { const envString = `${_c.process.platform} | ${_c.process.arch} | node v${_c.process.versions?.node} | rnv v${_c.rnvVersion}`; str += printIntoBox(`Env Info: ${chalk.gray(envString)}`, 1); } if (_c.program.scheme) str += printIntoBox(`Build Scheme: ${_highlightColor(_c.program.scheme)}`, 1); if (_c.platform) str += printIntoBox(`Platform: ${_highlightColor(_c.platform)}`, 1); if (_c.timeEnd) { str += printIntoBox(`Executed Time: ${chalk.yellow(_msToTime(_c.timeEnd - _c.timeStart))}`, 1); } } str += printIntoBox(''); str += logContent; str += printIntoBox(''); str += printBoxEnd(); console.log(str); }; const _msToTime = (s) => { const ms = s % 1000; s = (s - ms) / 1000; const secs = s % 60; s = (s - secs) / 60; const mins = s % 60; const hrs = (s - mins) / 60; return `${hrs}h:${mins}m:${secs}s:${ms}ms`; }; export const setCurrentJob = (job) => { _currentCommand = job; }; export const logTask = (task, customChalk) => { const ch = customChalk || chalk.green; const postMsg = customChalk ? '' : ' - Starting!'; console.log(ch(`${RNV} - ${task}${postMsg}`)); }; export const logWarning = (msg) => { logAndSave(chalk.yellow(`ā ļø ${RNV} - WARNING: ${msg}`)); }; export const logInfo = (msg) => { console.log(chalk.magenta(`ā¹ļø ${RNV} - NOTE: ${msg}`)); }; export const logDebug = (...args) => { I if (_isInfoEnabled) console.log.apply(null, args); }; export const isInfoEnabled = () => _isInfoEnabled; export const logComplete = (isEnd = false) => { console.log(chalk.bold.white(`\n ${RNV} - Done! š`)); if (isEnd) logEnd(0); }; export const logSuccess = (msg) => { logAndSave(`ā ${chalk.magenta(msg)}`); }; export const logError = (e, isEnd = false) => { I if (e && e.message) { logAndSave(chalk.bold.red(`š ${RNV} - ERRROR! ${e.message}\n${e.stack}`), isEnd); } else { logAndSave(chalk.bold.red(`š ${RNV} - ERRROR! ${e}`), isEnd); } I if (isEnd) logEnd(1); }; export const logEnd = (code) => { logSummary(); if (_currentProcess) _currentProcess.exit(code); }; export const logInitialize = () => { logWelcome(); // console.log( // chalk.white(`\n${LINE}\n ${RNV_START} ${chalk.white.bold(`${_currentCommand} ${_currentSubCommand || ''}`)} is firing up! š„\n${LINE}\n`), // ); }; export const logAppInfo = c => new Promise((resolve, reject) => { console.log(chalk.gray(`\n${LINE2}\nā¹ļø Current App Config: ${chalk.bold.white(c.buildConfig.id)}\n${LINE2}`)); resolve(); }); export const printIntoBox = (str2, chalkIntend = 0) => { let output = _defaultColor('ā '); let endLine = ''; let intend; if (_isMono) { intend = 0; chalkIntend = 0; } else { intend = str2 === '' ? 1 : 2; } for (let i = 0; i < chalkIntend + intend; i++) { endLine += ' '; } endLine += ' ā\n'; output += _defaultColor(str2); const l = output.length - endLine.length; output += _defaultColor(endLine.slice(l)); return output; }; export const printArrIntoBox = (arr, prefix = '') => { let output = ''; let stringArr = ''; let i = 0; arr.forEach((v) => { const l = i === 0 ? 60 - _defaultColor(prefix).length : 60; if (stringArr.length > l) { if (i === 0 && prefix.length) { output += printIntoBox(`${_defaultColor(prefix)}${_defaultColor(stringArr)}`, 2); } else { output += printIntoBox(_defaultColor(stringArr), 1); } stringArr = ''; i++; } stringArr += `${v}, `; // stringArr[i] += `${c.platformDefaults[v].icon} ${chalk.white(v)}, `; }); if (i === 0 && prefix.length) { output += printIntoBox(`${_defaultColor(prefix)}${_defaultColor(stringArr.slice(0, -2))}`, 2); } else { output += printIntoBox(_defaultColor(stringArr.slice(0, -2)), 1); } return output; }; export const printBoxStart = (str, str2) => { let output = _defaultColor('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n'); output += printIntoBox(str); output += printIntoBox(str2 || ''); output += _defaultColor('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤\n'); return output; }; export const rnvStatus = async () => Promise.resolve(); export const printBoxEnd = () => _defaultColor('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'); |