`tinyglobby` at `0.2.10` (what we use now) is slow on shallow files, but the latest version `0.2.12` is fast due to this PR https://github.com/SuperchupuDev/tinyglobby/pull/69/files. This PR updates both the js and esbuild plugins to use the newest versions, but also adds `tinyglobby@^0.2.12` to our root `package.json` so we get the speed increase right away. I removed `fast-glob` in our repo scripts and replaced it with `tinyglobby`. ## Current Behavior Asset handling is slow for shallow files like `LICENSE` but is fine for scoped patterns like `src/**/*.ts`. ## Expected Behavior Asset handling should be fast for shallow files. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
31 lines
677 B
JavaScript
31 lines
677 B
JavaScript
//@ts-check
|
|
const { mkdirSync, copySync } = require('fs-extra');
|
|
const glob = require('tinyglobby');
|
|
const { join, basename } = require('path');
|
|
|
|
const p = process.argv[2];
|
|
|
|
const args = process.argv.slice(2);
|
|
const dest = args[args.length - 1];
|
|
const from = args.slice(0, args.length - 1);
|
|
|
|
try {
|
|
mkdirSync(dest, {
|
|
recursive: true,
|
|
});
|
|
} catch {}
|
|
for (const f of from) {
|
|
const matchingFiles = glob.globSync(f, {
|
|
cwd: process.cwd(),
|
|
onlyDirectories: true,
|
|
});
|
|
|
|
console.log(f, matchingFiles);
|
|
|
|
for (const file of matchingFiles) {
|
|
const destFile = join(dest, basename(file));
|
|
console.log(file, '=>', destFile);
|
|
copySync(file, destFile);
|
|
}
|
|
}
|