本文整理汇总了TypeScript中chalk.blue函数的典型用法代码示例。如果您正苦于以下问题:TypeScript blue函数的具体用法?TypeScript blue怎么用?TypeScript blue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了blue函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: handler
export async function handler(context: Context) {
const { schemaPath } = await context.getProjectConfig()
if (!schemaPath) {
throw new Error('No `schemaPath` found in GraphQL config file.')
}
const relativeSchemaPath = relative(process.cwd(), schemaPath)
if (!existsSync(schemaPath)) {
console.log(
chalk.yellow("Schema file doesn't exist at ") +
chalk.blue(relativeSchemaPath),
)
return
}
const extensions = {
schemaPath: relativeSchemaPath,
...getSchemaExtensions(schemaPath),
}
const maxLength = _(extensions)
.keys()
.map('length')
.max()
for (let name in extensions) {
const padName = _.padStart(name, maxLength)
console.log(`${padName}\t${chalk.blue(extensions[name])}`)
}
if (Object.keys(extensions).length === 0) {
return
}
}
开发者ID:koddsson,项目名称:graphql-cli,代码行数:34,代码来源:schema-status.ts
示例2: it
it('should run and return current versions on success', () => {
const installedCommandWrapper1 = getCommandWrapperWithConfiguration({
group: 'apple',
name: 'test',
path: join(__dirname, '../../support/valid-package')
});
const installedCommandWrapper2 = getCommandWrapperWithConfiguration({
group: 'orange',
name: 'anotherTest',
path: join(__dirname, '../../support/another-valid-package')
});
const commandMap: CommandMap = new Map<string, CommandWrapper>([
['installedCommand1', installedCommandWrapper1],
['installedCommand2', installedCommandWrapper2]
]);
const groupMap = new Map([['test', commandMap]]);
mockAllCommands.default = sandbox.stub().resolves(groupMap);
const helper = { command: 'version' };
const expectedOutput = `${outputPrefix}${outputSuffix}
âš ${validPackageInfo.name}@${chalk.blue(validPackageInfo.version)}
âš ${anotherValidPackageInfo.name}@${chalk.blue(anotherValidPackageInfo.version)}`;
return moduleUnderTest.run(helper, { outdated: false }).then(
() => {
assert.equal(logStub.firstCall.args[0].trim(), expectedOutput);
},
() => {
assert.fail(null, null, 'moduleUnderTest.run should not have rejected promise');
}
);
});
开发者ID:dojo,项目名称:cli,代码行数:32,代码来源:version.ts
示例3: runServer
function runServer(schemaIDL: Source, extensionIDL: Source, optionsCB) {
const app = express();
if (extensionIDL) {
const schema = buildServerSchema(schemaIDL);
extensionIDL.body = extensionIDL.body.replace('<RootTypeName>', schema.getQueryType().name);
}
app.options('/graphql', cors(corsOptions))
app.use('/graphql', cors(corsOptions), graphqlHTTP(() => {
const schema = buildServerSchema(schemaIDL);
return {
...optionsCB(schema, extensionIDL),
graphiql: true,
};
}));
app.get('/user-idl', (_, res) => {
res.status(200).json({
schemaIDL: schemaIDL.body,
extensionIDL: extensionIDL && extensionIDL.body,
});
});
app.use('/user-idl', bodyParser.text());
app.post('/user-idl', (req, res) => {
try {
if (extensionIDL === null)
schemaIDL = saveIDL(req.body);
else
extensionIDL = saveIDL(req.body);
res.status(200).send('ok');
} catch(err) {
res.status(500).send(err.message)
}
});
app.use('/editor', express.static(path.join(__dirname, 'editor')));
app.listen(argv.port);
log(`\n${chalk.green('â')} Your GraphQL Fake API is ready to use đ
Here are your links:
${chalk.blue('âŻ')} Interactive Editor:\t http://localhost:${argv.port}/editor
${chalk.blue('âŻ')} GraphQL API:\t http://localhost:${argv.port}/graphql
`);
if (!fileArg) {
log(chalk.yellow(`Default file ${chalk.magenta(fileName)} is used. ` +
`Specify [file] parameter to change.`));
}
if (argv.open) {
setTimeout(() => opn(`http://localhost:${argv.port}/editor`), 500);
}
}
开发者ID:codeaudit,项目名称:graphql-faker,代码行数:60,代码来源:index.ts
示例4: promptUser
async function promptUser(): Promise<boolean> {
console.log(chalk.blue(`It appears you have a file or directory at ${join(homedir(), "ledeConfig")}`));
console.log(chalk.blue("Lede needs to store configuration in this location."));
console.log(chalk.blue(`It is possible that you already have Lede configuration stored there, in which case, you probably ${chalk.bold.underline("do NOT")} want to overwrite it.`));
console.log(chalk.blue("Please note, however, if you do not have Lede configurations installed there Lede will not work properly."));
console.log(chalk.red(`Would you like to overwrite ${join(homedir(), "ledeConfig")}? (y/${chalk.bold.underline("N")})`));
// Platform dependent line endings silliness
let r = "\n";
let n = 1;
if (platform() === "win32") {
r = "\r\n";
n = 2;
}
return new Promise((resolve, reject) => {
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", (d: string) => {
if (d.length === n || d.toLowerCase() === `n${r}` || d.toLowerCase() === `no${r}`) return stopAndReturn(false, resolve);
if (d.toLowerCase() === `y${r}` || d.toLowerCase() === `yes${r}`) return stopAndReturn(true, resolve);
console.log(chalk.blue(`${d.slice(0, d.length - n)} is not a valid answer to the question.`));
});
process.stdin.on("error", () => {
return stopAndReturn(false, resolve);
})
});
function stopAndReturn(resolveVal: boolean, resolveFn) {
process.stdin.pause();
return resolveFn(resolveVal);
}
}
开发者ID:tbtimes,项目名称:lede-cli,代码行数:33,代码来源:installScript.ts
示例5: statusEventCallback
export async function statusEventCallback(event: {
payload: IGitHubStatusPayload | IGitHubStatusTestPayload;
}) {
try {
const repo = event.payload.repository.name;
const ci = new Circle(repo);
log(
chalk.bgBlue(`${chalk.black("New build from:")} ${chalk.yellow(repo)}`)
);
const circleBuildPayload = await ci.getBuildData(event.payload);
log(chalk.blue(`Circle status: ${circleBuildPayload.data.status}`));
if (circleBuildPayload.data) {
try {
await slack.notifyBuildStatus(circleBuildPayload.data);
log(chalk.blue("Slack notified: đ"));
} catch (e) {
const msg = e.hasOwnProperty("response") ? e.response.data : e.hasOwnProperty('message') ? e.message : e;
if (msg.toString().indexOf("Irrelevant build event") === -1)
throw new SlackServicesError(msg);
}
}
middlewareEventHandler.emit("complete");
} catch (e) {
if (e.toString().indexOf("Not a Circle event") > -1) log(e.toString());
else githubEvents.emit("error", e);
}
}
开发者ID:ft-interactive,项目名称:ft-ig-github-project-manager,代码行数:30,代码来源:github.ts
示例6: getPaths
export async function getPaths(workingDir, name, logger) {
if (name) {
return {
servePath: resolve(workingDir, ".builtProjects", name),
buildPath: resolve(workingDir, name)
}
}
try {
let res = await existsProm(resolve(process.cwd(), 'projectSettings.js'));
if (res.file) {
return {
servePath: resolve(workingDir, '.builtProjects', basename(process.cwd())),
buildPath: resolve(workingDir, basename(process.cwd()))
}
}
} catch (err) {
if (err.code === 'ENOENT') {
logger.error({err}, `Cannot find project. Please specify a ${chalk.blue(
'-n [name]')} option or change into a project directory. Type ${chalk.blue('lede dev -h')} for help`);
} else {
logger.error({err}, `An error occurred while opening ${chalk.blue(
resolve(workingDir, 'projectSettings.js'))}. It is likely that there is a syntax error in the file.`)
}
process.exit(1);
}
}
开发者ID:tbtimes,项目名称:ledeTwo,代码行数:26,代码来源:devCommand.ts
示例7:
.map((command) => {
return command.version === command.latest || command.latest === undefined
? ` âš ${command.name}@${chalk.blue(command.version)}`
: ` âš ${command.name}@${chalk.blue(command.version)} ${chalk.green(
`(latest is ${command.latest})`
)}`;
})
开发者ID:dojo,项目名称:cli,代码行数:7,代码来源:version.ts
示例8: getIonitronString
export function getIonitronString(quote: string) {
const quoteFormatted = quote
.split('\n')
.map(currentString => {
const lineLength = 68;
const paddingLeftSize = Math.floor((lineLength - currentString.length) / 2);
const paddingRightSize = paddingLeftSize + ((lineLength - currentString.length) % 2);
return ` |${' '.repeat(paddingLeftSize - 1)}${currentString}${' '.repeat(paddingRightSize - 1)}|`;
})
.join('\n');
return chalk.blue(`\n\n\n
h
\`-oooooo/\`.++
::-oooooooo...
\`:.\`:oooooo/
\`\`\`-:oo\`
/o.
./:--:::::--..\`
.-/+ooooooooooooooooo+/:.
\`-/ooooooooooooooooooooooooooo+:.
-+ooooooooooooooooooooooooooooooooo+:\`
:ooooooooooooooooooooooooooooooooooooooo/\`
:ooooooooooooooooooooooooooooooooooooooooooo/\`
\`+oooooooooooooooooooooooooooooooooooooooooooooo-
-ooooooooooooooooooooooooooooooooooooooooooooooooo/
-ooooooooooooooooooooooooooooooooooooooooooooooooooo/.-.
-ooooooooooooooooooooooooooooooooooooooooooooooooooooo/+o+\`
\`ooooooooooooooooooooooooooooooooooooooooooooooooooooooo:ooo\`
/ooooooooooooooooooooooooooooooooooooooooooooooooooooooo+ooo/
-+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo+oooh
-ooooooo+ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
ooooooooo:oooooooooooooooooooooooooooooooooooooooooooooooooooooooo
ooooooooo+:ooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooo.oooooooooooooooooooooooooooooooooooooooooooooooooooooo+
oooooooooo:/oooooooooooooooooooooooooooooooooooooooooooooooooooo+\`
+ooooooooo//oooooooooooooooooooooooooooooooooooooooooooooooooo\`\`
.ooooooooo/+oooooooooooooooooooooo:.-+oooooooo: \`/oooooooooo-
:oooooooo/oooooooooooooooooooooo: \`oooooooo. :ooooooooo/
:ooooooooooooooooooooooooooooooo:--+ooooooooo+/oooooooooo/
\`:////ooooooooooooooooooooooooooooooooooooooooooooooooo:
\`+oooooooooooooooooooooooooooooooooooooooooooooo.
-ooooooooooooooooooooooooooooooooooooooooooo:\`
\`:ooooooooooooooooooooooooooooooooooooooo/\`
./ooooooooooooooooooooooooooooooooo+-\`
\`-/ooooooooooooooooooooooooooo/-\``) + `\\
` + chalk.blue(`\`-:+ooooooooooooooooo+/-.`) + ` \\ \\
` + chalk.blue(`'\\:--::::--/'`) + ` | \\
/ \\
-----------------------------------------------* *----------
/ \\
/ \\
${quoteFormatted}
\\ /
\\ /
*--------------------------------------------------------------*\n\n`;
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:58,代码来源:ionitron.ts
示例9: addModuleImportToApptModule
function addModuleImportToApptModule(host: Tree, moduleName: string, src: string,
project: WorkspaceProject, appModulePath: string,
options: Schema): void {
if (hasNgModuleImport(host, appModulePath, moduleName)) {
console.log(chalk.yellow(`Could not set up "${chalk.blue(moduleName)}" ` +
`because "${chalk.blue(moduleName)}" is already imported. Please manually ` +
`check "${chalk.blue(appModulePath)}" file.`));
return;
}
addModuleImportToRootModule(host, moduleName, src, project);
}
开发者ID:SrgGs,项目名称:ng-zorro-antd,代码行数:11,代码来源:add-required-modules.ts
示例10: repoEventCallback
export async function repoEventCallback(event: {
payload: IGitHubRepositoryPayload | IGitHubRepositoryTestPayload;
}) {
if (event.payload.action === "created") {
const { full_name, name } = event.payload.repository;
const org = event.payload.organization.login;
// I don't remember why I had this line. It's possible we do need to filter by org.
// if (org !== "ft-interactive" || org !== "financial-times") return;
const ci = new Circle(name, org);
log(chalk.black.bgBlue.bold(`New repo: ${full_name}`));
try {
await ci.followProject();
log(
chalk.blue(
`Followed on Circle: https://circleci.com/gh/${full_name} đ`
)
);
} catch (e) {
throw new CircleServicesError(e.response.data);
}
try {
await ci.addEnvVars();
log(chalk.blue(`Env vars adds to CircleCI: đ`));
} catch (e) {
throw new CircleServicesError(e.response.data);
}
try {
const githubRes = await createSlackWebhook(full_name);
log(chalk.blue(`GitHub-to-Slack webhook: ${githubRes.data.url} đ`));
} catch (e) {
throw new GitHubServicesError(e.response.data);
}
try {
await slack.notifyNewProject(event.payload);
log(chalk.blue("Slack notified: đ"));
} catch (e) {
throw new SlackServicesError(e.response.data);
}
}
middlewareEventHandler.emit("complete");
}
开发者ID:ft-interactive,项目名称:ft-ig-github-project-manager,代码行数:49,代码来源:github.ts
注:本文中的chalk.blue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论