Skip to content
This repository was archived by the owner on Oct 7, 2018. It is now read-only.

Commit 30e81bd

Browse files
committed
Starting code
0 parents  commit 30e81bd

15 files changed

+5071
-0
lines changed

.babelrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"stage-0",
5+
"react"
6+
]
7+
}

.eslintrc

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"mocha": true,
5+
"node": true,
6+
"browser": true
7+
},
8+
"extends": "airbnb",
9+
"parser": "babel-eslint",
10+
"plugins": [
11+
"react"
12+
],
13+
"rules": {
14+
"brace-style": 0,
15+
"import/no-extraneous-dependencies": 0,
16+
"jsx-a11y/no-static-element-interactions": 0,
17+
"linebreak-style": 0,
18+
"new-cap": 0,
19+
"newline-per-chained-call": 1,
20+
"no-mixed-operators": 0,
21+
"radix": 1,
22+
"react/forbid-prop-types": 0,
23+
"react/jsx-filename-extension": [
24+
1,
25+
{
26+
"extensions": [
27+
".js",
28+
".jsx"
29+
]
30+
}
31+
],
32+
"react/jsx-no-bind": [
33+
"error"
34+
],
35+
"strict": 0
36+
}
37+
}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
lib/
2+
node_modules/
3+
coverage/
4+
npm-debug.log
5+
yarn-error.log

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/
2+
coverage/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Tim Mikeladze
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# collager
2+
3+
[![CircleCI](https://circleci.com/gh/TimMikeladze/collager.svg?style=svg&circle-token=02d31325043fb486dbbebafa197884dd2f06377a)](https://circleci.com/gh/TimMikeladze/collager)
4+
5+
## Getting Started
6+
7+
To start the app run `yarn start`.

circle.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
machine:
2+
3+
node:
4+
version: 6.2.1

package.json

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "rest-example",
3+
"version": "0.0.1",
4+
"description": "",
5+
"private": true,
6+
"scripts": {
7+
"start-client": "webpack-dev-server --history-api-fallback -d --hot --inline --no-info --port 3000 --host 0.0.0.0",
8+
"start-server": "nodemon src/api/index.js --watch src/api --exec babel-node",
9+
"start": "concurrently \"yarn run start-server\" \"yarn run start-client\"",
10+
"build": "webpack -p --progress --config ./webpack.config.js",
11+
"lint": "eslint src/",
12+
"test": "yarn run testonly && yarn run lint",
13+
"testonly": "mocha --compilers js:babel-core/register --reporter spec --full-trace ./src/**/*.spec.js"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/js-accounts/rest-example"
18+
},
19+
"keywords": [],
20+
"author": "Tim Mikeladze",
21+
"license": "MIT",
22+
"devDependencies": {
23+
"babel-cli": "^6.18.0",
24+
"babel-core": "^6.18.2",
25+
"babel-eslint": "^7.1.1",
26+
"babel-loader": "^6.2.8",
27+
"babel-preset-es2015": "^6.18.0",
28+
"babel-preset-react": "^6.16.0",
29+
"babel-preset-stage-0": "^6.16.0",
30+
"chai": "^3.5.0",
31+
"chai-as-promised": "^6.0.0",
32+
"concurrently": "^3.1.0",
33+
"coveralls": "^2.11.15",
34+
"dotenv-webpack": "^1.3.1",
35+
"eslint": "^3.10.2",
36+
"eslint-config-airbnb": "^13.0.0",
37+
"eslint-config-airbnb-base": "^10.0.1",
38+
"eslint-plugin-import": "^2.2.0",
39+
"eslint-plugin-jsx-a11y": "^2.2.3",
40+
"eslint-plugin-react": "^6.7.1",
41+
"html-webpack-plugin": "^2.24.1",
42+
"istanbul": "^1.1.0-alpha.1",
43+
"json-loader": "^0.5.4",
44+
"lodash": "^4.17.2",
45+
"mocha": "^3.1.2",
46+
"nodemon": "^1.11.0",
47+
"watch-ignore-webpack-plugin": "^1.0.0",
48+
"webpack": "^1.13.3",
49+
"webpack-dev-server": "^1.16.2",
50+
"yarn": "^0.17.8"
51+
},
52+
"dependencies": {
53+
"body-parser": "^1.15.2",
54+
"express": "^4.14.0",
55+
"material-ui": "^0.16.4",
56+
"react": "^15.4.1",
57+
"react-dom": "^15.4.1",
58+
"react-helmet": "^3.2.2",
59+
"react-router": "^3.0.0",
60+
"react-tap-event-plugin": "^2.0.1"
61+
}
62+
}

src/api/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import express from 'express';
2+
import bodyParser from 'body-parser';
3+
4+
let PORT = 3010;
5+
if (process.env.PORT) {
6+
PORT = parseInt(process.env.PORT, 10) + 100;
7+
}
8+
9+
const app = express();
10+
11+
app.use(bodyParser.urlencoded({ extended: true }));
12+
app.use(bodyParser.json());
13+
14+
app.get('/', (req, res) => {
15+
res.send('test');
16+
});
17+
18+
app.listen(PORT, () => console.log( // eslint-disable-line no-console
19+
`API Server is now running on http://localhost:${PORT}`,
20+
));

src/ui/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
</head>
6+
<body>
7+
<div id="root"></div>
8+
</body>
9+
</html>

src/ui/index.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import 'babel-polyfill';
2+
import React from 'react';
3+
import Helmet from 'react-helmet';
4+
import { render } from 'react-dom';
5+
import { Router, Route, browserHistory } from 'react-router';
6+
import injectTapEventPlugin from 'react-tap-event-plugin';
7+
import { MuiThemeProvider } from 'material-ui';
8+
import packageConf from '../../package.json';
9+
10+
injectTapEventPlugin();
11+
12+
const Home = () => <div />;
13+
14+
render((
15+
<div>
16+
<Helmet
17+
title={`${packageConf.name} ${packageConf.version}`}
18+
meta={[
19+
{
20+
name: 'description',
21+
content: `${packageConf.description}`,
22+
},
23+
{
24+
name: 'viewport',
25+
content: 'width=device-width, initial-scale=1.0',
26+
},
27+
]}
28+
/>
29+
<MuiThemeProvider>
30+
<Router history={browserHistory}>
31+
<Route path="/" component={Home} />
32+
</Router>
33+
</MuiThemeProvider>
34+
</div>
35+
), document.getElementById('root')); //eslint-disable-line

src/ui/index.spec.js

Whitespace-only changes.

wallaby.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = function (wallaby) {
2+
return {
3+
files: [
4+
'src/**/*.js',
5+
'!src/**/*.spec.js',
6+
],
7+
8+
tests: [
9+
'src/**/*.spec.js',
10+
],
11+
12+
compilers: {
13+
'src/**/*.js': wallaby.compilers.babel(),
14+
},
15+
16+
env: {
17+
type: 'node',
18+
},
19+
};
20+
};

webpack.config.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const Dotenv = require('dotenv-webpack');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const path = require('path');
4+
const WatchIgnorePlugin = require('watch-ignore-webpack-plugin');
5+
6+
module.exports = {
7+
entry: './src/ui/index.js',
8+
devtool: 'eval-source-map',
9+
output: {
10+
publicPath: '/',
11+
filename: 'bundle.js',
12+
},
13+
module: {
14+
loaders: [
15+
{
16+
test: /\.css/,
17+
loader: 'style!css',
18+
},
19+
{
20+
test: /\.js$/,
21+
loader: 'babel',
22+
exclude: /node_modules/,
23+
},
24+
{
25+
test: /\.json$/,
26+
loader: 'json',
27+
},
28+
],
29+
},
30+
resolve: {
31+
alias: {
32+
react: path.resolve('./node_modules/react'),
33+
},
34+
},
35+
resolveLoader: {
36+
root: path.join(__dirname, 'node_modules'),
37+
},
38+
plugins: [
39+
new Dotenv({
40+
path: './.env',
41+
safe: true,
42+
}),
43+
new WatchIgnorePlugin([
44+
path.resolve(__dirname, './node_modules/'),
45+
path.resolve(__dirname, './src/api/'),
46+
]),
47+
new HtmlWebpackPlugin({
48+
template: './src/ui/index.html',
49+
}),
50+
],
51+
devServer: {
52+
proxy: {
53+
},
54+
historyApiFallback: {
55+
index: '/',
56+
},
57+
},
58+
};

0 commit comments

Comments
 (0)