本文整理汇总了TypeScript中fancy-log.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: webpack
webpack(webpackConfig, (err: Error, stats: any) => {
if (err != null) {
throw err
}
log('[webpack]:\n', stats.toString('minimal'))
done()
})
示例2: startProxy
startProxy(proxyConfig: any) {
log(`Building proxy to ${config.backendDest}`)
this.server = httpProxy.createProxyServer(proxyConfig)
this.server.on('error', log.warn)
// See https://github.com/nodejitsu/node-http-proxy/issues/180#issuecomment-310550385
this.server.on('proxyReq', (proxyReq, req) => {
if (req.body == null) { return }
const bodyData = JSON.stringify(req.body)
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData))
proxyReq.write(bodyData)
})
}
示例3: log
middleware: () => {
const middleware = [bodyparser.json() as NextHandleFunction]
if (proxy.server == null) {
log('No proxy server exists, will use StubAPI mode.')
const msm = new MSM({
apiPrefixes : config.apiPrefixes,
apiDir : 'stubapi/',
lowerCase : true,
ping : config.ping,
preserveQuery: false,
logLevel : 'DEBUG',
})
middleware.push(msm.middleware())
} else {
log('Existing proxy server found, will use proxy mode.')
middleware.push(proxyMiddlewareFactory(proxy.server))
}
return middleware
},
示例4: log
server.on('listening', () => {
log('Checking Dev Server status...')
http.get({
host : config.livereloadHost,
port : config.serverPort,
timeout: WAIT_FOR_STARTUP_IN_MS,
}, (res: http.IncomingMessage) => {
log(`Webpack Dev Server started at port ${config.serverPort}`)
res.on('data', _.noop)
res.on('end', done)
})
.on('error', (err?: Error) => {
log.warn('There must be something wrong with webpack dev server:')
log.warn(err)
done()
})
})
示例5: Promise
const runCommand = (
command: string,
options: Required<Options>,
file: Vinyl | null
): Promise<void> => {
const context = { file, ...options.templateData }
command = template(command)(context)
if (options.verbose) {
fancyLog(`${PLUGIN_NAME}:`, chalk.cyan(command))
}
const child = spawn(command, {
env: options.env,
cwd: template(options.cwd)(context),
shell: options.shell,
stdio: options.quiet ? 'ignore' : 'inherit'
})
return new Promise((resolve, reject) => {
child.on('exit', code => {
if (code === 0 || options.ignoreErrors) {
return resolve()
}
const context = {
command,
file,
error: { code },
...options.templateData
}
const message = template(options.errorMessage)(context)
reject(new PluginError(PLUGIN_NAME, message))
})
})
}
示例6: root
},
)
// endregion
// region - Main exports
const rootDir = path.join(__dirname, '..')
const sourceDir = DEFAULT_SOURCE_BASE_DIR
const buildingDir = DEFAULT_BUILDING_DIR
const outputDir = DEFAULT_OUTPUT_DIR
process.env.NODE_ENV = (argv.flags.development || DEFAULT_IS_DEVELOPMENT) ? 'development' : 'production'
process.env.BABEL_ENV = process.env.NODE_ENV
log(`Initializing project in "${rootDir}" for ${process.env.NODE_ENV} environment.`)
const root: IBuildPathFn = (...pathInRoot) => path.join(rootDir, ...pathInRoot)
const absRoot = root
const source: IBuildPathFn = (...pathInSource) => path.join(sourceDir, ...pathInSource)
const absSource: IBuildPathFn = (...pathInSource) => root(sourceDir, ...pathInSource)
const building: IBuildPathFn = (...pathInBuilding) => path.join(buildingDir, ...pathInBuilding)
const absBuilding: IBuildPathFn = (...pathInBuilding) => root(buildingDir, ...pathInBuilding)
const output: IBuildPathFn = (...pathInOutput) => path.join(outputDir, ...pathInOutput)
const absOutput: IBuildPathFn = (...pathInOutput) => root(outputDir, ...pathInOutput)
const outputByEnv: IBuildPathFn = (...pathInOutput) => {
const dir = process.env.NODE_ENV === 'production' ? outputDir : buildingDir
示例7: log
.on('unlink', path => log(chalk.cyan('REM ') + path));