From b4cc751b6deafe56ca8fab6a90693610c738b469 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 30 Dec 2022 15:57:06 +0400 Subject: [PATCH] Bugfix in `buildOne`, getting directories list in `buildAll` --- dc09.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dc09.js b/dc09.js index db9844f..58ede57 100644 --- a/dc09.js +++ b/dc09.js @@ -62,14 +62,27 @@ function main() { function buildAll() { - buildOne('.') + + const dirs = fs.readdirSync('.', { + withFileTypes: true + }) + .filter(file => file.isDirectory()) + .map(file => file.name) + + const pages = [ + '.', + ...dirs, + ] + + for (let page of pages) + buildOne(page) + print('Completed', true, 'V', green) } function buildOne(dir) { print(`${bold}Building:${reset} ${dir}`) - fs.mkdirSync(`dist/${dir}`, {recursive: true}) const config = `${dir}/webpage.json` let files @@ -84,6 +97,10 @@ function buildOne(dir) { return } + fs.mkdirSync(`dist/${dir}`, { + recursive: true + }) + print('Minifying JS') minifyJs(dir, files) print('Rendering LESS')