Skip to content

Commit

Permalink
Allow extra time for plugin to be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSurgisonGDS committed Oct 6, 2022
1 parent 615003c commit 8a3da90
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions lib/extensions/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,29 +240,32 @@ function watchPlugins (afterWatch) {
ignoreInitial: true,
awaitWriteFinish: true
}).on('change', () => {
const currentPlugins = getCurrentPlugins()

const missing = previousPlugins.filter((plugin) => !currentPlugins.includes(plugin))
if (missing.length) {
if (missing.length === 1) {
console.log(`Plug-in ${missing} has been removed`)
} else {
console.log(`Plug-ins ${missing.join(', ')} have been removed`)
// Allow an extra 2 seconds to allow plugin config file to be created
setTimeout(() => {
const currentPlugins = getCurrentPlugins()

const missing = previousPlugins.filter((plugin) => !currentPlugins.includes(plugin))
if (missing.length) {
if (missing.length === 1) {
console.log(`Plug-in ${missing} has been removed`)
} else {
console.log(`Plug-ins ${missing.join(', ')} have been removed`)
}
}
}

const added = currentPlugins.filter((plugin) => !previousPlugins.includes(plugin))
if (added.length) {
if (added.length === 1) {
console.log(`Plug-in ${added} has been added`)
} else {
console.log(`Plug-ins ${added.join(', ')} have been added`)
const added = currentPlugins.filter((plugin) => !previousPlugins.includes(plugin))
if (added.length) {
if (added.length === 1) {
console.log(`Plug-in ${added} has been added`)
} else {
console.log(`Plug-ins ${added.join(', ')} have been added`)
}
}
}

previousPlugins = currentPlugins
previousPlugins = currentPlugins

afterWatch({ missing, added })
afterWatch({ missing, added })
}, 2000)
})
}

Expand Down

0 comments on commit 8a3da90

Please sign in to comment.