Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivekrajput20 committed Jun 24, 2019
1 parent b9b42e4 commit bc3bce6
Show file tree
Hide file tree
Showing 18 changed files with 456 additions and 441 deletions.
14 changes: 7 additions & 7 deletions client/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import "./index.css";
import React from "react";

export default class Header extends React.Component {
render() {
return (
<React.Fragment>
<div className="header-container">App Header</div>
</React.Fragment>
);
}
render() {
return (
<React.Fragment>
<div className="header-container">App Header</div>
</React.Fragment>
);
}
}
8 changes: 4 additions & 4 deletions client/components/header/header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from "react";
import Header from "./header";

describe("App Header", () => {
it("should render without crashing", () => {
const component = mount(<Header />);
expect(component).toMatchSnapshot();
});
it("should render without crashing", () => {
const component = mount(<Header />);
expect(component).toMatchSnapshot();
});
});
1 change: 1 addition & 0 deletions client/components/organization-wrapper/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* */
13 changes: 7 additions & 6 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import React from "react";
import {render} from "react-dom";
import {Provider} from "react-redux";
import {BrowserRouter} from "react-router-dom";

import Routes from "./routes";
import store from "./store";

window.store = store;
render(
<Provider store={store}>
<BrowserRouter>
<Routes />
</BrowserRouter>
</Provider>,
document.getElementById("root"),
<Provider store={store}>
<BrowserRouter>
<Routes />
</BrowserRouter>
</Provider>,
document.getElementById("root"),
);
7 changes: 3 additions & 4 deletions client/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { combineReducers } from 'redux';
import {combineReducers} from "redux";

const rootReducer = combineReducers({
});
export default rootReducer;
const rootReducer = combineReducers({});
export default rootReducer;
14 changes: 7 additions & 7 deletions client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {Route, Switch} from "react-router-dom";
import Header from "./components/header";

class Routes extends React.Component {
render() {
return (
<Switch>
<Route path="/" render={props => <Header {...props} />} />
</Switch>
);
}
render() {
return (
<Switch>
<Route path="/" render={props => <Header {...props} />} />
</Switch>
);
}
}
export default Routes;
7 changes: 4 additions & 3 deletions client/store/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { applyMiddleware, createStore } from 'redux';
import thunk from 'redux-thunk';
import {applyMiddleware, createStore} from "redux";
import thunk from "redux-thunk";

import rootReducer from "../reducers/index";

const store = createStore(rootReducer, applyMiddleware(thunk));
export default store;
export default store;
74 changes: 37 additions & 37 deletions config/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,53 @@ const serverConfigs = [];

// loop through all the config files
fs.readdirSync(configDir).forEach(file => {
if (path.extname(file) === ".yml") {
// read document, or log exception on error
try {
const config = yaml.safeLoad(
fs.readFileSync(`${configDir}/${file}`, "utf8"),
);
if (path.extname(file) === ".yml") {
// read document, or log exception on error
try {
const config = yaml.safeLoad(
fs.readFileSync(`${configDir}/${file}`, "utf8"),
);

// extract client config from object
const clientConfig = {
name: config.name,
slug: config.slug,
...config.client,
};
// extract client config from object
const clientConfig = {
name: config.name,
slug: config.slug,
...config.client,
};

// extract server config from object
const serverConfig = {
name: config.name,
slug: config.slug,
...config.server,
};
// extract server config from object
const serverConfig = {
name: config.name,
slug: config.slug,
...config.server,
};

// creates directory for assets
if (!fs.existsSync(`${clientDir}/assets/${config.slug}`))
fs.mkdirSync(`${clientDir}/assets/${config.slug}`);
// creates directory for assets
if (!fs.existsSync(`${clientDir}/assets/${config.slug}`))
fs.mkdirSync(`${clientDir}/assets/${config.slug}`);

clientConfigs.push(clientConfig);
serverConfigs.push(serverConfig);
} catch (error) {
console.log(error);
}
}
clientConfigs.push(clientConfig);
serverConfigs.push(serverConfig);
} catch (error) {
console.log(error);
}
}
});

// write server configs
fs.writeFile(
`${serverDir}/config.json`,
JSON.stringify(serverConfigs, null, 2),
error => {
if (error) console.log(error);
},
`${serverDir}/config.json`,
JSON.stringify(serverConfigs, null, 2),
error => {
if (error) console.log(error);
},
);

// write client configs
fs.writeFile(
`${clientDir}/config.json`,
JSON.stringify(clientConfigs, null, 2),
error => {
if (error) console.log(error);
},
`${clientDir}/config.json`,
JSON.stringify(clientConfigs, null, 2),
error => {
if (error) console.log(error);
},
);
124 changes: 62 additions & 62 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HardSourceWebpackPlugin = require("hard-source-webpack-plugin");

const CURRENT_WORKING_DIR = process.cwd()
const CURRENT_WORKING_DIR = process.cwd();

module.exports = (env, argv) => {
const config = {
context: path.resolve(CURRENT_WORKING_DIR, 'client'),
entry: {
main: './index.js'
},
output: {
filename: '[name].bundle.js',
chunkFilename: '[name].chunk.js',
path: path.resolve(CURRENT_WORKING_DIR, 'dist'),
publicPath: '/',
pathinfo: false
},
const config = {
context: path.resolve(CURRENT_WORKING_DIR, "client"),
entry: {
main: "./index.js",
},
output: {
filename: "[name].bundle.js",
chunkFilename: "[name].chunk.js",
path: path.resolve(CURRENT_WORKING_DIR, "dist"),
publicPath: "/",
pathinfo: false,
},

devtool:
argv.mode === 'development' ? 'cheap-module-source-map' : 'source-map',
devtool:
argv.mode === "development" ? "cheap-module-source-map" : "source-map",

resolve: {
extensions: ['*', '.js', '.jsx']
},
resolve: {
extensions: ["*", ".js", ".jsx"],
},

module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},

plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(CURRENT_WORKING_DIR, 'public/index.html')
})
],
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: path.resolve(CURRENT_WORKING_DIR, "public/index.html"),
}),
],

devServer: {
stats: {
colors: true
},
publicPath: '/',
compress: true,
overlay: {
warnings: true,
errors: true
},
progress: true,
stats: 'errors-only',
open: true,
contentBase: path.join(CURRENT_WORKING_DIR, 'public'),
watchContentBase: true,
watchOptions: {
ignored: /node_modules/
},
historyApiFallback: true
},
}
return config
}
devServer: {
stats: {
colors: true,
},
publicPath: "/",
compress: true,
overlay: {
warnings: true,
errors: true,
},
progress: true,
stats: "errors-only",
open: true,
contentBase: path.join(CURRENT_WORKING_DIR, "public"),
watchContentBase: true,
watchOptions: {
ignored: /node_modules/,
},
historyApiFallback: true,
},
};
return config;
};
Loading

0 comments on commit bc3bce6

Please sign in to comment.