本文整理汇总了TypeScript中cli-color.bold.yellow方法的典型用法代码示例。如果您正苦于以下问题:TypeScript bold.yellow方法的具体用法?TypeScript bold.yellow怎么用?TypeScript bold.yellow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cli-color.bold
的用法示例。
在下文中一共展示了bold.yellow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
* - Author: Andrrr <andresin@gmail.com>
* - This little tool let's you add videos to storage (locar or remote)
*
*/
let rootDir = '../../';
import * as colors from 'cli-color';
require('dotenv').config({
path: rootDir + '.env'
});
// let colors = new colorsSafe();
console.log(colors.bold.yellow(' ╭───────────────────────────╮ '));
console.log(colors.bold.yellow('╭────────────┤ ▶ Lantube "OFFLINE" CLI ├───────────╮'));
console.log(colors.bold.yellow('│ ╰───────────────────────────╯ │'));
console.log(colors.bold.yellow('│ Connection type: ' + process.env.DB_TYPE + ' │'));
if (process.argv.length === 3) {
if (process.argv[2] == 'help') {
console.log(colors.bold(' Lantube offline tool'));
console.log(colors.bold(' - This tool will add Youtube videos to ' + process.env.DB_TYPE));
console.log(colors.bold(' - Use cases: '));
console.log(' > The Lantube server is down.');
console.log(' > The Lantube server is running in another computer.\n');
console.log(colors.bold(' - Usage examples:'));
console.log(' > $ node lantube-offline.js "YOUTUBE_ID"');
示例2: function
}, function (error, response, body) {
if (!error && response.statusCode === 200) {
const
conn = require(rootDir + 'connections/' + process.env.DB_TYPE + '.js');
// model = require(rootDir + 'models/' + process.env.DB_TYPE + '/Videos.js');
conn.hlen('videos', (err, videos_count) => {
if (err) {
console.log(err);
}
let videoId = 'video' + Number(videos_count + 1);
// let title = body.title.replace(/"/g, '');
let title = body.title.replace(/(^[a-z]|\s[a-z])/g, (p) => {
return p.toUpperCase();
});
let videoUri = yt_id;
let thumb = body.thumbnail_url;
let order = String(videos_count + 1);
// Redis no acepta objetos JSON aun... ¬_¬
// let video_string = '{ "videoId": "' + videoId + '",' +
// '"title": "' + title + '",' +
// '"url": "' + yt_id + '",' +
// '"img": "' + body.thumbnail_url + '",' +
// '"order": ' + String(videos_count + 1) + '}';
let video_string = `{"videoId":"${videoId}","videoInfo":{"videoId":"${videoId}","title":"${title}","url":"${videoUri}","img":"${thumb}"},"order":${order}}`;
conn.hmset('videos', String(videoId), video_string, (err) => {
conn.hget('videos', videoId, (err, video) => {
if (err) {
console.log(err);
} else {
let vid = JSON.parse(video);
console.log(
colors.green.bold(' [OK] Video inserted into Lantube DB!') + '\n' +
colors.green.bold(' Details: ') + '\n' +
colors.green.bold(' videoId: ') + vid.videoId + '\n' +
colors.green.bold(' title: ') + vid.title + '\n' +
colors.green.bold(' url: ') + vid.url + '\n' +
colors.green.bold(' img: ') + vid.img + '\n' +
colors.green.bold(' order: ') + (vid.order + 1)
);
}
});
});
});
} else {
console.log(colors.bold.yellow('│ ') + colors.bold.red(error)) + colors.bold.yellow('│');
console.log(colors.bold.yellow('╰────────────────────────────────────────────────────╯'));
}
});
示例3:
const ENGINE_RUNTIMES: { [key: string]: string } = {
6: "nodejs6",
8: "nodejs8",
10: "nodejs10",
};
export const ENGINES_FIELD_REQUIRED_MSG = clc.bold(
"Engines field is required in package.json but none was found."
);
export const UNSUPPORTED_NODE_VERSION_MSG = clc.bold(
`package.json in functions directory has an engines field which is unsupported. ` +
`The only valid choices are: ${clc.bold('{"node": "8"}')} and ${clc.bold('{"node": "10"}')}. ` +
`Note that Node.js 6 is now deprecated.`
);
export const DEPRECATION_WARNING_MSG =
clc.bold.yellow("functions: ") +
"Deploying functions to Node 6 runtime, which is deprecated. Node 8 is available " +
"and is the recommended runtime.";
export const FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING =
clc.bold.yellow("functions: ") +
"You must have a " +
clc.bold("firebase-functions") +
" version that is at least 2.0.0. Please run " +
clc.bold("npm i --save firebase-functions@latest") +
" in the functions folder.";
/**
* Returns a friendly string denoting the chosen runtime: Node.js 8 for nodejs 8
* for example. If no friendly name for runtime is found, returns back the raw runtime.
* @param runtime name of runtime in raw format, ie, "nodejs8" or "nodejs10"