Skip to content

Commit

Permalink
Experimenting around changing build artefact location to go to node_m…
Browse files Browse the repository at this point in the history
…odules, so the content is retained across cached builds in various PAAS environments
  • Loading branch information
sulkaharo committed Aug 28, 2022
1 parent 4750f13 commit 7b01d49
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand All @@ -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
, }));

Expand Down
2 changes: 1 addition & 1 deletion lib/server/enclave.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7b01d49

Please sign in to comment.