Build script: copy other files

This commit is contained in:
DarkCat09 2022-12-30 15:46:46 +04:00
parent ec7e74c39d
commit 99cd35287b
2 changed files with 16 additions and 1 deletions

15
dc09.js
View file

@ -94,6 +94,8 @@ function buildOne(dir) {
convertPathsHtml(dir, files) convertPathsHtml(dir, files)
print('Minifying HTML') print('Minifying HTML')
minifyHtml(dir, files) minifyHtml(dir, files)
print('Copying other files')
copyOther(dir, files)
} }
function minifyJs(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() { function archive() {
exec('7z a dist.zip dist/*') exec('7z a dist.zip dist/*')

View file

@ -10,7 +10,7 @@
"js/control.js", "js/control.js",
"js/handlers.js" "js/handlers.js"
], ],
"files": [ "other": [
"img/", "svg/", "fontawesome/", "img/", "svg/", "fontawesome/",
".domains" ".domains"
] ]