本文整理汇总了TypeScript中globby类的典型用法代码示例。如果您正苦于以下问题:TypeScript globby类的具体用法?TypeScript globby怎么用?TypeScript globby使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了globby类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: globby
(async () => {
let result: string[];
result = await globby('*.tmp');
result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']);
result = globby.sync('*.tmp');
result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']);
result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])}));
result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])}));
})();
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:11,代码来源:globby-tests.ts
示例2: enumerateInstalledCommands
export async function enumerateInstalledCommands(config: CliConfig): Promise<string[]> {
const { searchPrefixes } = config;
const globPaths = searchPrefixes.reduce((globPaths: string[], key) => {
return globPaths.concat(config.searchPaths.map((depPath) => pathResolve(depPath, `${key}-*`)));
}, []);
return globby(globPaths, { ignore: '**/*.{map,d.ts}' });
}
开发者ID:dojo,项目名称:cli,代码行数:7,代码来源:loadCommands.ts
示例3: getSchema
export default async function getSchema() {
const files = await globby('typeDefs/*.graphql', { cwd: __dirname })
const typeDefs = await Promise.all(
files.map(async file => {
const buffer = await readFileAsync(path.join(__dirname, file))
return buffer.toString()
})
)
return makeExecutableSchema({ typeDefs, resolvers })
}
开发者ID:stipsan,项目名称:epic,代码行数:11,代码来源:schema.ts
示例4: analyze
export async function analyze(
root: string, inputs: string[]): Promise<AnalysisFormat|undefined> {
const analyzer = new Analyzer({
urlLoader: new FSUrlLoader(root),
urlResolver: new PackageUrlResolver(),
});
const isInTests = /(\b|\/|\\)(test)(\/|\\)/;
const isNotTest = (f: Feature) =>
f.sourceRange != null && !isInTests.test(f.sourceRange.file);
if (inputs == null || inputs.length === 0) {
const _package = await analyzer.analyzePackage();
return generateAnalysis(_package, '', isNotTest);
} else {
const analysis = await analyzer.analyze(await globby(inputs));
return generateAnalysis(analysis, '', isNotTest);
}
}
开发者ID:abdonrd,项目名称:polymer-cli,代码行数:19,代码来源:analyze.ts
示例5: run
(async function run() {
const root = path.resolve(__dirname, '..');
const resultsPath = path.resolve(root, './src/data/results.json');
const imageNames = await globby([`*.+(png|gif|jpg|jpeg)`], { cwd: `${root}/images/photoshop` });
const toolNames = Object.keys(getEmptyResults()) as ToolName[];
const results: IImage[] = [];
for (const imageName of imageNames) {
const extension = getType(imageName);
const type = imageName.split('_')[0];
const originalSize = await getSize({ toolName: 'photoshop', imageName });
const worstSsimPossible =
extension === 'GIF' ? 1 : await getSsim({ toolName: 'worst', imageName });
const memo: IResultMemo = {
bestScore: 0,
highestSaving: 0,
image: {
extension,
name: imageName,
results: getEmptyResults(),
type
},
leastLoss: 0
};
await Promise.all(
toolNames.map(async (toolName) => {
if (await exists({ toolName, imageName })) {
const result = await getResult(originalSize, worstSsimPossible, { toolName, imageName });
memo.image.results[toolName] = result;
memo.bestScore = largest(result.score, memo.bestScore);
memo.highestSaving = largest(result.sizeSaving, memo.highestSaving);
memo.leastLoss = largest(result.ssim, memo.leastLoss);
}
})
);
console.log(imageName);
for (const toolName of toolNames) {
const result = memo.image.results[toolName];
if (result !== null) {
result.isBestScore = result.score === memo.bestScore;
result.isHighestSaving = result.sizeSaving === memo.highestSaving;
result.isLeastLoss = result.sizeSaving > 0 && result.ssim === memo.leastLoss;
results.push(memo.image);
console.log(
[
toolName,
result.isBestScore ? ' Best Score' : '',
result.isHighestSaving ? ' Highest Saving' : '',
result.isLeastLoss ? ' Least Loss' : ''
].join('')
);
} else {
console.log(toolName, 'has no result');
}
}
}
const previousResults = await readJson(resultsPath);
await writeJson(resultsPath, results, { spaces: 2 });
console.log(diffString(previousResults, results));
})();
开发者ID:JamieMason,项目名称:image-optimisation-tools-comparison,代码行数:64,代码来源:update-results.ts
示例6: enumerateBuiltInCommands
export async function enumerateBuiltInCommands(config: CliConfig): Promise<string[]> {
const builtInCommandParentDirGlob = join(config.builtInCommandLocation, '/*.js');
return globby(builtInCommandParentDirGlob, { ignore: '**/*.{map,d.ts}' });
}
开发者ID:dojo,项目名称:cli,代码行数:4,代码来源:loadCommands.ts
示例7: next
export default async function resource(compiler: NexeCompiler, next: () => Promise<void>) {
const resources = compiler.resources
if (!compiler.options.resources.length) {
return next()
}
const step = compiler.log.step('Bundling Resources...')
let count = 0
await each(globs(compiler.options.resources), async file => {
if (await isDirectoryAsync(file)) {
return
}
count++
step.log(`Including file: ${file}`)
const contents = await readFileAsync(file)
compiler.addResource(file, contents)
})
step.log(`Included ${count} file(s). ${(resources.bundle.byteLength / 1e6).toFixed(3)} MB`)
return next()
}
开发者ID:zavarat,项目名称:nexe,代码行数:20,代码来源:resource.ts
注:本文中的globby类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论