From 99cd35287b24c68ba1cd86f72b386030c77ffe6f Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 30 Dec 2022 15:46:46 +0400 Subject: [PATCH] Build script: copy other files --- dc09.js | 15 +++++++++++++++ webpage.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dc09.js b/dc09.js index 1e706d8..db9844f 100644 --- a/dc09.js +++ b/dc09.js @@ -94,6 +94,8 @@ function buildOne(dir) { convertPathsHtml(dir, files) print('Minifying HTML') minifyHtml(dir, files) + print('Copying other files') + copyOther(dir, files) } function minifyJs(dir, files) { @@ -178,6 +180,19 @@ function minifyHtml(dir, files) { } } +function copyOther(dir, files) { + files.other = files.other || [] + for (let file of files.other) { + const isAbs = path.isAbsolute(file) + const name = (isAbs ? file : `${dir}/${file}`) + const built = (isAbs ? file : `dist/${dir}/${file}`) + fs.cpSync(name, built, { + recursive: true, + errorOnExist: false, + }) + } +} + function archive() { exec('7z a dist.zip dist/*') diff --git a/webpage.json b/webpage.json index addf956..649a1f7 100644 --- a/webpage.json +++ b/webpage.json @@ -10,7 +10,7 @@ "js/control.js", "js/handlers.js" ], - "files": [ + "other": [ "img/", "svg/", "fontawesome/", ".domains" ]