Skip to content

Commit 86387e8

Browse files
author
vikasrohit
authored
Merge pull request #1332 from appirio-tech/dev
Promoting changes to production for Milestone 14
2 parents c0acd63 + 602be86 commit 86387e8

File tree

106 files changed

+7433
-2226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+7433
-2226
lines changed

.babelrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// this babel config is for tests only
2+
// babel config for client side is places inside webpack config
13
{
2-
"presets": ["es2015", "react", "stage-2"]
4+
"presets": ["env", "react", "stage-2"]
35
}

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ignore dist directory to speed up linting after we build project
2+
dist/*

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ Install dependencies by running the following in the root of the project:
4040

4141
To contribute to the repository, please create a feature branch off of the dev branch. Once you're finished working on the feature, make a pull request to merge it into dev. Please make sure that every pull request has passed the build checks, which appear just before the "Merge pull request" button in github.
4242

43+
### Updating npm-shrinkwrap.json
44+
45+
Use **npm v5+** for this.
46+
General workflow to update `npm-shrinkwrap.json` would be:
47+
48+
- `npm install --no-optional` - with old npm-shrinkwrap (--no-optional to skip fsevents)
49+
- update `package.json` if you need to remove/update/add any packages
50+
- remove `npm-shrinkwrap.json`
51+
- `npm install --no-optional` with new `package.json`
52+
- `npm shrinkwrap` - to convert `package-lock.json` to `npm-shrinkwrap.json`
53+
- the new `npm-shrinkwrap.json` will have just the minimal diff
54+
4355
### Code Style
4456

4557
***Checkout the code and comments in `src/components/ExampleComponent` for an example React component, `.scss` file, and tests.***

config/constants/dev.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module.exports = {
2+
API_URL : 'https://api.topcoder-dev.com/v3',
3+
API_URL_V2 : 'https://api.topcoder-dev.com/v2',
4+
WORK_API_URL : 'https://api-work.topcoder-dev.com/v3',
5+
INTERNAL_API_URL : 'https://internal-api.topcoder-dev.com/v3',
6+
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder-dev.com/',
7+
AUTH_API_URL : 'https://api.topcoder-dev.com/v3',
8+
auth0Callback : 'https://api.topcoder-dev.com/pub/callback.html',
9+
auth0Domain : 'topcoder-dev.auth0.com',
10+
clientId : process.env.AUTH0_CLIENT_ID_DEV,
11+
AUTH0_DOMAIN : 'topcoder-dev.auth0.com',
12+
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_DEV,
13+
domain : 'topcoder-dev.com',
14+
DOMAIN : 'topcoder-dev.com',
15+
ENV : 'DEV',
16+
17+
NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '8957921' : '',
18+
19+
ARENA_URL : '//arena.topcoder-dev.com',
20+
BLOG_LOCATION : 'https://www.topcoder-dev.com/feed/',
21+
COMMUNITY_URL : '//community.topcoder-dev.com',
22+
FORUMS_APP_URL : '//apps.topcoder-dev.com/forums',
23+
HELP_APP_URL : 'help.topcoder-dev.com',
24+
MAIN_URL : 'https://www.topcoder-dev.com',
25+
PHOTO_LINK_LOCATION: 'https://community.topcoder-dev.com',
26+
SWIFT_PROGRAM_URL : 'apple.topcoder-dev.com',
27+
TCO16_URL : 'http://tco16.topcoder-dev.com',
28+
TCO17_URL : 'http://tco17.topcoder-dev.com',
29+
TCO_HOME_URL : 'https://www.topcoder-dev.com/tco',
30+
31+
ACCOUNTS_APP_URL : 'https://accounts.topcoder-dev.com/#!/member',
32+
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder-dev.com/connector.html',
33+
34+
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_DEV,
35+
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-dev',
36+
37+
SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',
38+
39+
CONNECT_SEGMENT_KEY: 'QBtLgV8vCiuRX1lDikbMjcoe9aCHkF6n',
40+
PREDIX_PROGRAM_ID : 3448,
41+
IBM_COGNITIVE_PROGRAM_ID : 3449,
42+
HEAP_ANALYTICS_APP_ID : '4153837120'
43+
}

config/constants/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = (() => {
2+
const branch = process.env.CIRCLE_BRANCH || 'dev'
3+
4+
// for security reason don't let to require any arbitrary file defined in process.env
5+
if (['master', 'qa'].indexOf(branch) < 0) {
6+
return require('./dev')
7+
}
8+
return require('./' + branch)
9+
})()

config/constants/master.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
module.exports = {
2+
API_URL : 'https://api.topcoder.com/v3',
3+
API_URL_V2 : 'https://api.topcoder.com/v2',
4+
WORK_API_URL : 'https://api-work.topcoder.com/v3',
5+
INTERNAL_API_URL : 'https://internal-api.topcoder.com/v3',
6+
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder.com/',
7+
AUTH_API_URL : 'https://api.topcoder.com/v3',
8+
auth0Callback : 'https://api.topcoder.com/pub/callback.html',
9+
auth0Domain : 'topcoder.auth0.com',
10+
clientId : process.env.AUTH0_CLIENT_ID_PROD,
11+
AUTH0_DOMAIN : 'topcoder.auth0.com',
12+
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_PROD,
13+
domain : 'topcoder.com',
14+
DOMAIN : 'topcoder.com',
15+
ENV : 'PROD',
16+
NODE_ENV : 'production',
17+
18+
NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '11352758' : '',
19+
20+
ARENA_URL : '//arena.topcoder.com',
21+
BLOG_LOCATION : 'https://www.topcoder.com/feed/',
22+
COMMUNITY_URL : '//community.topcoder.com',
23+
FORUMS_APP_URL : '//apps.topcoder.com/forums',
24+
HELP_APP_URL : 'help.topcoder.com',
25+
MAIN_URL : 'https://www.topcoder.com',
26+
PHOTO_LINK_LOCATION: 'https://community.topcoder.com',
27+
SWIFT_PROGRAM_URL : 'apple.topcoder.com',
28+
TCO16_URL : 'http://tco16.topcoder.com',
29+
TCO17_URL : 'http://tco17.topcoder.com',
30+
TCO_HOME_URL : 'https://www.topcoder.com/tco',
31+
32+
ACCOUNTS_APP_URL : 'https://accounts.topcoder.com/#!/member',
33+
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder.com/connector.html',
34+
35+
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_PROD,
36+
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-prod',
37+
38+
SALESFORCE_PROJECT_LEAD_LINK: 'https://topcoder.my.salesforce.com/apex/ConnectLead?connectProjectId=',
39+
CONNECT_SEGMENT_KEY: 'ajP6cQ5SN2EMUWoWTOLROVnAHsOlsDCn',
40+
PREDIX_PROGRAM_ID : 3448,
41+
IBM_COGNITIVE_PROGRAM_ID : 3449,
42+
HEAP_ANALYTICS_APP_ID : '638908330'
43+
}

config/constants/qa.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module.exports = {
2+
API_URL : 'https://api.topcoder-qa.com/v3',
3+
API_URL_V2 : 'https://api.topcoder-qa.com/v2',
4+
WORK_API_URL : 'https://api-work.topcoder-qa.com/v3',
5+
INTERNAL_API_URL : 'https://internal-api.topcoder-qa.com/v3',
6+
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder-qa.com/',
7+
AUTH_API_URL : 'https://api.topcoder-qa.com/v3',
8+
auth0Callback : 'https://api.topcoder-qa.com/pub/callback.html',
9+
auth0Domain : 'topcoder-qa.auth0.com',
10+
clientId : process.env.AUTH0_CLIENT_ID_QA,
11+
AUTH0_DOMAIN : 'topcoder-qa.auth0.com',
12+
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_QA,
13+
domain : 'topcoder-qa.com',
14+
DOMAIN : 'topcoder-qa.com',
15+
ENV : 'QA',
16+
17+
NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '11199233' : '',
18+
19+
ARENA_URL : '//arena.topcoder-qa.com',
20+
BLOG_LOCATION : 'https://www.topcoder-qa.com/feed/',
21+
COMMUNITY_URL : '//community.topcoder-qa.com',
22+
FORUMS_APP_URL : '//apps.topcoder-qa.com/forums',
23+
HELP_APP_URL : 'help.topcoder-qa.com',
24+
MAIN_URL : 'https://www.topcoder-qa.com',
25+
PHOTO_LINK_LOCATION: 'https://community.topcoder-qa.com',
26+
SWIFT_PROGRAM_URL : 'apple.topcoder-qa.com',
27+
TCO16_URL : 'http://tco16.topcoder-qa.com',
28+
TCO17_URL : 'http://tco17.topcoder-qa.com',
29+
TCO_HOME_URL : 'https://www.topcoder-dev.com/tco',
30+
31+
ACCOUNTS_APP_URL : 'https://accounts.topcoder-qa.com/#!/member',
32+
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder-qa.com/connector.html',
33+
34+
FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_QA,
35+
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-qa',
36+
37+
SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',
38+
CONNECT_SEGMENT_KEY: '',
39+
PREDIX_PROGRAM_ID : 3448,
40+
IBM_COGNITIVE_PROGRAM_ID : 3449,
41+
HEAP_ANALYTICS_APP_ID : '4153837120'
42+
}

config/webpack/default.js

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
'use strict'
2+
3+
const _ = require('lodash')
4+
const path = require('path')
5+
const webpack = require('webpack')
6+
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
7+
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
8+
const HtmlWebpackPlugin = require('html-webpack-plugin')
9+
10+
const constants = require('../constants')
11+
12+
const dirname = path.resolve(__dirname, '../..')
13+
14+
module.exports = {
15+
context: dirname,
16+
17+
entry: [
18+
'./src/styles/main.scss',
19+
'./src/index'
20+
],
21+
22+
output: {
23+
path : path.join(dirname, '/dist'),
24+
filename : '[name].[hash].js',
25+
chunkFilename : '[name].[hash].js',
26+
publicPath : '/'
27+
},
28+
29+
module: {
30+
rules: [{
31+
test: /\.(js|jsx)$/,
32+
loader: 'babel-loader',
33+
exclude: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
34+
options: {
35+
babelrc: false,
36+
presets: [ 'env', 'react', 'stage-2' ],
37+
plugins: [ 'lodash' ]
38+
}
39+
}, {
40+
test: /\.(coffee|litcoffee|cjsx)$/,
41+
use: [
42+
{
43+
loader: 'babel-loader',
44+
options: {
45+
babelrc: false,
46+
presets: [ 'env', 'react', 'stage-2' ],
47+
plugins: [ 'lodash' ]
48+
}
49+
},
50+
'coffee-loader',
51+
'cjsx-loader'
52+
]
53+
}, {
54+
test: /\.json$/,
55+
loader: 'json-loader'
56+
}, {
57+
/* We have to support css loading for third-party plugins,
58+
* we are not supposed to use css files inside the project. */
59+
test: /\.css$/,
60+
use: ExtractCssChunks.extract({
61+
fallback: 'style-loader',
62+
use: ['css-loader']
63+
})
64+
}, {
65+
// ASSET LOADER
66+
// Copy png, jpg, jpeg, gif, svg, woff, woff2, ttf, eot files to output
67+
// Rename the file using the asset hash
68+
// Pass along the updated reference to your code
69+
// You can add here any file extension you want to get copied to your output
70+
test: /\.(png|jpg|jpeg|gif)$/,
71+
loader: 'file-loader'
72+
}, {
73+
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
74+
loader: 'file-loader'
75+
}, {
76+
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
77+
loader: 'file-loader'
78+
}]
79+
80+
},
81+
82+
resolve: {
83+
extensions: [
84+
'.js',
85+
'.jsx',
86+
'.json',
87+
'.coffee',
88+
'.scss',
89+
'.svg',
90+
'.png',
91+
'.gif',
92+
'.jpg',
93+
'.cjsx'
94+
]
95+
},
96+
97+
plugins: [
98+
new webpack.DefinePlugin({
99+
'process.env': _.mapValues(constants, (value) => JSON.stringify(value))
100+
}),
101+
new FaviconsWebpackPlugin({
102+
logo: './src/favicon.png',
103+
// disable cache, otherwise when there is a dist folder with icons
104+
// icons don't wanna be generated in memory using webpack-dev-server
105+
persistentCache: false
106+
}),
107+
new HtmlWebpackPlugin({
108+
template: path.join(dirname, '/src/index.html'),
109+
inject: 'body'
110+
}),
111+
// Only emit files when there are no errors
112+
new webpack.NoEmitOnErrorsPlugin(),
113+
new ExtractCssChunks({
114+
filename: '[name].css',
115+
justExtract: true
116+
})
117+
]
118+
}

