diff options
| author | XhmikosR <[email protected]> | 2021-07-28 18:27:58 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2021-09-28 19:27:25 +0300 |
| commit | 9766d58eeb21c3b9f3032962378eb58c46c6843b (patch) | |
| tree | 22559f273e74a915d7fbc19b45dac8620971aab9 /build | |
| parent | ef6555b9f9f80ccbed36b7bde29fd4eb10eab0a5 (diff) | |
| download | bootstrap-gs-dynamic-resolve-during-build-plugins.tar.xz bootstrap-gs-dynamic-resolve-during-build-plugins.zip | |
build-plugins.js: minor tweaksgs-dynamic-resolve-during-build-plugins
Diffstat (limited to 'build')
| -rw-r--r-- | build/build-plugins.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/build/build-plugins.js b/build/build-plugins.js index 5adffa70d..8d7744ed2 100644 --- a/build/build-plugins.js +++ b/build/build-plugins.js @@ -28,7 +28,7 @@ for (const filePath of paths) { resolved[filenameToEntity(path.basename(filePath, '.js'))] = { src: filePath.replace('.js', ''), dist: filePath.replace('src', 'dist'), - name: filePath.replace(`${srcPath}/`, '') + name: path.relative(srcPath, filePath) } } @@ -42,7 +42,6 @@ const plugins = [ ] const build = async pluginKey => { - console.log(`Building ${pluginKey} plugin...`) const plugin = resolved[pluginKey] const globals = {} @@ -58,8 +57,8 @@ const build = async pluginKey => { } // eslint-disable-next-line no-unused-vars - const usedPlugin = Object.entries(resolved).find(([key, path]) => { - return path.src.includes(source.replace(pattern, '')) + const usedPlugin = Object.entries(resolved).find(([key, p]) => { + return p.src.includes(source.replace(pattern, '')) }) if (!usedPlugin) { @@ -67,7 +66,7 @@ const build = async pluginKey => { return false } - globals[usedPlugin[1].src] = usedPlugin[0] + globals[path.normalize(usedPlugin[1].src)] = usedPlugin[0] return true } }) @@ -84,13 +83,19 @@ const build = async pluginKey => { console.log(`Building ${pluginKey} plugin... Done!`) } -const main = () => { +(async () => { try { - Promise.all(Object.keys(resolved).map(plugin => build(plugin))) + const basename = path.basename(__filename) + const timeLabel = `[${basename}] finished` + + console.log('Building individual plugins...') + console.time(timeLabel) + + await Promise.all(Object.keys(resolved).map(plugin => build(plugin))) + + console.timeEnd(timeLabel) } catch (error) { console.error(error) process.exit(1) } -} - -main() +})() |
