Skip to content

Build improvement #3367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 25, 2019
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ workflows:
only:
- develop
- hot-fix
- survey_tc
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand All @@ -191,7 +190,6 @@ workflows:
branches:
only:
- develop
- survey_tc
# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
Expand Down
3 changes: 3 additions & 0 deletions config/jest/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ const config = require('topcoder-react-utils/config/jest/default');

config.transformIgnorePatterns[0] = '/node_modules/(?!appirio-tech|topcoder|tc-)';

// Include the directories whose tests has been written to minimize coverage time
config.collectCoverageFrom = ['src/client/*.{js,jsx}', 'src/server/*.{js,jsx}', 'src/shared/*.{js,jsx}'];

module.exports = config;
42 changes: 34 additions & 8 deletions config/webpack/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ const path = require('path');
let publicPath = process.env.CDN_URL || '/api/cdn/public';
publicPath += '/static-assets';

module.exports = {
// Import Speed measure plugin
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');

// Import Happypack plugin
const HappyPack = require('happypack');

// Create Speed measure plugin instance to measure the build time
const smp = new SpeedMeasurePlugin();

// Wrap the webpack config with Speed measure plugin instance to measure the build time
module.exports = smp.wrap({
entry: {
'loading-indicator-animation': './src/client/loading-indicator-animation',
},
Expand All @@ -30,18 +40,21 @@ module.exports = {
* are not bundled. */
/utils[\\/]router[\\/]require/,
],
/* Changed the rule to support for .png .svg and .jpg and jpeg files and
* using happypack loader for parallelism
*/
rules: [
{
test: /\.svg$/,
loader: 'file-loader',
options: {
outputPath: '/images/',
publicPath: `${publicPath}/images`,
},
test: /\.(png|jpe?g|svg)$/i,
exclude: /node_modules/,
use: ['happypack/loader'],
},
],
},
// Marking optimization as false to cut time in terser plugin minification step
optimization: {
minimize: false,
},
plugins: [
new CopyWebpackPlugin([{
from: path.resolve(__dirname, '../../src/assets/mock-data'),
Expand Down Expand Up @@ -77,5 +90,18 @@ module.exports = {
swDest: path.resolve(__dirname, '../../build/sw.js'),
importWorkboxFrom: 'local',
}),
// Adding happypack plugin
new HappyPack({
// Adding the file-loader alongwith its options to instansiate with happypack
loaders: [
{
loader: 'file-loader',
options: {
outputPath: '/images/',
publicPath: `${publicPath}/images`,
},
},
],
}),
],
};
});
2 changes: 1 addition & 1 deletion docs/deployment-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

There are total 4 deployment environments

| S | Environment | Backend API | Purpose | URL |
| # | Environment | Backend API | Purpose | URL |
| - | ------------ | ----------- | --------------------- | -------------------------------------------- |
| 1 | Development | Development | feature/fixes testing | `https://community-app.topcoder-dev.com` |
| 2 | Test | Development | feature/fixes testing | `https://test-community-app.topcoder-dev.com`|
Expand Down
Loading