From 1928a186179e81ff26e2cdf98013a2484e1950ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 6 May 2022 12:53:44 -0400 Subject: [PATCH] fix: #10586, fix webinstaller folders --- install/web.js | 23 ++++++++++++++--------- webpack.common.js | 3 ++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/install/web.js b/install/web.js index d1609c45d3..0072d15003 100644 --- a/install/web.js +++ b/install/web.js @@ -58,7 +58,7 @@ web.install = async function (port) { winston.info(`Launching web installer on port ${port}`); app.use(express.static('public', {})); - app.use('/assets', express.static(path.join(__dirname, '../build/webpack'), {})); + app.use('/assets', express.static(path.join(__dirname, '../build/public'), {})); app.engine('tpl', (filepath, options, callback) => { filepath = filepath.replace(/\.tpl$/, '.js'); @@ -206,15 +206,20 @@ async function launch(req, res) { } const filesToDelete = [ - 'installer.css', - 'installer.min.js', - 'bootstrap.min.css', + path.join(__dirname, '../public', 'installer.css'), + path.join(__dirname, '../public', 'bootstrap.min.css'), + path.join(__dirname, '../build/public', 'installer.min.js'), ]; - await Promise.all( - filesToDelete.map( - filename => fs.promises.unlink(path.join(__dirname, '../public', filename)) - ) - ); + try { + await Promise.all( + filesToDelete.map( + filename => fs.promises.unlink(filename) + ) + ); + } catch (err) { + console.log(err.stack); + } + child.unref(); process.exit(0); } catch (err) { diff --git a/webpack.common.js b/webpack.common.js index f4c2e5551a..7929a196d5 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -29,7 +29,8 @@ module.exports = { publicPath: `${relativePath}/assets/`, clean: { keep(asset) { - return !asset.endsWith('.min.js'); + return asset === 'installer.min.js' || + !asset.endsWith('.min.js'); }, }, },