/** * Returns the style for the given unit. * * @param {Object} unit The unit to get the style for. * @param {string} unit.color The color of the unit (hex). * * @returns {Function} The style function. */ function getUnitStyle({ color }) { return ctx.hex(color); }
setInterval(() => { const pre = lineBreak(2) + spacing(2) + chalk.gray.dim(spinner.frame()); if (!data.downloadSpeed) { logUpdate(pre + lineBreak(2)); return; } logUpdate(pre + speed()); }, 50);
fs.readdir("./icons", function (err, files) { extract(files); if (!fs.existsSync("./dist")) { fs.mkdirSync("./dist"); } fs.writeFile('./dist/icons.json', JSON.stringify(svgObject), (err) => { if (err) throw err; console.log(chalk.whiteBright.bgBlack.bold("Created [JSON] for SVG Icons !! ")); }); });
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); } });
/** * Returns the style for the given unit. * * @param {Object} unit The unit to get the style for. * @param {string} unit.color The color of the unit (hex). * * @returns {Function} The style function. */ function getUnitStyle({ color }) { return ctx.hex(color); }