本文整理汇总了TypeScript中gulp-util.colors.yellow方法的典型用法代码示例。如果您正苦于以下问题:TypeScript colors.yellow方法的具体用法?TypeScript colors.yellow怎么用?TypeScript colors.yellow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gulp-util.colors
的用法示例。
在下文中一共展示了colors.yellow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: linkExternalPackage
/**
* Creates a symbolic link between a package and a mapped path where the mapped path is external to the workspace.
*/
function linkExternalPackage(pluginBinding: NpmPluginBinding<NpmInstallOptions & NpmWorkspacePluginOptions>, packageName: string, packagePath: string, mappedPath: string) {
if (pluginBinding.options.registryMap[packageName]) {
Logger.warn(util.colors.yellow(`Package '${packageName}' has an entry in options.registryMap. Ignoring.`));
}
if (!path.isAbsolute(mappedPath)) {
mappedPath = path.normalize(path.join(pluginBinding.options.cwd, mappedPath));
}
if (mappedPath.indexOf(pluginBinding.options.cwd) >= 0) {
Logger.warn(util.colors.yellow(`externalWorkspacePackageMap['${packageName}'] is linking to a path inside the current workspace. Ignoring, but it should be removed.`));
}
let packageDescriptorPath = path.join(mappedPath, "package.json");
if (!fs.existsSync(packageDescriptorPath)) {
throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a path that is not a packge. No 'package.json' could be found at '${mappedPath}'.`);
}
let packageDescriptor: PackageDescriptor = require(packageDescriptorPath);
if (packageDescriptor.name !== packageName) {
throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a package that is named differently ('${packageDescriptor.name}').`);
}
pluginBinding.createPackageSymLink(packagePath, packageName, mappedPath);
Logger.verbose(`Linked '${util.colors.cyan(packageName)}' (-> '${util.colors.blue(mappedPath)}') - (${util.colors.bold("external")})`);
}
示例2: deleteAndWalk
/**
* Deletes the JavaScript file with the given path.
* @param {any} path - The path of the JavaScript file to be deleted.
*/
function deleteAndWalk(path: any) {
try {
rimraf.sync(join(path, '*.js'));
util.log('Deleted', util.colors.yellow(`${path}/*.js`));
} catch (e) {
util.log('Error while deleting', util.colors.yellow(`${path}/*.js`), e);
}
walk(path);
}
示例3: Buffer
fileDownload.init().then((files) => {
if (files === null) {
gutil.log(gutil.colors.yellow("No files found on the specified startFolder path"));
} else {
gutil.log(gutil.colors.green("Retrieved all files from the folder."));
// Start retrieving the file content
let proms = [];
files.forEach(file => {
proms.push(fileDownload.download(file).then((uFile: IFileDownload) => {
var vinylFile: any = new gutil.File({
cwd: "",
base: "",
path: uFile.name,
contents: ((uFile.content instanceof Buffer) ? uFile.content : new Buffer(uFile.content))
});
stream.write(vinylFile);
}));
});
Promise.all(proms).then(data => {
if (options.verbose) {
gutil.log("And we're done...");
}
// End the file stream
stream.end();
});
}
}).catch(err => {
示例4: done
export = (done: any) => {
util.log(util.colors.yellow(`
Warning!
Please use ${util.colors.green('npm run build.prod')}
Instead of ${util.colors.red('npm run build.prod.aot')} or ${util.colors.red('npm run build.prod.aot')}
They will be deleted soon!`));
done();
};
示例5: linkWorkspacePackage
/**
* Creates a symbolic link between a package and a mapped path where the mapped path is internal to the workspace.
*/
function linkWorkspacePackage(pluginBinding: NpmPluginBinding<NpmInstallOptions & NpmWorkspacePluginOptions>, packageName: string, packagePath: string, mappedPath: string) {
if (pluginBinding.options.registryMap[packageName]) {
Logger.warn(util.colors.yellow(`Workspace package '${packageName}' has an entry in options.registryMap. Using workspace package.`));
}
pluginBinding.createPackageSymLink(packagePath, packageName, mappedPath);
Logger.verbose(`Linked '${util.colors.cyan(packageName)}' (-> '${util.colors.blue(mappedPath)}')`);
}
示例6: registerTask
/**
* Registers the task by the given taskname and path.
* @param {string} taskname - The name of the task.
* @param {string} path - The path of the task.
*/
function registerTask(taskname: string, path: string): void {
const TASK = join(path, taskname);
util.log('Registering task', util.colors.yellow(tildify(TASK)));
gulp.task(taskname, (done: any) => {
const task = normalizeTask(require(TASK), TASK);
if (changeFileManager.pristine || task.shallRun(changeFileManager.lastChangedFiles)) {
return task.run(done);
} else {
done();
}
});
}
示例7: error
.pipe(flatmap((stream, f) => {
const rawResult = f.contents.toString('utf8');
const result = JSON.parse(rawResult);
const extension = result.results[0].extensions[0];
if (!extension) {
return error(`No such extension: ${ extension }`);
}
const metadata = {
id: extension.extensionId,
publisherId: extension.publisher,
publisherDisplayName: extension.publisher.displayName
};
const extensionVersion = extension.versions.filter(v => v.version === version)[0];
if (!extensionVersion) {
return error(`No such extension version: ${ extensionName } @ ${ version }`);
}
const asset = extensionVersion.files.filter(f => f.assetType === 'Microsoft.VisualStudio.Services.VSIXPackage')[0];
if (!asset) {
return error(`No VSIX found for extension version: ${ extensionName } @ ${ version }`);
}
util.log('Downloading extension:', util.colors.yellow(`${ extensionName }@${ version }`), '...');
const options = {
base: asset.source,
requestOptions: {
gzip: true,
headers: baseHeaders
}
};
return remote('', options)
.pipe(flatmap(stream => {
const packageJsonFilter = filter('package.json', { restore: true });
return stream
.pipe(vzip.src())
.pipe(filter('extension/**'))
.pipe(rename(p => p.dirname = p.dirname.replace(/^extension\/?/, '')))
.pipe(packageJsonFilter)
.pipe(buffer())
.pipe(json({ __metadata: metadata }))
.pipe(packageJsonFilter.restore);
}));
}));
示例8: modifyFile
export = (done: any) => {
// Note: dirty hack until we're able to set config easier
modifyFile(join(Config.TMP_DIR, 'tsconfig.json'), (content: string) => {
const parsed = JSON.parse(content);
const path = join(
Config.PROJECT_ROOT,
Config.TOOLS_DIR,
'manual_typings',
'project'
);
parsed.files = parsed.files || [];
parsed.files = parsed.files.concat(
readdirSync(path)
.filter(f => f.endsWith('d.ts'))
.map(f => join(path, f))
);
parsed.files = parsed.files.filter(
(f: string, i: number) => parsed.files.indexOf(f) === i
);
parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
return JSON.stringify(parsed, null, 2);
});
const args = argv as any;
// If a translation, tell the compiler
if (args.lang) {
let i18nFilePath = `${Config.LOCALE_DEST}/messages.${args.lang}.xlf`;
let isExists = existsSync(i18nFilePath);
if (isExists) {
args['i18nFile'] = i18nFilePath;
args['locale'] = args.lang;
args['i18nFormat'] = 'xlf';
} else {
util.log(util.colors.gray('Translation file is not found'), util.colors.yellow(i18nFilePath));
util.log(util.colors.gray(`Use 'npm run i18n' command to create your translation file`));
}
}
const cliOptions = new NgcCliOptions(args);
main(Config.TMP_DIR, cliOptions, codegen)
.then(done)
.catch(e => {
console.error(e.stack);
console.error('Compilation failed');
process.exit(1);
});
};
示例9: templateLocals
export function templateLocals() {
if (argv['config-env']) {
util.log(util.colors.yellow('"--config-env" is now deprecated. Use "--env-config" instead.'));
}
const configEnvName = argv['env-config'] || argv['config-env'] || 'dev';
const configPath = Config.getPluginConfig('environment-config');
const baseConfig = getConfig(configPath, 'base');
const config = getConfig(configPath, configEnvName);
if (!config) {
throw new Error('Invalid configuration name');
}
return Object.assign(Config, {
ENV_CONFIG: JSON.stringify(Object.assign(baseConfig, config))
});
}
示例10: existsSync
.forEach((key: string) => {
if (key === 'lang') {
const lang: string = namedArgs[key] as string;
const i18nFilePath = `${Config.LOCALE_DEST}/messages.${lang}.xlf`;
const isExists = existsSync(i18nFilePath);
if (isExists) {
args.push('--i18nFile', i18nFilePath);
args.push('--locale', lang);
args.push('--i18nFormat', 'xlf');
} else {
util.log(util.colors.gray('Translation file is not found'), util.colors.yellow(i18nFilePath));
util.log(util.colors.gray(`Use 'npm run i18n' command to create your translation file`));
}
} else {
args.push('--' + key, namedArgs[key]);
}
});