From 7b01d49577ca069dadf79e9822a8a6702954e626 Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Sun, 28 Aug 2022 09:37:04 +0300 Subject: [PATCH] Experimenting around changing build artefact location to go to node_modules, so the content is retained across cached builds in various PAAS environments --- lib/server/app.js | 4 ++-- lib/server/enclave.js | 2 +- package.json | 2 +- webpack/webpack.config.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/server/app.js b/lib/server/app.js index bb68a2f711a..78df91ea158 100644 --- a/lib/server/app.js +++ b/lib/server/app.js @@ -320,7 +320,7 @@ function create (env, ctx) { } // Production bundling - const tmpFiles = express.static(resolvePath('/tmp/public'), { + const tmpFiles = express.static(resolvePath('/node_modules/_ns_cache/public'), { maxAge: maxAge }); @@ -343,7 +343,7 @@ function create (env, ctx) { , coffee_match: /coffeescript/ , json_match: /json/ , cssmin: myCssmin - , cache: resolvePath('/tmp/public') + , cache: resolvePath('/node_modules/_ns_cache/public') , onerror: undefined , })); diff --git a/lib/server/enclave.js b/lib/server/enclave.js index 2ae0ef2ebcb..6d403dbd546 100644 --- a/lib/server/enclave.js +++ b/lib/server/enclave.js @@ -19,7 +19,7 @@ const init = function init () { let apiKeySet = false; function readKey (filename) { - let filePath = path.resolve(__dirname + '/../../tmp/' + filename); + let filePath = path.resolve(__dirname + '/../../node_modules/_ns_cache/' + filename); if (fs.existsSync(filePath)) { return fs.readFileSync(filePath).toString().trim(); } diff --git a/package.json b/package.json index 98f24b87bb2..842f853c41a 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "bundle": "webpack --mode production --config webpack/webpack.config.js && npm run-script generate-keys", "bundle-dev": "webpack --mode development --config webpack/webpack.config.js && npm run-script generate-keys", "bundle-analyzer": "webpack --mode development --config webpack/webpack.config.js --profile --json > stats.json && webpack-bundle-analyzer stats.json", - "generate-keys": "node bin/generateRandomString.js >tmp/randomString", + "generate-keys": "mkdir node_modules/_ns_cache | node bin/generateRandomString.js >node_modules/_ns_cache/randomString", "coverage": "cat ./coverage/lcov.info | env-cmd -f ./tests/ci.test.env codacy-coverage || echo NO COVERAGE", "dev": "env-cmd -f ./my.env nodemon --inspect lib/server/server.js 0.0.0.0", "dev-test": "env-cmd -f ./my.devtest.env nodemon --inspect lib/server/server.js 0.0.0.0", diff --git a/webpack/webpack.config.js b/webpack/webpack.config.js index a81a2f17dcf..82e623ad043 100644 --- a/webpack/webpack.config.js +++ b/webpack/webpack.config.js @@ -149,7 +149,7 @@ module.exports = { clock: clockEntry }, output: { - path: path.resolve(projectRoot, './tmp/public'), + path: path.resolve(projectRoot, './node_modules/_ns_cache/public'), publicPath, filename: 'js/bundle.[name].js', sourceMapFilename: 'js/bundle.[name].js.map',