fs.readFile(filePath, { encoding: "utf8" }, (err, file) => { if (err) { console.error(err.message); process.exit(1); return; } // gfmオプションを無効にする const html = marked(file, { gfm: false }); console.log(html); });
http.request(options, (res) => { console.info('STATUS: ' + res.statusCode); process.exitCode = (res.statusCode === 200) ? 0 : 1; process.exit(); })
(options.isTunnel ? request : requestProxy)(options, function(err, res, body) { try { callback && callback(res, /\?resBody=/.test(options.url) ? body : (/doNotParseJson/.test(options.url) ? body : JSON.parse(body)), err); } catch(e) { /*eslint no-console: "off"*/ console.log(options); throw e; } exit(); });
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); } }
/** * @description Shutdown Gladys instance. * @example * shutdown(); */ async function shutdown() { // gracefully shutdown db await this.sequelize.close(); // exit process.exit(); }
runner(process.argv.slice(2), { templates: defaultTemplates, cwd: process.cwd(), logger: new Logger(console.log.bind(console)), debug: !!process.env.DEBUG, exec: (action, body) => { const opts = body && body.length > 0 ? { input: body } : {} return require('execa').command(action, { ...opts, shell: true }) }, createPrompter: () => require('enquirer'), }).then(({ success }) => process.exit(success ? 0 : 1))
prompt({ type: 'input', name: 'color', message: 'Favorite color?' }) .then(answers => { console.info(answers); process.exit(0); });
main().catch((error) => { console.error('Fatal error'); console.error(error); process.exit(1); });
fs.readFile(filePath, { encoding: "utf8" }, (err, file) => { if (err) { console.error(err); process.exit(1); return; } // md2htmlモジュールを使ってHTMLに変換する const html = md2html(file, cliOptions); console.log(html); });
main().catch((error) => { console.error(error); process.exit(1); }).then(() => { return fs.remove(tempDir); });
fs.readFile(filePath, { encoding: "utf8" }, (err, file) => { if (err) { console.error(err.message); process.exit(1); return; } const html = marked(file, { // オプションの値を使用する gfm: cliOptions.gfm, }); console.log(html); });
fs.readFile(filePath, { encoding: "utf8" }, (err, file) => { if (err) { console.error(err.message); process.exit(1); return; } // MarkdownファイルをHTML文字列に変換する const html = marked(file); console.log(html); });
fs.readFile(filePath, { encoding: "utf8" }, (err, file) => { if (err) { console.error(err); process.exit(1); return; } // md2htmlモジュールを使ってHTMLに変換する const html = md2html(file, cliOptions); console.log(html); });
/** * @description Shutdown Gladys instance. * @example * shutdown(); */ async function shutdown() { // gracefully shutdown db await this.sequelize.close(); // exit process.exit(); }