config/webpack/development.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const path = require('path')
2+
const webpack = require('webpack')
3+
const webpackMerge = require('webpack-merge')
4+
5+
const defaultConfig = require('./default')
6+
7+
const dirname = path.resolve(__dirname, '../..')
8+
9+
module.exports = webpackMerge.strategy({
10+
entry: 'prepend' // to put 'react-hot-loader/patch' first
11+
})(defaultConfig, {
12+
entry: [
13+
'react-hot-loader/patch'
14+
],
15+
16+
devtool: 'eval',
17+
18+
module: {
19+
rules: [{
20+
test: /\.(js|jsx)$/,
21+
loader: 'babel-loader',
22+
exclude: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
23+
options: {
24+
babelrc: false,
25+
presets: [ ['env', { modules: false }], 'react', 'stage-2' ],
26+
plugins: [
27+
'lodash',
28+
// add react hot reloader
29+
'react-hot-loader/babel'
30+
]
31+
}
32+
}, {
33+
test: /\.scss$/,
34+
use: [
35+
'style-loader',
36+
{
37+
loader: 'css-loader',
38+
options: {
39+
sourceMap: true
40+
}
41+
},
42+
'resolve-url-loader',
43+
{
44+
loader: 'sass-loader',
45+
options: {
46+
sourceMap: true,
47+
includePaths: [
48+
path.join(dirname, '/node_modules/bourbon/app/assets/stylesheets'),
49+
path.join(dirname, '/node_modules/tc-ui/src/styles')
50+
]
51+
}
52+
}
53+
]
54+
}]
55+
},
56+
57+
plugins: [
58+
// don't add HotModuleReplacementPlugin, because run webpack-dev-server with --hot param
59+
// otherwise this plugin will be added twice and cause bugs
60+
// new webpack.HotModuleReplacementPlugin(),
61+
62+
new webpack.NamedModulesPlugin()
63+
]
64+
})

0 commit comments

Comments
 (0)