diff --git a/.travis.yml b/.travis.yml index 47d5150b03..f48519f44c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ script: - npm run lint:all - npm run test:ci:all - npm run docs:coverage - - npm run build:showcase:ghpages + - if [[ $TRAVIS_TAG == "" && ${TRAVIS_EVENT_TYPE} != "cron" ]]; then npm run build:showcase:ghpages:test-ci-env; else npm run build:showcase:ghpages; fi - npm run docs:publish - npm run release:publish - bash ./scripts/ci/print-logs.sh diff --git a/package-lock.json b/package-lock.json index 834133f3fc..41ef16e911 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "stark-srcs", - "version": "10.0.0-alpha.3", + "version": "10.0.0-alpha.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 70d85ad1cc..30b9031f31 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "build:stark-ui": "npm run build -- --packages=stark-ui", "build:showcase": "cd showcase && npm run build:prod && cd ..", "build:showcase:ghpages": "cd showcase && npm run build:prod:ghpages && cd ..", + "build:showcase:ghpages:test-ci-env": "cd showcase && npm run build:prod:ghpages:test-ci-env && cd ..", "clean": "npx rimraf ./dist", "clean:all": "npm run clean && npm run clean:stark-build && npm run clean:stark-core && npm run clean:stark-ui && npm run clean:stark-testing && npm run clean:starter && npm run clean:showcase", "clean:stark-build": "cd packages/stark-build && npm run clean && cd ../..", diff --git a/packages/stark-build/config/webpack.common.js b/packages/stark-build/config/webpack.common.js index d1a1f7a0d7..49345b2b08 100644 --- a/packages/stark-build/config/webpack.common.js +++ b/packages/stark-build/config/webpack.common.js @@ -173,7 +173,10 @@ module.exports = options => { ? [ { test: /\.js$/, - use: [buildOptimizerLoader] + use: [buildOptimizerLoader], + exclude: [ + helpers.root("node_modules/prettier/parser-typescript.js") + ] } ] : []), diff --git a/packages/stark-build/config/webpack.prod.js b/packages/stark-build/config/webpack.prod.js index 42e0e4c4bd..4060675e6e 100644 --- a/packages/stark-build/config/webpack.prod.js +++ b/packages/stark-build/config/webpack.prod.js @@ -23,12 +23,12 @@ const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const HashedModuleIdsPlugin = require("webpack/lib/HashedModuleIdsPlugin"); -function getUglifyOptions(supportES2015) { +function getUglifyOptions(supportES2015, isTestCIEnv = false) { const uglifyCompressOptions = { pure_getters: true /* buildOptimizer */, // PURE comments work best with 3 passes. // See https://github.com/webpack/webpack/issues/2899#issuecomment-317425926. - passes: 3 /* buildOptimizer */ + passes: isTestCIEnv ? 1 : 3 /* buildOptimizer */ }; return { @@ -54,9 +54,10 @@ module.exports = function() { HMR: false, environment: buildUtils.DEFAULT_METADATA.E2E ? "e2e.prod" : "prod" }); + const isTestCIEnv = helpers.hasProcessFlag("test-ci-env"); const supportES2015 = buildUtils.supportES2015(METADATA.TS_CONFIG_PATH); - return webpackMerge(commonConfig({ ENV: ENV, metadata: METADATA }), { + const webpackConfig = webpackMerge(commonConfig({ ENV: ENV, metadata: METADATA }), { /** * Stats lets you precisely control what bundle information gets displayed * reference: https://webpack.js.org/configuration/stats/ @@ -71,8 +72,6 @@ module.exports = function() { mode: "production", - devtool: "source-map", - // reference: https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a optimization: { removeAvailableModules: true, @@ -97,8 +96,9 @@ module.exports = function() { */ new UglifyJsPlugin({ parallel: true, // use multi-process parallel running to improve the build speed (default concurrent processes: os.cpus().length - 1) - sourceMap: true, // useful to still be able to debug in production - uglifyOptions: getUglifyOptions(supportES2015) + sourceMap: !isTestCIEnv, // useful to still be able to debug in production + uglifyOptions: getUglifyOptions(supportES2015), + cache: true }), // other options than Uglify: BabelifyMinifyWebpackPlugin or ClosureCompilerPlugin @@ -333,4 +333,10 @@ module.exports = function() { }) ] }); + + if (!isTestCIEnv) { + webpackConfig.devtool = "source-map"; + } + + return webpackConfig; }; diff --git a/showcase/package.json b/showcase/package.json index 189c793aee..36c00710cf 100644 --- a/showcase/package.json +++ b/showcase/package.json @@ -27,6 +27,7 @@ }, "scripts": { "build:aot:prod": "npm run clean:dist && npm run clean:aot && cross-env BUILD_AOT=1 npm run webpack -- --config node_modules/@nationalbankbelgium/stark-build/config/webpack.prod.js --progress --profile --bail", + "build:aot:prod:test-ci-env": "npm run clean:dist && npm run clean:aot && cross-env BUILD_AOT=1 npm run webpack -- --config node_modules/@nationalbankbelgium/stark-build/config/webpack.prod.js --progress --profile --bail --test-ci-env", "build:aot": "npm run build:aot:prod", "build:aot:dev": "cross-env BUILD_AOT=1 npm run build:dev", "build:dev": "npm run clean:dist && npm run webpack -- --config node_modules/@nationalbankbelgium/stark-build/config/webpack.dev.js --progress --profile", @@ -34,6 +35,7 @@ "build:docker": "npm run build:prod && docker build -t angular2-webpack-start:latest .", "build:prod": "npm run clean:dist && npm run build:aot:prod", "build:prod:ghpages": "npm run clean:dist && node ./ghpages-adapt-angular-json.js && npm run build:aot:prod", + "build:prod:ghpages:test-ci-env": "npm run clean:dist && node ./ghpages-adapt-angular-json.js && npm run build:aot:prod:test-ci-env", "build": "npm run build:dev", "check-deps": "npx npm-check-u", "ci:aot": "cross-env BUILD_E2E=1 npm run lint && npm run test && npm run build:aot && npm run e2e",