Skip to content

Commit 766bbae

Browse files
author
Boy with Silver Wings
committed
Initial
0 parents  commit 766bbae

29 files changed

+15401
-0
lines changed

.browserslistrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Browsers that we support
2+
3+
> 3%
4+
Last 2 versions

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[Makefile]
15+
indent_style = tab

.eslintignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
3+
test/fixtures/
4+
test/output/
5+
6+
build-utils
7+
webpack.config.js
8+
postcss.config.js
9+
10+
dist
11+
12+
*.spec.js

.eslintrc.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"parser": "babel-eslint",
3+
"parserOptions": {
4+
"ecmaVersion": 6,
5+
"sourceType": "module",
6+
"ecmaFeatures": {
7+
"jsx": true
8+
}
9+
},
10+
"extends": [
11+
"airbnb",
12+
"prettier"
13+
],
14+
"rules": {
15+
"no-console": 0,
16+
"no-unused-vars": 1
17+
},
18+
"globals": {
19+
"window": true,
20+
"document": true,
21+
"navigator": true
22+
}
23+
}

.gitattributes

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Automatically normalize line endings for all text-based files
2+
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
3+
* text=auto
4+
5+
# For the following file types, normalize line endings to LF on
6+
# checkin and prevent conversion to CRLF when they are checked out
7+
# (this is required in order to prevent newline related issues like,
8+
# for example, after the build script is run)
9+
.* text eol=lf
10+
*.html text eol=lf
11+
*.css text eol=lf
12+
*.less text eol=lf
13+
*.scss text eol=lf
14+
*.sss text eol=lf
15+
*.js text eol=lf
16+
*.json text eol=lf
17+
*.md text eol=lf
18+
*.sh text eol=lf
19+
*.txt text eol=lf
20+
*.xml text eol=lf

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.idea
2+
.vscode
3+
4+
node_modules/
5+
6+
dist/
7+
8+
npm-debug.log
9+
10+
# misc
11+
.DS_Store
12+
.env.local
13+
.env.development.local
14+
.env.test.local
15+
.env.production.local
16+
17+
npm-debug.log*
18+
yarn-debug.log*
19+
yarn-error.log*
20+
21+
# testing
22+
/coverage
23+

.stylelintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.stylelintrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "stylelint-config-standard",
3+
"rules": {
4+
5+
}
6+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Agney Menon
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

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# React Configuration
2+
3+
Configuration for a react app.
4+
5+
Uses Webpack 4, Babel 7
6+
7+
## Quick Overview
8+
* `git clone --depth 1` this repository to get started.
9+
* `npm install` to install needed dependencies.
10+
* `npm start` to start the application on port 3002
11+
* `npm build` to build the application.
12+
13+
You can replace these with their `yarn` counterparts, if you prefer.
14+
15+
## Features
16+
* ### [POSTCSS Plugins](http://postcss.org/)
17+
* [Preset ENV CSS](https://preset-env.cssdb.org)
18+
19+
Write future CSS today. Better than using Preprocessors like SASS or LESS because it's pure CSS that you learn.
20+
21+
Comes with *autoprefixer* for your styles.
22+
23+
* [Stylelint](https://stylelint.io/)
24+
25+
Get a whole lot better stylelinting than ESLint.
26+
27+
Follows https://github.com/stylelint/stylelint-config-standard for linting.
28+
Turn rules on or off from `.stylelintrc.json` file.
29+
30+
* [PostCSS Normalize](https://www.npmjs.com/package/postcss-normalize)
31+
32+
Normalize stylesheets based on browser support for browserlist.
33+
34+
* ### [ESLint](https://eslint.org)
35+
Follows [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript). You can turn rules on or off from `.eslintrc.json`. You can choose to ignore files on whole from `.eslintignore`
36+
37+
Note: ESLint has it's style formatting options turned off by default, because it is handled by `Prettier` later on.
38+
39+
* ### [Babel](https://babeljs.io/)
40+
Used to compile your modern javascript to es2015 compatible javascript.
41+
You can change the configuration with .babelrc file.
42+
43+
* ### [Prettier](https://github.com/prettier/prettier)
44+
Formats code in place, so you don't have to learn the styling rules.
45+
46+
* ### [UglifyJS](https://github.com/mishoo/UglifyJS2)
47+
Used to minify, mangle and compress javascript code.
48+
Used only during production.
49+
50+
* ### [Workbox](https://developers.google.com/web/tools/workbox)
51+
Generates an optimised service worker with support for precaching and offline loading.
52+
53+
* ### Unit Testing
54+
Unit testing setup using [Jest](https://facebook.github.io/jest/). Shallow rendering support with [Enzyme](http://airbnb.io/enzyme/)
55+
56+
## Other enhancements
57+
1. Code split into `vendor.js` and hashed javascript filenames.
58+
This helps in pushing new code without worrying about caching issues.
59+
2. Webpack automatically looks for and installs plugins that are not installed by default.
60+
Just import the required library and let webpack worry about installing it.
61+
62+
https://github.com/webpack-contrib/npm-install-webpack-plugin
63+
3. Extracts CSS to a new file and minifies it.
64+
65+
https://github.com/webpack-contrib/extract-text-webpack-plugin
66+
67+
4. Minifies react and react-dom packages.
68+
69+
https://facebook.github.io/react/docs/optimizing-performance.html#webpack
70+
5. Removes debugging consoles for Production build
71+
72+
73+
74+
_Feel free to throw in a pull request._
75+
76+
77+

__mocks__/fileMock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "test-file-stub";

__mocks__/styleMock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

babel.config.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const presets = [
2+
[
3+
"@babel/env",
4+
{
5+
targets: {
6+
edge: "17",
7+
firefox: "60",
8+
chrome: "67",
9+
safari: "11.1"
10+
},
11+
useBuiltIns: "usage"
12+
}
13+
],
14+
"@babel/preset-react"
15+
];
16+
17+
const plugins = [
18+
"@babel/plugin-proposal-object-rest-spread",
19+
"@babel/plugin-proposal-class-properties"
20+
];
21+
22+
module.exports = { presets, plugins };

build-utils/common-paths.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const path = require("path");
2+
const glob = require("glob");
3+
4+
module.exports = {
5+
root: path.resolve(__dirname, ".."),
6+
outputPath: path.resolve(__dirname, "../", "dist"),
7+
appSrc: path.resolve(__dirname, "../", "src"),
8+
public: path.resolve(__dirname, "../", "public")
9+
};

build-utils/webpack.common.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const commonPaths = require("./common-paths");
2+
const webpack = require("webpack");
3+
const htmlWebpackPlugin = require("html-webpack-plugin");
4+
5+
const config = {
6+
output: {
7+
filename: "[hash].bundle.js",
8+
path: commonPaths.outputPath,
9+
publicPath: "/"
10+
},
11+
resolve: {
12+
extensions: [".js", ".jsx"]
13+
},
14+
module: {
15+
rules: [
16+
{
17+
test: /\.(jpe?g|png|gif|svg|eot|ttf|woff|woff2)$/i,
18+
use: [
19+
{
20+
loader: "url-loader",
21+
options: {
22+
limit: 1000
23+
}
24+
}
25+
]
26+
},
27+
{
28+
test: /\.html$/,
29+
loader: "html-loader"
30+
}
31+
]
32+
},
33+
plugins: [
34+
new webpack.ProgressPlugin(),
35+
new htmlWebpackPlugin({
36+
template: "public/index.html"
37+
})
38+
]
39+
};
40+
41+
module.exports = config;

build-utils/webpack.dev.js

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const webpack = require("webpack");
2+
3+
const config = {
4+
devServer: {
5+
port: 3000,
6+
open: true,
7+
host: "0.0.0.0",
8+
overlay: true,
9+
hot: true,
10+
useLocalIp: true,
11+
historyApiFallback: true
12+
},
13+
devtool: "eval-source-map",
14+
module: {
15+
rules: [
16+
{
17+
test: /\.css$/,
18+
exclude: /node_modules/,
19+
use: [
20+
{
21+
loader: "style-loader"
22+
},
23+
{
24+
loader: "css-loader",
25+
options: {
26+
importLoaders: 1
27+
}
28+
},
29+
{
30+
loader: "postcss-loader"
31+
}
32+
]
33+
},
34+
{
35+
enforce: "pre",
36+
test: /\.jsx?$/,
37+
exclude: /node_modules/,
38+
loader: "eslint-loader"
39+
},
40+
{
41+
test: /.jsx?$/,
42+
use: {
43+
loader: "babel-loader"
44+
},
45+
exclude: /(node_modules|dist|build-utils|webpack.config.js)/
46+
}
47+
]
48+
},
49+
plugins: [
50+
new webpack.HotModuleReplacementPlugin(),
51+
]
52+
};
53+
54+
module.exports = config;

0 commit comments

Comments
 (0)