本文整理汇总了TypeScript中chalk.yellow.bold方法的典型用法代码示例。如果您正苦于以下问题:TypeScript yellow.bold方法的具体用法?TypeScript yellow.bold怎么用?TypeScript yellow.bold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chalk.yellow
的用法示例。
在下文中一共展示了yellow.bold方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _validateSequenceNumber
private _validateSequenceNumber(sequenceNumber: number) {
// checking that sequenceNumber is increasing
assert(_.isFinite(this._previousSequenceNumber));
assert(_.isFinite(sequenceNumber) && sequenceNumber >= 0);
let expectedSequenceNumber;
if (this._previousSequenceNumber !== -1) {
expectedSequenceNumber = this._previousSequenceNumber + 1;
if (expectedSequenceNumber !== sequenceNumber) {
const errMessage = "Invalid Sequence Number found ( expected " + expectedSequenceNumber + ", got " + sequenceNumber + ")";
/* istanbul ignore next */
debugLog(chalk.red.bold(errMessage));
/**
* notify the observers that a message with an invalid sequence number has been received.
* @event invalid_sequence_number
* @param expected sequence Number
* @param actual sequence Number
*/
this.emit("invalid_sequence_number", expectedSequenceNumber, sequenceNumber);
}
// todo : handle the case where sequenceNumber wraps back to < 1024
}
/* istanbul ignore next */
if (doDebug) {
debugLog(chalk.yellow.bold(" Sequence Number = "), sequenceNumber);
}
this._previousSequenceNumber = sequenceNumber;
}
示例2: showWarnings
/**
* Show warnings for the errors that occured during mapping of files, we
* still give the user to continue deployment without those files.
*
* @param {string} resolvedPath
* @param {FileError[]} errors
*/
async function showWarnings(resolvedPath: string, errors: FileError[]) {
if (errors.length > 0) {
console.log();
log(
chalk.yellow(
`There are ${chalk.bold(
errors.length.toString(),
)} files that cannot be uploaded:`,
),
);
for (const error of errors) {
const relativePath = error.path.replace(resolvedPath, '');
log(`${chalk.yellow.bold(relativePath)}: ${error.message}`);
}
}
console.log();
log(
chalk.yellow(
'File hosting using the ' +
chalk.bold('public') +
' folder is not supported yet.',
),
);
console.log();
}
示例3: logCodeSandbox
export function logCodeSandbox() {
console.log(
` ${chalk.blue.bold('Code')}${chalk.yellow.bold('Sandbox')} ${chalk.bold(
'CLI',
)}`,
);
console.log(' The official CLI for uploading projects to CodeSandbox');
}
示例4: setTimeout
setTimeout(() => {
console.warn(
chalk.yellow.bold(
'Jest did not exit one second after the test run has completed.\n\n',
) +
chalk.yellow(
'This usually means that there are asynchronous operations that ' +
"weren't stopped in your tests. Consider running Jest with " +
'`--detectOpenHandles` to troubleshoot this issue.',
),
);
}, 1000).unref();
示例5:
renderer.em = (text) => {
return chalk.yellow.bold(text);
};
示例6: debugLog
secureChannel.on("close", (err?: Error) => {
debugLog(chalk.yellow.bold(" ClientBaseImpl emitting close"), err);
if (!err || !this.reconnectOnFailure) {
// this is a normal close operation initiated byu
/**
* @event close
* @param error
*/
this.emit("close", err);
setImmediate(() => {
this._destroy_secure_channel();
});
return;
} else {
this.emit("connection_lost");
setImmediate(() => {
debugLog("recreating new secure channel ");
this._recreate_secure_channel((err1?: Error) => {
debugLog("secureChannel#on(close) => _recreate_secure_channel returns ",
err1 ? err1.message : "OK");
if (err1) {
// xx assert(!this._secureChannel);
debugLog("_recreate_secure_channel has failed");
// xx this.emit("close", err1);
return;
} else {
/**
* @event connection_reestablished
* send when the connection is reestablished after a connection break
*/
this.emit("connection_reestablished");
// now delegate to upper class the
if (this._on_connection_reestablished) {
assert(_.isFunction(this._on_connection_reestablished));
this._on_connection_reestablished((err2?: Error) => {
if (err2) {
debugLog("connection_reestablished has failed");
this.disconnect(() => {
// callback(err);
});
}
});
}
}
});
});
}
});
示例7: it
it("should findReferenceEx", () => {
const nsDI = addressSpace.getNamespaceIndex("http://opcfoundation.org/UA/DI/");
const topologyElementType = addressSpace.findObjectType("TopologyElementType", nsDI)!;
const deviceType = addressSpace.findObjectType("DeviceType", nsDI)!;
function isMandatory(reference: UAReference) {
// xx console.log(reference.node.modellingRule ,
// reference._referenceType.browseName.toString(),reference.node.browseName.toString());
if (!reference.node!.modellingRule) {
return false;
}
(typeof reference.node!.modellingRule === "string").should.eql(true);
return reference.node!.modellingRule === "Mandatory" || reference.node!.modellingRule === "Optional";
}
const r1_child = deviceType.findReferencesEx("Aggregates")
.filter((x: UAReference) => isMandatory(x))
.map((x: UAReference) => x.node!.browseName.name!.toString());
const r1_components = deviceType.findReferencesEx("HasComponent")
.filter((x: UAReference) => isMandatory(x))
.map((x: UAReference) => x.node!.browseName.name!.toString());
const r1_properties = deviceType.findReferencesEx("HasProperty")
.filter((x: UAReference) => isMandatory(x))
.map((x: UAReference) => x.node!.browseName.name!.toString());
console.log("Aggregates from ", deviceType.browseName.toString(), ": ",
chalk.yellow.bold(r1_child.sort().join(" ")));
r1_child.length.should.be.greaterThan(1);
([] as string[]).concat(r1_components, r1_properties).sort().should.eql(r1_child.sort());
const r2_child = topologyElementType.findReferencesEx("Aggregates")!
.filter((x: UAReference) => isMandatory(x))
.map((x: UAReference) => x.node!.browseName.name!.toString());
r2_child.length.should.be.greaterThan(1);
console.log("Aggregates from ", topologyElementType.browseName.toString(), ": ",
chalk.yellow.bold(r2_child.sort().join(" ")));
const optionals = ([] as string[]).concat(r1_child.sort(), r2_child.sort());
console.log("optionals ", topologyElementType.browseName.toString(), ": ",
chalk.yellow.bold( optionals.join(" ") ));
const valveType = addressSpace.getOwnNamespace().addObjectType({
browseName: "ValveType",
subtypeOf: deviceType
});
const someDevice = valveType.instantiate({
browseName: "SomeDevice",
// let make sure that all properties are requires
optionals
});
for (const opt of optionals) {
const child = someDevice.getChildByName(opt);
const childName = child ? child.browseName.toString() : " ???";
// xx console.log("opt ",opt,childName);
}
const instance_children = someDevice.findReferencesEx("Aggregates")
.map((x: UAReference) => x.node!.browseName.name!.toString());
// xx console.log(instance_children);
([] as string[]).concat(r1_child, r2_child).sort().should.eql(instance_children.sort());
});
示例8: warn
public warn(message: string): void { // 実行を継続できるが改善すべき状況で使う
this.log(chalk.yellow.bold('WARN'), chalk.yellow.bold(message));
}
示例9: print_stat
function print_stat() {
t2 = Date.now();
const str = util.format("R= %d W= %d T=%d t= %d",
client.bytesRead, client.bytesWritten, client.transactionsPerformed, (t2 - t1));
console.log(chalk.yellow.bold(str));
}
示例10: execTask
}
await execTask(changelogTask)({
milestone: cmd.milestone,
});
});
program
.command('cherrypick')
.description('Helps find commits to cherry pick')
.action(async cmd => {
await execTask(cherryPickTask)({});
});
program
.command('precommit')
.description('Executes checks')
.action(async cmd => {
await execTask(precommitTask)({});
});
program.parse(process.argv);
if (program.depreciate && program.depreciate.length === 2) {
console.log(
chalk.yellow.bold(
`[NPM script depreciation] ${program.depreciate[0]} is deprecated! Use ${program.depreciate[1]} instead!`
)
);
}