diff --git a/package-lock.json b/package-lock.json index 73f3f1148..db2e37391 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "mdast-util-to-hast": "^13.2.0", "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", + "minimatch": "^10.0.1", "pixi.js": "^8.8.1", "preact": "^10.26.4", "preact-render-to-string": "^6.5.13", @@ -5254,6 +5255,7 @@ "version": "10.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, diff --git a/package.json b/package.json index f7857b9a0..0b0b9d9cd 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "mdast-util-to-hast": "^13.2.0", "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", + "minimatch": "^10.0.1", "pixi.js": "^8.8.1", "preact": "^10.26.4", "preact-render-to-string": "^6.5.13", diff --git a/quartz/build.ts b/quartz/build.ts index 0ed6602b3..7cf440569 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -20,6 +20,7 @@ import { Mutex } from "async-mutex" import { getStaticResourcesFromPlugins } from "./plugins" import { randomIdNonSecure } from "./util/random" import { ChangeEvent } from "./plugins/types" +import { minimatch } from "minimatch" type ContentMap = Map< FilePath, @@ -117,11 +118,23 @@ async function startWatching( }) } + const gitIgnoredMatcher = await isGitIgnored() const buildData: BuildData = { ctx, mut, contentMap, - ignored: await isGitIgnored(), + ignored: (path) => { + if (gitIgnoredMatcher(path)) return true + const pathStr = path.toString() + for (const pattern of cfg.configuration.ignorePatterns) { + if (minimatch(pathStr, pattern)) { + return true + } + } + + return false + }, + changesSinceLastBuild: {}, lastBuildMs: 0, } diff --git a/quartz/util/log.ts b/quartz/util/log.ts index 7584b83ef..2d53dd356 100644 --- a/quartz/util/log.ts +++ b/quartz/util/log.ts @@ -10,7 +10,9 @@ export class QuartzLogger { private readonly spinnerChars = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] constructor(verbose: boolean) { - this.verbose = verbose + const isInteractiveTerminal = + process.stdout.isTTY && process.env.TERM !== "dumb" && !process.env.CI + this.verbose = verbose || !isInteractiveTerminal } start(text: string) {