Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/build
/dist
/out
metrics/out/

# WordPress specific
/wp-content/uploads
Expand Down
8 changes: 2 additions & 6 deletions metrics/frontmatter-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import glob from "glob";
import { glob } from "glob";
import matter from "gray-matter";
import micromatch from "micromatch";
import YAML from "js-yaml";
Expand All @@ -26,11 +26,7 @@ function loadConfig() {
}

async function listFiles(includeGlobs, excludeGlobs) {
const matches = await new Promise((resolve, reject) =>
glob("**/*", { dot: true, nodir: true }, (e, files) =>
e ? reject(e) : resolve(files)
)
);
const matches = await glob("**/*", { dot: true, nodir: true });
const included = micromatch(matches, includeGlobs);
return micromatch.not(included, excludeGlobs);
}
Expand Down
Loading
Loading