Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// this babel config is for tests only
// babel config for client side is places inside webpack config
{
"presets": ["es2015", "react", "stage-2"]
"presets": ["env", "react", "stage-2"]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ignore dist directory to speed up linting after we build project
dist/*
43 changes: 43 additions & 0 deletions config/constants/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports = {
API_URL : 'https://api.topcoder-dev.com/v3',
API_URL_V2 : 'https://api.topcoder-dev.com/v2',
WORK_API_URL : 'https://api-work.topcoder-dev.com/v3',
INTERNAL_API_URL : 'https://internal-api.topcoder-dev.com/v3',
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder-dev.com/',
AUTH_API_URL : 'https://api.topcoder-dev.com/v3',
auth0Callback : 'https://api.topcoder-dev.com/pub/callback.html',
auth0Domain : 'topcoder-dev.auth0.com',
clientId : process.env.AUTH0_CLIENT_ID_DEV,
AUTH0_DOMAIN : 'topcoder-dev.auth0.com',
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_DEV,
domain : 'topcoder-dev.com',
DOMAIN : 'topcoder-dev.com',
ENV : 'DEV',

NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '8957921' : '',

ARENA_URL : '//arena.topcoder-dev.com',
BLOG_LOCATION : 'https://www.topcoder-dev.com/feed/',
COMMUNITY_URL : '//community.topcoder-dev.com',
FORUMS_APP_URL : '//apps.topcoder-dev.com/forums',
HELP_APP_URL : 'help.topcoder-dev.com',
MAIN_URL : 'https://www.topcoder-dev.com',
PHOTO_LINK_LOCATION: 'https://community.topcoder-dev.com',
SWIFT_PROGRAM_URL : 'apple.topcoder-dev.com',
TCO16_URL : 'http://tco16.topcoder-dev.com',
TCO17_URL : 'http://tco17.topcoder-dev.com',
TCO_HOME_URL : 'https://www.topcoder-dev.com/tco',

ACCOUNTS_APP_URL : 'https://accounts.topcoder-dev.com/#!/member',
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder-dev.com/connector.html',

FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_DEV,
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-dev',

SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',

CONNECT_SEGMENT_KEY: 'QBtLgV8vCiuRX1lDikbMjcoe9aCHkF6n',
PREDIX_PROGRAM_ID : 3448,
IBM_COGNITIVE_PROGRAM_ID : 3449,
HEAP_ANALYTICS_APP_ID : '4153837120'
}
10 changes: 10 additions & 0 deletions config/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = (() => {
const branch = process.env.CIRCLE_BRANCH || 'dev'

// for security reason don't let to require any arbitrary file defined in process.env
if (['dev', 'master', 'qa'].indexOf(branch) < 0) {
throw Error('Unsupported CIRCLE_BRANCH value.')
}

return require('./' + branch)
})()
43 changes: 43 additions & 0 deletions config/constants/master.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports = {
API_URL : 'https://api.topcoder.com/v3',
API_URL_V2 : 'https://api.topcoder.com/v2',
WORK_API_URL : 'https://api-work.topcoder.com/v3',
INTERNAL_API_URL : 'https://internal-api.topcoder.com/v3',
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder.com/',
AUTH_API_URL : 'https://api.topcoder.com/v3',
auth0Callback : 'https://api.topcoder.com/pub/callback.html',
auth0Domain : 'topcoder.auth0.com',
clientId : process.env.AUTH0_CLIENT_ID_PROD,
AUTH0_DOMAIN : 'topcoder.auth0.com',
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_PROD,
domain : 'topcoder.com',
DOMAIN : 'topcoder.com',
ENV : 'PROD',
NODE_ENV : 'production',

NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '11352758' : '',

ARENA_URL : '//arena.topcoder.com',
BLOG_LOCATION : 'https://www.topcoder.com/feed/',
COMMUNITY_URL : '//community.topcoder.com',
FORUMS_APP_URL : '//apps.topcoder.com/forums',
HELP_APP_URL : 'help.topcoder.com',
MAIN_URL : 'https://www.topcoder.com',
PHOTO_LINK_LOCATION: 'https://community.topcoder.com',
SWIFT_PROGRAM_URL : 'apple.topcoder.com',
TCO16_URL : 'http://tco16.topcoder.com',
TCO17_URL : 'http://tco17.topcoder.com',
TCO_HOME_URL : 'https://www.topcoder.com/tco',

ACCOUNTS_APP_URL : 'https://accounts.topcoder.com/#!/member',
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder.com/connector.html',

FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_PROD,
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-prod',

SALESFORCE_PROJECT_LEAD_LINK: 'https://topcoder.my.salesforce.com/apex/ConnectLead?connectProjectId=',
CONNECT_SEGMENT_KEY: 'ajP6cQ5SN2EMUWoWTOLROVnAHsOlsDCn',
PREDIX_PROGRAM_ID : 3448,
IBM_COGNITIVE_PROGRAM_ID : 3449,
HEAP_ANALYTICS_APP_ID : '638908330'
}
42 changes: 42 additions & 0 deletions config/constants/qa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
API_URL : 'https://api.topcoder-qa.com/v3',
API_URL_V2 : 'https://api.topcoder-qa.com/v2',
WORK_API_URL : 'https://api-work.topcoder-qa.com/v3',
INTERNAL_API_URL : 'https://internal-api.topcoder-qa.com/v3',
ASSET_PREFIX : 'https://s3.amazonaws.com/app.topcoder-qa.com/',
AUTH_API_URL : 'https://api.topcoder-qa.com/v3',
auth0Callback : 'https://api.topcoder-qa.com/pub/callback.html',
auth0Domain : 'topcoder-qa.auth0.com',
clientId : process.env.AUTH0_CLIENT_ID_QA,
AUTH0_DOMAIN : 'topcoder-qa.auth0.com',
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_QA,
domain : 'topcoder-qa.com',
DOMAIN : 'topcoder-qa.com',
ENV : 'QA',

NEW_RELIC_APPLICATION_ID: process.env.TRAVIS_BRANCH ? '11199233' : '',

ARENA_URL : '//arena.topcoder-qa.com',
BLOG_LOCATION : 'https://www.topcoder-qa.com/feed/',
COMMUNITY_URL : '//community.topcoder-qa.com',
FORUMS_APP_URL : '//apps.topcoder-qa.com/forums',
HELP_APP_URL : 'help.topcoder-qa.com',
MAIN_URL : 'https://www.topcoder-qa.com',
PHOTO_LINK_LOCATION: 'https://community.topcoder-qa.com',
SWIFT_PROGRAM_URL : 'apple.topcoder-qa.com',
TCO16_URL : 'http://tco16.topcoder-qa.com',
TCO17_URL : 'http://tco17.topcoder-qa.com',
TCO_HOME_URL : 'https://www.topcoder-dev.com/tco',

ACCOUNTS_APP_URL : 'https://accounts.topcoder-qa.com/#!/member',
ACCOUNTS_APP_CONNECTOR_URL : 'https://accounts.topcoder-qa.com/connector.html',

FILE_PICKER_API_KEY: process.env.FILE_PICKER_API_KEY_QA,
FILE_PICKER_SUBMISSION_CONTAINER_NAME: 'submission-staging-qa',

SALESFORCE_PROJECT_LEAD_LINK: 'https://c.cs18.visual.force.com/apex/ConnectLead?connectProjectId=',
CONNECT_SEGMENT_KEY: '',
PREDIX_PROGRAM_ID : 3448,
IBM_COGNITIVE_PROGRAM_ID : 3449,
HEAP_ANALYTICS_APP_ID : '4153837120'
}
117 changes: 117 additions & 0 deletions config/webpack/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
'use strict'

const _ = require('lodash')
const path = require('path')
const webpack = require('webpack')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

const constants = require('../constants')

const dirname = path.resolve(__dirname, '../..')

module.exports = {
context: dirname,

entry: [
'./src/styles/main.scss',
'./src/index'
],

output: {
path : path.join(dirname, '/dist'),
filename : '[name].[hash].js',
chunkFilename : '[name].[hash].js'
},

module: {
rules: [{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
options: {
babelrc: false,
presets: [ 'env', 'react', 'stage-2' ],
plugins: [ 'lodash' ]
}
}, {
test: /\.(coffee|litcoffee|cjsx)$/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: [ 'env', 'react', 'stage-2' ],
plugins: [ 'lodash' ]
}
},
'coffee-loader',
'cjsx-loader'
]
}, {
test: /\.json$/,
loader: 'json-loader'
}, {
/* We have to support css loading for third-party plugins,
* we are not supposed to use css files inside the project. */
test: /\.css$/,
use: ExtractCssChunks.extract({
fallback: 'style-loader',
use: ['css-loader']
})
}, {
// ASSET LOADER
// Copy png, jpg, jpeg, gif, svg, woff, woff2, ttf, eot files to output
// Rename the file using the asset hash
// Pass along the updated reference to your code
// You can add here any file extension you want to get copied to your output
test: /\.(png|jpg|jpeg|gif)$/,
loader: 'file-loader'
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}]

},

