mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
fix(plugin): build plugins when dist is ignored
This commit is contained in:
parent
1b878e655e
commit
f8c9a2926d
@ -86,7 +86,24 @@ async function runParallel(items, concurrency, fn) {
|
|||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a plugin's .gitignore excludes dist/.
|
||||||
|
* When dist/ is gitignored, the plugin cannot ship pre-built output in version
|
||||||
|
* control (e.g. because it uses tree-shaking) and must always be built locally.
|
||||||
|
*/
|
||||||
|
function isDistGitignored(pluginDir) {
|
||||||
|
const gitignorePath = path.join(pluginDir, ".gitignore")
|
||||||
|
if (!fs.existsSync(gitignorePath)) return false
|
||||||
|
|
||||||
|
const lines = fs.readFileSync(gitignorePath, "utf-8").split("\n")
|
||||||
|
return lines.some((line) => {
|
||||||
|
const trimmed = line.trim()
|
||||||
|
return trimmed === "dist" || trimmed === "dist/" || trimmed === "/dist" || trimmed === "/dist/"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function needsBuild(pluginDir) {
|
function needsBuild(pluginDir) {
|
||||||
|
if (isDistGitignored(pluginDir)) return true
|
||||||
const distDir = path.join(pluginDir, "dist")
|
const distDir = path.join(pluginDir, "dist")
|
||||||
return !fs.existsSync(distDir)
|
return !fs.existsSync(distDir)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user