enforcePrerequisites() .then(migrateData) .then(startWebServer) .catch(error => { console.log(chalk.red('Failed to start Flood:')); console.trace(error); process.exit(1); });
const formatSource = async () => { console.log(chalk.reset('Formatting source files...')); try { const sourceFilePaths = await getSourceFilePaths(); const formattedPaths = await Promise.all(sourceFilePaths.map(filePath => formatFile(filePath, filePath))); console.log(chalk.green(`Formatted ${formattedPaths.length} files.`)); } catch (error) { console.log(chalk.red('Problem formatting file:\n'), chalk.reset(error)); process.exit(1); } }
// Check connections dns.lookup('fast.com', error => { if (error && error.code === 'ENOTFOUND') { console.error( chalk.red( `${lineBreak(1)}${spacing(1)}Please check your internet connection.${lineBreak(1)}` ) ); process.exit(1); } });
err(msg) { this.log(red(msg)); }
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 }
type: 'confirm', name: 'overwrite', message: red(` exists: ${to}. Overwrite? (y/N): `) }).then(({ overwrite
}, err => { console.log(chalk.red('Failed to compile.\n')); console.log(`${err.message || err}\n`); process.exit(1);
const check = async () => { console.log(chalk.reset('Validating source file formatting...')); try { const sourceFilePaths = await getSourceFilePaths(); await Promise.all( sourceFilePaths.map(async filePath => { const fileContent = await readFile(filePath); const prettierConfig = await prettier.resolveConfig(filePath); const isCompliant = prettier.check(fileContent, {...prettierConfig, filepath: filePath}); if (!isCompliant) { throw filePath; } }), ); console.log(chalk.green('Finished validating file formatting.')); } catch (error) { console.log(chalk.red('Unformatted file found:\n'), chalk.reset(error)); process.exit(1); } }
`Unknown template ${chalk.red(template)}`, createAppOptions );
console.log(chalk.red("You have some changes on remote that you haven't pulled.\n")); process.exit(1); console.log(chalk.red("Whatcha got there? Uncommited changes? We don't do that here.\n ")); process.exit(1); const currentBranch = branchName(); if (!valid(newVersion)) { console.log(chalk.red('Invalid version mate. Try again')); process.exit(1); console.log(chalk.red('Alpha and beta releases are only allowed on development branch.')); process.exit(1); chalk.red('Sorry, rules are rules. You need to merge development into master and release from master.') ); process.exit(1);
files.forEach(file => { const { path, content } = file process.stdout.write('\b'.repeat(10000)) process.stdout.write(chalk.grey(`INFO: check ${path}`)) const valid = prettier.check(content, { filepath: path }) file.check = valid if (!valid && !program.lint) { print(chalk.red(`ERROR: ${path} lint check fails`)) process.exit(1) } })
console.error( chalk.red( `We cannot create a project called ${chalk.green( projectName )} because a dependency with the same name exists.\n` + `Due to the way npm works, the following names are not allowed:\n\n` ) + chalk.cyan(dependencies.map(depName => ` ${depName}`).join('\n')) + chalk.red('\n\nPlease choose a different project name.') );
console.error( chalk.red( `We cannot create a project called ${chalk.green( projectName )} because a dependency with the same name exists.\n` + `Due to the way npm works, the following names are not allowed:\n\n` ) + chalk.cyan(dependencies.map(depName => ` ${depName}`).join('\n')) + chalk.red('\n\nPlease choose a different project name.') );