resolve: {
extensions: [
'.js',
'.jsx',
'.json',
'.coffee',
'.scss',
'.svg',
'.png',
'.gif',
'.jpg',
'.cjsx'
]
},

plugins: [
new webpack.DefinePlugin({
'process.env': _.mapValues(constants, (value) => JSON.stringify(value))
}),
new FaviconsWebpackPlugin({
logo: './src/favicon.png',
// disable cache, otherwise when there is a dist folder with icons
// icons don't wanna be generated in memory using webpack-dev-server
persistentCache: false
}),
new HtmlWebpackPlugin({
template: path.join(dirname, '/src/index.html'),
inject: 'body'
}),
// Only emit files when there are no errors
new webpack.NoEmitOnErrorsPlugin(),
new ExtractCssChunks({
filename: '[name].css',
justExtract: true
})
]
}
62 changes: 62 additions & 0 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const path = require('path')
const webpack = require('webpack')
const webpackMerge = require('webpack-merge')

const defaultConfig = require('./default')

const dirname = path.resolve(__dirname, '../..')

module.exports = webpackMerge(defaultConfig, {
entry: [
'react-hot-loader/patch'
],

devtool: 'eval',

module: {
rules: [{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!appirio-tech.*|topcoder|tc-)/,
options: {
babelrc: false,
presets: [ ['env', { modules: false }], 'react', 'stage-2' ],
plugins: [
'lodash',
// add react hot reloader
'react-hot-loader/babel'
]
}
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
includePaths: [
path.join(dirname, '/node_modules/bourbon/app/assets/stylesheets'),
path.join(dirname, '/node_modules/tc-ui/src/styles')
]
}
}
]
}]
},

