-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ramakrishnan CS
committed
Mar 21, 2020
1 parent
52b060f
commit fe85d05
Showing
55 changed files
with
20,318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": [ | ||
"react-hot-loader/babel", | ||
[ | ||
"babel-plugin-react-css-modules", | ||
{ | ||
"context": "./src", | ||
"generateScopedName": "[path][name]__[local]--[hash:base64:5]", | ||
"handleMissingStyleName": "throw", | ||
"webpackHotModuleReloading": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": "airbnb", | ||
"globals": { | ||
"document": true, | ||
"describe": true, | ||
"beforeEach": true, | ||
"context": true, | ||
"expect": true, | ||
"it": true, | ||
"React": true, | ||
"fetch": true, | ||
"window": true, | ||
"isNaN": true, | ||
"localStorage": true | ||
}, | ||
"rules": { | ||
"react/sort-prop-types": 2, | ||
"react/jsx-sort-props": 2 | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"es6": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": [ | ||
"stylelint-config-standard", | ||
"stylelint-config-css-modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
|
||
configure({ adapter: new Adapter() }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
rootDir: '../', | ||
moduleFileExtensions: ['js', 'jsx'], | ||
moduleDirectories: ['node_modules', 'src'], | ||
modulePaths: ['src'], | ||
moduleNameMapper: { | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': | ||
'<rootDir>/src/__mocks__/fileMock.js', | ||
'\\.(css|less)$': 'identity-obj-proxy', | ||
}, | ||
roots: ['<rootDir>/src/'], | ||
transformIgnorePatterns: [ | ||
'/node_modules/', | ||
], | ||
testPathIgnorePatterns: [ | ||
'/node_modules/', | ||
], | ||
transform: { | ||
'^.+\\.(js|jsx)$': 'babel-jest', | ||
}, | ||
verbose: true, | ||
testResultsProcessor: 'jest-html-reporter', | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'**/*.{js,jsx}', | ||
'!**/node_modules/**', | ||
'!**/vendor/**', | ||
], | ||
coverageDirectory: '<rootDir>/coverage', | ||
coverageReporters: ['lcov'], | ||
setupFiles: ['<rootDir>/config/enzyme.setup.js'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"opts": { | ||
"destination": "./docs", | ||
"readme": "README.md", | ||
"recursive": true | ||
}, | ||
"plugins": ["plugins/markdown"], | ||
"recurseDepth": 10, | ||
"source": { | ||
"include": ["src/"], | ||
"includePattern": ".+\\.js(doc|x)?$", | ||
"excludePattern": "(^|\\/|\\\\)_" | ||
}, | ||
"sourceType": "module", | ||
"tags": { | ||
"allowUnknownTags": true, | ||
"dictionaries": ["jsdoc","closure"] | ||
}, | ||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
gzip on; | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
#charset koi8-r; | ||
#access_log /var/log/nginx/host.access.log main; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
error_page 404 /404.html; | ||
location = /404.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const productionPlugins = [ | ||
require('postcss-import'), | ||
require('postcss-preset-env')({ stage: 4 }), | ||
require('autoprefixer'), | ||
require('cssnano'), | ||
]; | ||
|
||
module.exports = ({ file, options, env }) => ({ | ||
parser: file.extname === '.sss' ? 'sugarss' : false, | ||
plugins: env === 'production' ? productionPlugins : [], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const CleanWebpackPlugin = require('clean-webpack-plugin'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const StyleLintPlugin = require('stylelint-webpack-plugin'); | ||
|
||
const devMode = process.env.NODE_ENV !== 'production'; | ||
|
||
const srcPath = path.join(__dirname, '../src'); | ||
const publicPath = '/'; | ||
|
||
module.exports = { | ||
cache: false, | ||
context: srcPath, | ||
entry: [ | ||
'@babel/polyfill', | ||
path.join(__dirname, '../src/index'), | ||
], | ||
node: { | ||
fs: 'empty', | ||
}, | ||
output: { | ||
path: path.join(__dirname, '../dist'), | ||
filename: 'static/[name].[hash].js', | ||
publicPath, | ||
}, | ||
resolve: { | ||
extensions: [ | ||
'.js', | ||
'.jsx', | ||
], | ||
alias: { | ||
actions: `${srcPath}/actions/`, | ||
appconstants: `${srcPath}/appconstants/`, | ||
components: `${srcPath}/components/`, | ||
containers: `${srcPath}/containers/`, | ||
ducks: `${srcPath}/state/ducks/`, | ||
selectors: `${srcPath}/selectors/`, | ||
stores: `${srcPath}/stores/`, | ||
helpers: `${srcPath}/helpers/`, | ||
reducers: `${srcPath}/reducers/`, | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
enforce: 'pre', | ||
include: srcPath, | ||
loader: 'eslint-loader', | ||
}, | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /node_modules/, | ||
include: srcPath, | ||
loader: 'babel-loader', | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
devMode ? 'style-loader' : MiniCssExtractPlugin.loader, | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
importLoaders: 2, | ||
localIdentName: '[path][name]__[local]--[hash:base64:5]', | ||
modules: true, | ||
}, | ||
}, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
config: { | ||
path: path.resolve(__dirname), | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: 'url-loader', | ||
options: { | ||
limit: 10000, | ||
mimetype: 'application/font-woff', | ||
}, | ||
}, | ||
{ | ||
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: 'url-loader', | ||
options: { | ||
limit: 10000, | ||
mimetype: 'application/font-woff', | ||
}, | ||
}, | ||
{ | ||
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: 'url-loader', | ||
options: { | ||
limit: 10000, | ||
mimetype: 'application/octet-stream', | ||
}, | ||
}, | ||
{ | ||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: 'file-loader', | ||
}, | ||
{ | ||
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
loader: 'url-loader', | ||
options: { | ||
limit: 10000, | ||
mimetype: 'image/svg+xml', | ||
}, | ||
}, | ||
{ | ||
test: /\.(png|jpg|gif|woff|woff2)$/, | ||
loader: 'url-loader', | ||
options: { | ||
limit: 8192, | ||
}, | ||
}, | ||
{ | ||
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/, | ||
loader: 'file-loader', | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin('dist', { root: path.join(__dirname, '../') }), | ||
new CopyWebpackPlugin([ | ||
{ | ||
from: path.join(__dirname, '../public/'), | ||
to: path.join(__dirname, '../dist/'), | ||
}, | ||
]), | ||
new HtmlWebpackPlugin({ | ||
filename: 'index.html', | ||
title: 'Country Finder', | ||
template: path.join(__dirname, '../src/assets/template.html'), | ||
}), | ||
new MiniCssExtractPlugin({ | ||
filename: 'static/[name].[hash].css', | ||
}), | ||
new MiniCssExtractPlugin({ | ||
filename: 'static/css/[name].[hash].css', | ||
}), | ||
new StyleLintPlugin({ | ||
configFile: path.resolve(__dirname, '../.stylelintrc'), | ||
context: srcPath, | ||
emitErrors: false, | ||
files: '**/*.css', | ||
failOnError: true, | ||
quiet: false, | ||
}), | ||
new webpack.NoEmitOnErrorsPlugin(), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = (env) => { | ||
if (env.NODE_ENV === 'production') { | ||
process.env.NODE_ENV = env.NODE_ENV; | ||
return require('./webpack.production'); | ||
} | ||
return require('./webpack.local'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const merge = require('webpack-merge'); | ||
const baseConfig = require('./webpack.common'); | ||
|
||
const port = 8080; | ||
|
||
const config = merge( | ||
baseConfig, | ||
{ | ||
mode: 'development', | ||
cache: true, | ||
devtool: 'eval-source-map', | ||
devServer: { | ||
compress: true, | ||
historyApiFallback: true, | ||
hot: true, | ||
port, | ||
publicPath: '/', | ||
noInfo: false, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Credentials': 'true', | ||
}, | ||
proxy: { | ||
'/api/search': { | ||
target: 'http://localhost:7700/', | ||
secure: false, | ||
changeOrigin: true, | ||
pathRewrite: { | ||
'^/api/search': '/countries', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
); | ||
|
||
module.exports = config; |
Oops, something went wrong.