feat(loader): prefer pre-built plugins
This commit is contained in:
@@ -46,6 +46,12 @@ async function cloneWithSubdirAsync({ url, ref, subdir, pluginDir }) {
|
||||
}
|
||||
|
||||
async function buildPluginAsync(pluginDir, name) {
|
||||
if (hasPrebuiltDist(pluginDir)) {
|
||||
console.log(styleText("green", ` ✓ ${name}: using pre-built dist/`))
|
||||
linkPeerPlugins(pluginDir)
|
||||
return true
|
||||
}
|
||||
|
||||
try {
|
||||
const skipBuild = !needsBuild(pluginDir)
|
||||
console.log(styleText("cyan", ` → ${name}: installing dependencies...`))
|
||||
@@ -102,6 +108,11 @@ function isDistGitignored(pluginDir) {
|
||||
})
|
||||
}
|
||||
|
||||
function hasPrebuiltDist(pluginDir) {
|
||||
const distDir = path.join(pluginDir, "dist")
|
||||
return fs.existsSync(distDir) && !isDistGitignored(pluginDir)
|
||||
}
|
||||
|
||||
function needsBuild(pluginDir) {
|
||||
if (isDistGitignored(pluginDir)) return true
|
||||
const distDir = path.join(pluginDir, "dist")
|
||||
|
||||
Reference in New Issue
Block a user