Initial setup

This commit is contained in:
Kai Moseley 2016-09-20 17:58:31 +01:00
commit 1d990f63f2
6 changed files with 180 additions and 0 deletions

4
.babelrc Normal file
View File

@ -0,0 +1,4 @@
{
"presets": ["es2015", "react"],
"plugins": ["transform-object-rest-spread", "syntax-async-functions", "transform-async-to-generator", "transform-flow-strip-types"]
}

44
.eslintrc.js Normal file
View File

@ -0,0 +1,44 @@
module.exports = {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
experimentalObjectRestSpread: true,
}
},
plugins: [
'react',
'flowtype',
],
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:flowtype/recommended'
],
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true,
}
},
rules: {
'react/prop-types': ['off'],
'react/display-name': ['off'],
'no-console': ['warn'],
//'arrow-parens': ['warn', 'as-needed'],
},
env: {
browser: true,
node: true,
es6: true,
},
globals: {
_: true,
_fmt: true,
_misc: true,
_arr: true,
_cfg: true,
Promise: true,
RE_CHILD_INDEX_JS: true,
}
};

2
.flowconfig Normal file
View File

@ -0,0 +1,2 @@
[ignore]
.*/node_modules/fbjs/*

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.idea/*
/node_modules/*

63
package.json Normal file
View File

@ -0,0 +1,63 @@
{
"name": "react-custom-home",
"version": "0.0.0",
"description": "A customisable home screen",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --progress --content-base dist/",
"test": "jest"
},
"jest": {
"testPathDirs": [
"<rootDir>/src"
],
"moduleFileExtensions": [
"js",
"jsx",
"json"
],
"moduleDirectories": [
"node_modules"
],
"modulePaths": [
"/src"
],
"moduleNameMapper": {
"^.+\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/src/__mocks__/fileMock.js"
}
},
"author": "Kai Moseley",
"license": "ISC",
"devDependencies": {
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-async-to-generator": "^6.8.0",
"babel-plugin-transform-flow-strip-types": "^6.14.0",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"body-parser": "^1.15.2",
"css-loader": "^0.24.0",
"enzyme": "^2.4.1",
"eslint": "^3.2.2",
"eslint-loader": "^1.5.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-flowtype": "^2.18.1",
"eslint-plugin-react": "^6.0.0",
"express": "^4.14.0",
"flow-bin": "^0.32.0",
"jest": "^15.1.1",
"lodash": "^4.15.0",
"node-sass": "^3.8.0",
"react": "^15.3.1",
"react-css-modules": "^3.7.9",
"react-dom": "^15.3.1",
"react-redux": "^4.4.5",
"sass-loader": "^4.0.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.1"
}
}

65
webpack.config.js Normal file
View File

@ -0,0 +1,65 @@
const webpack = require('webpack');
const path = require('path');
const _ = require('lodash');
const PATH_ESLINT = path.join(__dirname, '.eslintrc.js');
const PATH_SRC = path.join(__dirname, 'src/client/');
const PATH_ALIASES = _.mapValues({
'home-screen': 'src/client/home-screen',
}, relativePath => path.join(__dirname, relativePath));
module.exports = {
context: __dirname,
entry: {
'home-screen': './src/client/home-screen'
},
devServer: {
inline: true,
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js',
},
devtool: 'inline-source-map',
eslint: {
configFile: PATH_ESLINT,
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
include: [PATH_SRC],
exclude: [],
loader: "babel-loader",
},
{
test: /\.css$/,
loaders: ['style', 'css', 'sass']
},
{
test: /\.scss$/,
loaders: [
'style',
'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
'sass'
]
}
],
preLoaders: [ { test: /\.js$/, include: [PATH_SRC], loader: 'eslint-loader' } ]
},
resolve: {
extensions: ['', '.js', '.json', '.jsx'],
alias: PATH_ALIASES,
},
plugins: [
new webpack.ProvidePlugin({
_: 'lodash'
}),
function () {
this.plugin('done', () =>
setTimeout(() => console.log('\nFinished at ' + (new Date).toLocaleTimeString() + '\n'), 10)
);
},
new webpack.HotModuleReplacementPlugin(),
]
};