From d099c36fb3139702cd9f7a55e1ae2db9051fc4c4 Mon Sep 17 00:00:00 2001 From: Vandish Gandhi Date: Wed, 17 Jul 2019 14:55:48 +1000 Subject: [PATCH] fix: redundant copy of files for demo build --- config/paths.js | 2 ++ index.html | 1 + package.json | 2 +- scripts/build.js | 12 +++++++++++- www/assets/favicon.ico | Bin 0 -> 1150 bytes 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 www/assets/favicon.ico diff --git a/config/paths.js b/config/paths.js index 140b95665..5f18dd1f6 100644 --- a/config/paths.js +++ b/config/paths.js @@ -17,4 +17,6 @@ module.exports = { appDemo: resolveApp('www'), appSrc: resolveApp('src'), appNodeModules: resolveApp('node_modules'), + assetsPath: resolveApp('www/assets'), + cnamePath: resolveApp('www/CNAME'), }; diff --git a/index.html b/index.html index 4d353ed2c..26f0aa5e5 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ + Adslot UI diff --git a/package.json b/package.json index 216e211e1..3119dc331 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "codecov": "cat coverage/coverage-final.json | codecov", "dist:dev": "node ./scripts/build.js", "dist:prod": "cross-env NODE_ENV=dist node ./scripts/build.js", - "dist:demo": "cross-env NODE_ENV=production node ./scripts/build.js", + "dist:demo": "cross-env NODE_ENV=production DEMO_ASSETS=true node ./scripts/build.js", "dist": "npm run clean && npm run dist:prod && npm run dist:dev && npm run dist:demo", "lint:sass": "sass-lint -v", "lint:eslint": "eslint --ext .jsx,.js ./src && eslint --ext .jsx,.js ./www", diff --git a/scripts/build.js b/scripts/build.js index fe6606fb7..f98a3030d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -41,6 +41,14 @@ function copyPublicFolder() { }); } +function copyDemoAssets() { + fs.copySync(paths.assetsPath, `${buildPath}/assets`, { + dereference: true, + filter: file => file !== paths.appHtml, + }); + fs.copyFileSync(paths.cnamePath, `${buildPath}/CNAME`); +} + // Create the production build and print the deployment instructions. function build(previousFileSizes) { console.log('Creating an optimized build...'); @@ -89,7 +97,9 @@ measureFileSizesBeforeBuild(buildPath) // if you're in it, you don't end up in Trash if (process.env.NODE_ENV === 'dist') fs.emptyDirSync(buildPath); // Merge with the public folder - if (process.env.NODE_ENV === 'production') copyPublicFolder(); + if (process.env.NODE_ENV === 'production') { + process.env.DEMO_ASSETS ? copyDemoAssets() : copyPublicFolder(); + } // Start the webpack build return build(previousFileSizes); }) diff --git a/www/assets/favicon.ico b/www/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df510e119e5d041434ca40e724d99891df620eaa GIT binary patch literal 1150 zcmdVWFH1vF7{~GFGKVY-CIgGe?iivb!w`dr7FqBmm=;9EU^0oAeFX-?4I*L^gBXkk zlR*|lM8sea5fL$n;rRW@bK!c?WZE5{J?A{