mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[kbn/optimizer] ignore compressed files when reporting stats (#71940)
Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
d74cd9e64c
commit
913d6b16a3
1 changed files with 16 additions and 5 deletions
|
@ -35,6 +35,8 @@ interface Entry {
|
|||
stats: Fs.Stats;
|
||||
}
|
||||
|
||||
const IGNORED_EXTNAME = ['.map', '.br', '.gz'];
|
||||
|
||||
const getFiles = (dir: string, parent?: string) =>
|
||||
flatten(
|
||||
Fs.readdirSync(dir).map((name): Entry | Entry[] => {
|
||||
|
@ -51,7 +53,19 @@ const getFiles = (dir: string, parent?: string) =>
|
|||
stats,
|
||||
};
|
||||
})
|
||||
);
|
||||
).filter((file) => {
|
||||
const filename = Path.basename(file.relPath);
|
||||
if (filename.startsWith('.')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const ext = Path.extname(filename);
|
||||
if (IGNORED_EXTNAME.includes(ext)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
export function reportOptimizerStats(reporter: CiStatsReporter, config: OptimizerConfig) {
|
||||
return pipeClosure((update$: OptimizerUpdate$) => {
|
||||
|
@ -70,10 +84,7 @@ export function reportOptimizerStats(reporter: CiStatsReporter, config: Optimize
|
|||
// make the cache read from the cache file since it was likely updated by the worker
|
||||
bundle.cache.refresh();
|
||||
|
||||
const outputFiles = getFiles(bundle.outputDir).filter(
|
||||
(file) => !(file.relPath.startsWith('.') || file.relPath.endsWith('.map'))
|
||||
);
|
||||
|
||||
const outputFiles = getFiles(bundle.outputDir);
|
||||
const entryName = `${bundle.id}.${bundle.type}.js`;
|
||||
const entry = outputFiles.find((f) => f.relPath === entryName);
|
||||
if (!entry) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue