function setState(newState) { state = newState; if (newState && newState.length > 0) { stats[newState] = chalk.yellow(`0 ${chalk.dim(unit)}`); } }
st.on('downloadspeedprogress', speed => { if (state === 'download' && cli.flags.json !== true) { speed *= multiplier; const download = roundTo(speed, speed >= 10 ? 0 : 1); stats.download = chalk.yellow(`${download} ${chalk.dim(unit)}`); } });
_(app.info) .map(info => (info.healthy) ? chalk.green(info.service) : chalk.yellow(info.service)) .values() .join(', ')
chalk.yellow( figlet.text( 'RAN!', { verticalLayout: 'full' }, (err, data) => { process.stdout.write('\n'); process.stdout.write(data); process.stdout.write('\n'); if (callback) callback(); } ) );
const displayError = async (text, options = {}) => { console.error(''); console.error(chalk.cyan('Cube.js Error ---------------------------------------')); console.error(''); if (Array.isArray(text)) { text.forEach((str) => console.error(str)); } else { console.error(text); } console.error(''); console.error(chalk.yellow('Need some help? -------------------------------------')); await event('Error', { error: Array.isArray(text) ? text.join('\n') : text.toString(), ...options }); console.error(''); console.error(`${chalk.yellow(' Ask this question in Cube.js Slack:')} https://slack.cube.dev`); console.error(`${chalk.yellow(' Post an issue:')} https://github.com/cube-js/cube.js/issues`); console.error(''); process.exit(1); }
formatContainerState (state) { let stateFormatted = figures.square if (state === 'restarting') { return chalk.blue(stateFormatted) } if (state === 'running') { return chalk.green(stateFormatted) } if (state === 'paused') { return chalk.yellow(stateFormatted) } if (state === 'exited') { return chalk.gray(stateFormatted) } if (state === 'dead') { return chalk.red(stateFormatted) } return stateFormatted }
const token = async (options = {}) => { event('Generate Token'); const CubejsServer = await requireFromPackage('@cubejs-backend/server'); const { expiry = defaultExpiry, secret = CubejsServer.apiSecret() } = options; if (!secret) throw new Error('No app secret found').message; const extraOptions = {}; if (expiry !== '0') extraOptions.expiresIn = expiry; const payload = parsePayload(options.payload); console.log('Generating Cube.js JWT token'); console.log(''); console.log(`${chalk.yellow('-----------------------------------------------------------------------------------------')}`); console.log(` ${chalk.yellow('Use these manually generated tokens in production with caution.')}`); console.log(` ${chalk.yellow(`Please refer to ${chalk.cyan('https://cube.dev/docs/security')} for production security best practices.`)}`); console.log(`${chalk.yellow('-----------------------------------------------------------------------------------------')}`); console.log(''); console.log(`Expires in: ${chalk.green(expiry)}`); console.log(`Payload: ${chalk.green(JSON.stringify(payload))}`); console.log(''); const signedToken = jwt.sign(payload, secret, extraOptions); console.log(`Token: ${chalk.green(signedToken)}`); await event('Generate Token Success'); return signedToken; }
warn(msg) { this.log(yellow(msg)); }
) { console.log( chalk.yellow( '\nTreating warnings as errors because process.env.CI = true.\n Most CI servers set it automatically.\n', ),
log(chalk.yellow(`Migrating user ${user.username}`));
({stats, previousFileSizes, warnings}) => { if (warnings.length) { console.log(chalk.yellow('Compiled with warnings.\n')); console.log(warnings.join('\n\n')); console.log(`\nSearch for the ${chalk.underline(chalk.yellow('keywords'))} to learn more about each warning.`); console.log(`To ignore, add ${chalk.cyan('// eslint-disable-next-line')} to the line before.\n`); } else {
log(chalk.yellow(`Migrating user ${user.username}`));
console.error(chalk.yellow(`${type} version ${version} is a legacy version! We recommend upgrading.`));
_fetchRemoteLifemojis() { return this._lifeApiClient .request({ method: 'GET', url: '/src/data/lifemojis.json', }) .then(res => { console.log(`${chalk.yellow('Lifemojis')} updated successfully!`); return res.data; }) .catch(error => this._errorMessage(`Network connection not found - ${error.code}`) ); }
st.on('uploadspeedprogress', speed => { if (state === 'upload' && cli.flags.json !== true) { speed *= multiplier; const upload = roundTo(speed, speed >= 10 ? 0 : 1); stats.upload = chalk.yellow(`${upload} ${chalk.dim(unit)}`); } });