From 5da2b7c39bcae4834e6af492f2bcdf5527d863d8 Mon Sep 17 00:00:00 2001 From: Marshall Quander <marshall@quander.me> Date: Tue, 24 Jul 2018 17:04:21 -0700 Subject: [PATCH] Make /dist the build folder --- .gitignore | 4 ++-- package.json | 2 +- scripts/hab-build-and-push.sh | 6 +++--- webpack.config.js | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index d196a5b21..1117a083f 100644 --- a/.gitignore +++ b/.gitignore @@ -57,8 +57,8 @@ typings/ # dotenv environment variables file .env -# Ignore public folder with webpack build output -public/ +# Ignore dist folder with webpack build output +dist/ .DS_Store diff --git a/package.json b/package.json index f11c58103..cd9a0e6c0 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "postinstall": "node ./scripts/postinstall.js", "start": "webpack-dev-server --mode=development", - "build": "rimraf ./public && webpack --mode=production", + "build": "rimraf ./dist && webpack --mode=production", "doc": "node ./scripts/doc/build.js", "prettier": "prettier --write '*.js' 'src/**/*.js'", "lint:js": "eslint '*.js' 'scripts/**/*.js' 'src/**/*.js'", diff --git a/scripts/hab-build-and-push.sh b/scripts/hab-build-and-push.sh index 53efd6adf..2702e65cd 100755 --- a/scripts/hab-build-and-push.sh +++ b/scripts/hab-build-and-push.sh @@ -22,9 +22,9 @@ ln -s "$(hab pkg path core/coreutils)/bin/env" /usr/bin/env hab pkg install -b core/coreutils core/bash core/node/8.11.3 core/git core/aws-cli npm ci -npm run build --output-path build -mkdir build/pages -mv build/*.html build/pages +npm run build +mkdir dist/pages +mv dist/*.html dist/pages aws s3 sync --acl public-read --cache-control "max-age=31556926" build/assets "$TARGET_S3_URL/assets" aws s3 sync --acl public-read --cache-control "no-cache" --delete build/pages "$TARGET_S3_URL/pages/latest" diff --git a/webpack.config.js b/webpack.config.js index bb9be202d..b17d5a4ce 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -81,7 +81,6 @@ module.exports = (env, argv) => ({ "avatar-selector": path.join(__dirname, "src", "avatar-selector.js") }, output: { - path: path.join(__dirname, "public"), filename: "assets/js/[name]-[chunkhash].js", publicPath: process.env.BASE_ASSETS_PATH || "" }, @@ -179,7 +178,7 @@ module.exports = (env, argv) => ({ use: { loader: "file-loader", options: { - // move required assets to /public and add a hash for cache busting + // move required assets to output dir and add a hash for cache busting name: "[path][name]-[hash].[ext]", // Make asset paths relative to /src context: path.join(__dirname, "src") -- GitLab