Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function getFiles(
includeGlobs: Array,
excludeGlobs: Array,
log: ILog,
): Promise> {
const includePatterns = Array.from(turnIgnoresToGlobs(includeGlobs));
log.verbose(
() => `Include globs: ${JSON.stringify(includePatterns, null, " ")}`,
);
const excludePatterns = Array.from(turnIgnoresToGlobs(excludeGlobs));
log.verbose(
() => `Exclude globs: ${JSON.stringify(excludePatterns, null, " ")}`,
);
// Now let's match the patterns and see what files we get.
const paths = await glob(includePatterns, {
onlyFiles: true,
absolute: true,
ignore: excludePatterns,
});
const sortedPaths = paths.sort();
log.verbose(
() => `Discovered paths: ${JSON.stringify(sortedPaths, null, " ")}`,
);
return sortedPaths;
}
export default withIcon('${compName}')(${compName});`,
'utf8',
error => {
if (error) {
reject(error);
} else {
console.log(`Generated ${compName}`);
resolve();
}
},
);
});
});
}
glob(filePattern, {
absolute: true,
cwd: SVG_ROOT,
})
.then(svgPaths => Promise.all(svgPaths.map(svgPath => createIcon(svgPath))))
.catch(error => {
console.error(chalk.red(`Failed to generate icons: ${error.message}`));
process.exitCode = 1;
});
export const initial = (config: Config, pattern: string[]) => async (
p: Params
) => {
const { filterComponents } = config
const cwd = paths.getRootDir(config)
const files = await fastglob(pattern, { cwd, caseSensitiveMatch: false })
const filtered = filterComponents ? filterComponents(files) : files
const metadata = await docgen(filtered, config)
p.setState('props', metadata)
}
private async resolveColorschemes(runtimepath: string[]) {
const list = runtimepath;
if (config.vimruntime) {
list.push(config.vimruntime);
}
const glob = runtimepath.map((p) => path.join(p.trim(), "colors/*.vim"));
let colorschemes: string[] = [];
try {
colorschemes = await fg(glob, { onlyFiles: false, deep: 0 });
} catch (error) {
log.error(
[
`Index Colorschemes Error: ${JSON.stringify(glob)}`,
`Error => ${error.stack || error.message || error}`,
].join("\n"),
);
}
this.colorschemeItems = colorschemes.map((p) => {
const label = path.basename(p, ".vim");
const item: CompletionItem = {
label,
kind: CompletionItemKind.EnumMember,
insertText: label,
insertTextFormat: InsertTextFormat.PlainText,
};
export function find(pattern, options = {}) {
const patterns = [].concat(pattern || []);
const parent = globParent(patterns[0]);
const cwd = path.resolve(process.cwd(), options.cwd || '');
const workdir = `${path.resolve(cwd, parent)}/`;
const globOptions = {
absolute: true,
...options,
cwd,
};
let paths = glob(patterns, globOptions).then((x) =>
x.map((y) => path.resolve(y))
);
if (options.sort !== false) {
paths = paths.then((x) => x.sort());
}
return list(paths).map((x) =>
file({
cwd: workdir,
path: x.replace(workdir, ''),
})
);
}
async function computeBuildSizes() {
const packages = await glob('./packages/*', { absolute: true, onlyDirectories: true });
const stats: { name: string; sizes: object }[] = [];
await Promise.all(
packages.map(async packagePath => {
const packageName = path.basename(packagePath);
stats.push({
name: packageName,
sizes: {
esm: await getTotalSize('./esm/**/*.js', packagePath),
lib: await getTotalSize('./lib/**/*.js', packagePath),
},
});
}),
);
(async () => {
const files = await fastGlob(
sanitizeFastGlobPattern(filesGlobArgValue),
{
absolute: false,
onlyFiles: true,
stats: false,
},
);
await execShell(["npx", ["ava", ...args, ...files]]);
})().catch((error) => {
LOG(error);
export default async function clean(src, verbose) {
let morphed = await glob(
[
'**/*.view.js',
`Fonts/*.js`,
'useFlow.js',
'useIsMedia.js',
'useIsBefore.js',
'useTools.js',
],
{
bashNative: ['linux'],
cwd: src,
ignore: ['*node_modules*'],
}
)
await Promise.all(
async function getTotalSize(fileGlob: string, cwd: string): Promise {
const files = await glob(fileGlob, { absolute: true, cwd, onlyFiles: true });
const sizes = await Promise.all(
files.map(
file =>
new Promise((resolve, reject) => {
fs.stat(file, (error, stats) => {
if (error) {
reject(error);
} else {
resolve(stats.size);
}
});
}),
),
);
return sizes.reduce((sum, size) => sum + size, 0);
export async function generate(options: GenerateOptions): Promise {
const extensions = (options.extensions || getExtensions()).join(",");
const suffix = `?(.{${extensions}})`;
const patterns = options.components.map(x => x + suffix);
debug("Component patterns", patterns);
const components = await glob(patterns, {
cwd: options.path,
onlyFiles: false
});
debug("Found components", components);
const manifests: Manifest[] = [];
for (const id of components) {
const path = join(options.path, id);
const mod = [].concat(await getComponentValue(path));
for (let i = 0; i < mod.length; i++) {
const data: any = mod[i];
if (options.validate) {
if (typeof data.validate === "function") {