Skip to content

Commit

Permalink
Merge pull request #1332 from appirio-tech/dev
Browse files Browse the repository at this point in the history
Promoting changes to production for Milestone 14
  • Loading branch information
vikasrohit authored Nov 20, 2017
2 parents c0acd63 + 602be86 commit 86387e8
Show file tree
Hide file tree
Showing 106 changed files with 7,433 additions and 2,226 deletions.
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/*
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ Install dependencies by running the following in the root of the project:

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.

### Updating npm-shrinkwrap.json

Use **npm v5+** for this.
General workflow to update `npm-shrinkwrap.json` would be:

- `npm install --no-optional` - with old npm-shrinkwrap (--no-optional to skip fsevents)
- update `package.json` if you need to remove/update/add any packages
- remove `npm-shrinkwrap.json`
- `npm install --no-optional` with new `package.json`
- `npm shrinkwrap` - to convert `package-lock.json` to `npm-shrinkwrap.json`
- the new `npm-shrinkwrap.json` will have just the minimal diff

### Code Style

***Checkout the code and comments in `src/components/ExampleComponent` for an example React component, `.scss` file, and tests.***
Expand Down
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'
}
9 changes: 9 additions & 0 deletions config/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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 (['master', 'qa'].indexOf(branch) < 0) {
return require('./dev')
}
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'
}
118 changes: 118 additions & 0 deletions config/webpack/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
'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',
publicPath : '/'
},

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
})
]
}
64 changes: 64 additions & 0 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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.strategy({
entry: 'prepend' // to put 'react-hot-loader/patch' first
})(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()
]
})
Loading

0 comments on commit 86387e8

Please sign in to comment.