plugins: [
// don't add HotModuleReplacementPlugin, because run webpack-dev-server with --hot param
// otherwise this plugin will be added twice and cause bugs
// new webpack.HotModuleReplacementPlugin(),

new webpack.NamedModulesPlugin()
]
})
54 changes: 54 additions & 0 deletions config/webpack/production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const path = require('path')
const webpack = require('webpack')
const webpackMerge = require('webpack-merge')
const CompressionPlugin = require('compression-webpack-plugin')
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')

const defaultConfig = require('./default')

const dirname = path.resolve(__dirname, '../..')

module.exports = webpackMerge(defaultConfig, {
devtool: 'source-map',

module: {
rules: [{
test: /\.scss$/,
use: ExtractCssChunks.extract({
fallback: 'style-loader',
use: [{
loader: 'css-loader',
options: {
sourceMap: true
}
},
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
includePaths: [
path.join(dirname, '/node_modules/bourbon/app/assets/stylesheets'),
path.join(dirname, '/node_modules/tc-ui/src/styles')
]
}
}]
})
}]
},

plugins: [
// Do not include any .mock.js files if this is a build
new webpack.IgnorePlugin(/\.mock\.js/),
new webpack.optimize.UglifyJsPlugin({
mangle: true
}),
new CompressionPlugin({
asset: '[file]',
algorithm: 'gzip',
regExp: /\.js$|\.css$/,
threshold: 10240,
minRatio: 0.8
})
]
})
Loading