Skip to content

Commit db665b6

Browse files
authored
Merge pull request #1 from baoduy/develop
Finished the material-dashboard-react intergration
2 parents c1dc048 + 184b8a0 commit db665b6

File tree

97 files changed

+20590
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+20590
-3
lines changed

.babelrc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"presets": [
3+
[
4+
"babel-preset-env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"browsers": [
9+
">0.25%",
10+
"not ie 10",
11+
"not op_mini all"
12+
]
13+
}
14+
}
15+
],
16+
"react-latest",
17+
"stage-3"
18+
],
19+
"plugins": [
20+
"babel-plugin-transform-class-properties",
21+
"babel-plugin-transform-class",
22+
"babel-plugin-transform-async-to-generator",
23+
"react-hot-loader/babel", //Enables React code to work with HMR.
24+
[
25+
"module-resolver",
26+
{
27+
"root": [
28+
"./src"
29+
]
30+
}
31+
]
32+
],
33+
"env": {
34+
"test": {
35+
"presets": [
36+
"env",
37+
"react"
38+
],
39+
"plugins": [
40+
"transform-es2015-modules-commonjs"
41+
]
42+
},
43+
"production": {
44+
"plugins": [
45+
[
46+
"babel-plugin-webpack-alias"
47+
]
48+
]
49+
}
50+
}
51+
}

.gitattributes

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
*.styl text eol=lf
14+
*.scss text eol=lf
15+
*.sass text eol=lf
16+
*.sss text eol=lf
17+
*.js text eol=lf
18+
*.jsx text eol=lf
19+
*.json text eol=lf
20+
*.md text eol=lf
21+
*.mjs text eol=lf
22+
*.sh text eol=lf
23+
*.svg text eol=lf
24+
*.txt text eol=lf
25+
*.xml text eol=lf

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,9 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
332+
.idea/
333+
dist/
334+
node_modules/
335+
tests/__coverage__/
336+
*/package-lock.json

.jshintrc

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
// JSHint Default Configuration File (as on JSHint website)
3+
// See http://jshint.com/docs/ for more details
4+
5+
"maxerr": 50, // {int} Maximum error before stopping
6+
7+
// Enforcing
8+
"bitwise": true, // true: Prohibit bitwise operators (&, |, ^, etc.)
9+
"camelcase": false, // true: Identifiers must be in camelCase
10+
"curly": false, // true: Require {} for every new block or scope
11+
"eqeqeq": true, // true: Require triple equals (===) for comparison
12+
"forin": true, // true: Require filtering for..in loops with obj.hasOwnProperty()
13+
"freeze": true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
14+
"immed": false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
15+
"latedef": true, // true: Require variables/functions to be defined before being used
16+
"newcap": false, // true: Require capitalization of all constructor functions e.g. `new F()`
17+
"noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
18+
"noempty": true, // true: Prohibit use of empty blocks
19+
"nonbsp": true, // true: Prohibit "non-breaking whitespace" characters.
20+
"nonew": false, // true: Prohibit use of constructors for side-effects (without assignment)
21+
"plusplus": false, // true: Prohibit use of `++` and `--`
22+
"quotmark": false, // Quotation mark consistency:
23+
// false : do nothing (default)
24+
// true : ensure whatever is used is consistent
25+
// "single" : require single quotes
26+
// "double" : require double quotes
27+
"undef": true, // true: Require all non-global variables to be declared (prevents global leaks)
28+
"unused": true, // Unused variables:
29+
// true : all variables, last function parameter
30+
// "vars" : all variables only
31+
// "strict" : all variables, all function parameters
32+
"strict": false, // true: Requires all functions run in ES5 Strict Mode
33+
"maxparams": false, // {int} Max number of formal params allowed per function
34+
"maxdepth": false, // {int} Max depth of nested blocks (within functions)
35+
"maxstatements": false, // {int} Max number statements per function
36+
"maxcomplexity": false, // {int} Max cyclomatic complexity per function
37+
"maxlen": false, // {int} Max number of characters per line
38+
"varstmt": true, // true: Disallow any var statements. Only `let` and `const` are allowed.
39+
40+
// Relaxing
41+
"asi": true, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
42+
"boss": false, // true: Tolerate assignments where comparisons would be expected
43+
"debug": false, // true: Allow debugger statements e.g. browser breakpoints.
44+
"eqnull": false, // true: Tolerate use of `== null`
45+
"esversion": 6, // {int} Specify the ECMAScript version to which the code must adhere.
46+
"moz": false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
47+
// (ex: `for each`, multiple try/catch, function expression…)
48+
"evil": false, // true: Tolerate use of `eval` and `new Function()`
49+
"expr": false, // true: Tolerate `ExpressionStatement` as Programs
50+
"funcscope": false, // true: Tolerate defining variables inside control statements
51+
"globalstrict": false, // true: Allow global "use strict" (also enables 'strict')
52+
"iterator": false, // true: Tolerate using the `__iterator__` property
53+
"lastsemic": false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
54+
"laxbreak": false, // true: Tolerate possibly unsafe line breakings
55+
"laxcomma": false, // true: Tolerate comma-first style coding
56+
"loopfunc": false, // true: Tolerate functions being defined in loops
57+
"multistr": false, // true: Tolerate multi-line strings
58+
"noyield": false, // true: Tolerate generator functions with no yield statement in them.
59+
"notypeof": false, // true: Tolerate invalid typeof operator values
60+
"proto": false, // true: Tolerate using the `__proto__` property
61+
"scripturl": false, // true: Tolerate script-targeted URLs
62+
"shadow": false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
63+
"sub": false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
64+
"supernew": false, // true: Tolerate `new function () { ... };` and `new Object;`
65+
"validthis": false, // true: Tolerate using this in a non-constructor function
66+
67+
// Environments
68+
"browser": true, // Web Browser (window, document, etc)
69+
"browserify": false, // Browserify (node.js code in the browser)
70+
"couch": false, // CouchDB
71+
"devel": true, // Development/debugging (alert, confirm, etc)
72+
"dojo": false, // Dojo Toolkit
73+
"jasmine": false, // Jasmine
74+
"jquery": false, // jQuery
75+
"mocha": false, // Mocha
76+
"mootools": false, // MooTools
77+
"node": false, // Node.js
78+
"nonstandard": false, // Widely adopted globals (escape, unescape, etc)
79+
"phantom": false, // PhantomJS
80+
"prototypejs": false, // Prototype and Scriptaculous
81+
"qunit": false, // QUnit
82+
"rhino": false, // Rhino
83+
"shelljs": false, // ShellJS
84+
"typed": false, // Globals for typed array constructions
85+
"worker": false, // Web Workers
86+
"wsh": false, // Windows Scripting Host
87+
"yui": false, // Yahoo User Interface
88+
89+
// Custom Globals
90+
"globals": {} // additional predefined global variables
91+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Steven
3+
Copyright (c) 2017 Viktor Persson
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
1-
# React-Start-Kit
2-
The ReactJs start kit that include Redux, Material UI, Babel and Webpack
1+
# React Webpack Babel Starter
2+
Minimal starter kit with hot module replacement (HMR) for rapid development.
3+
4+
* **[React](https://facebook.github.io/react/)** (16.x)
5+
* **[Webpack](https://webpack.js.org/)** (4.x)
6+
* **[Hot Module Replacement (HMR)](https://webpack.js.org/guides/hmr-react/)** using [React Hot Loader](https://github.com/gaearon/react-hot-loader) (4.x)
7+
* **[Babel](http://babeljs.io/)** (6.x)
8+
* [LESS](http://lesscss.org/)
9+
* [Jest](https://facebook.github.io/jest/) - Testing framework for React applications
10+
* Image loading/minification using [Image Webpack Loader](https://github.com/tcoopman/image-webpack-loader)
11+
* Code quality (linting) for JavaScript and SASS/CSS.
12+
13+
#Original Source Code
14+
The source had been clone from [vikpe/react-webpack-babel-starter](https://github.com/vikpe/react-webpack-babel-starter) and on top of that I added some useful packages.
15+
16+
## Installation
17+
1. Clone/download repo
18+
2. `npm install`
19+
20+
## Usage
21+
**Development**
22+
23+
`npm run start-dev`
24+
25+
* Build app continously (HMR enabled)
26+
* App served @ `http://localhost:8080`
27+
28+
**Production**
29+
30+
`npm run start-prod`
31+
32+
* Build app once (HMR disabled)
33+
* App served @ `http://localhost:3000`
34+
35+
---
36+
37+
**All commands**
38+
39+
| Command | Description |
40+
| -------------------- | ----------------------------------------------------------------------- |
41+
| `npm run start-dev` | Build app continously (HMR enabled) and serve @ `http://localhost:8080` |
42+
| `npm run start-prod` | Build app once (HMR disabled) and serve @ `http://localhost:3000` |
43+
| `npm run build` | Build app to `/dist/` |
44+
| `npm run test` | Run tests |
45+
| `npm run lint` | Run JavaScript and SASS linter |
46+
| `npm run lint:js` | Run JavaScript linter |
47+
| `npm run lint:sass` | Run SASS linter |
48+
| `npm run start` | (alias of `npm run start-dev`) |
49+
50+
## See also
51+
* [React Webpack Typescript Starter](https://github.com/vikpe/react-webpack-typescript-starter)
52+
* [Isomorphic Webapp Starter](https://github.com/vikpe/isomorphic-webapp-starter)

configs/jest.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"rootDir": "..",
3+
"coverageDirectory": "<rootDir>/tests/__coverage__/",
4+
"setupFiles": [
5+
"<rootDir>/tests/__mocks__/shim.js"
6+
],
7+
"roots": [
8+
"<rootDir>/src/",
9+
"<rootDir>/tests/"
10+
],
11+
"moduleNameMapper": {
12+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/__mocks__/fileMock.js",
13+
"\\.(css|scss|less)$": "<rootDir>/tests/__mocks__/styleMock.js"
14+
},
15+
"moduleFileExtensions": ["js", "jsx"],
16+
"transformIgnorePatterns": [
17+
"/node_modules/"
18+
],
19+
"testRegex": "/tests/.*\\.test\\.(js|jsx)$",
20+
"moduleDirectories": [
21+
"node_modules"
22+
],
23+
"globals": {
24+
"DEVELOPMENT": false,
25+
"FAKE_SERVER": false
26+
}
27+
}

configs/webpack/common.js

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// shared config (dev and prod)
2+
const {
3+
resolve
4+
} = require('path');
5+
6+
const HtmlWebpackPlugin = require('html-webpack-plugin');
7+
const webpack = require('webpack');
8+
//const CopyWebpackPlugin = require('copy-webpack-plugin');
9+
10+
module.exports = {
11+
resolve: {
12+
extensions: ['.js', '.jsx'],
13+
},
14+
context: resolve(__dirname, '../../src'),
15+
module: {
16+
rules: [{
17+
test: /\.(js|jsx)$/,
18+
use: {
19+
loader: "babel-loader",
20+
},
21+
exclude: /node_modules/,
22+
},
23+
{
24+
test: /\.css$/,
25+
use: [
26+
'style-loader',
27+
{
28+
loader: 'css-loader',
29+
options: {
30+
importLoaders: 1
31+
}
32+
},
33+
'postcss-loader',
34+
],
35+
},
36+
// {
37+
// test: /\.scss$/,
38+
// loaders: [
39+
// 'style-loader',
40+
// {loader: 'css-loader', options: {importLoaders: 1}},
41+
// 'postcss-loader',
42+
// 'sass-loader',
43+
// ],
44+
// },
45+
{
46+
rules: [{
47+
test: /\.less$/,
48+
use: [{
49+
loader: "style-loader" // creates style nodes from JS strings
50+
}, {
51+
loader: "css-loader" // translates CSS into CommonJS
52+
}, {
53+
loader: "less-loader" // compiles Less to CSS
54+
}]
55+
}]
56+
},
57+
{
58+
test: /\.(jpe?g|png|gif|svg)$/i,
59+
loaders: [
60+
'file-loader?hash=sha512&digest=hex&name=img/[name].[hash].[ext]',
61+
'image-webpack-loader?bypassOnDebug&optipng.optimizationLevel=7&gifsicle.interlaced=false',
62+
],
63+
},
64+
{
65+
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
66+
loader: "file-loader",
67+
options: {
68+
name: 'fonts/[name].[ext]'
69+
}
70+
},
71+
{
72+
test: /\.(woff|woff2)$/,
73+
loader: "file-loader?name=fonts/[name].[ext]"
74+
},
75+
{
76+
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
77+
loader: "url-loader?mimetype=application/octet-stream"
78+
},
79+
// {
80+
// test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
81+
// loader: "url-loader?mimetype=image/svg+xml"
82+
// },
83+
// {
84+
// test: /\.svg$/,
85+
// exclude: '/node_modules/',
86+
// loader: 'babel-loader!svg-react-loader'
87+
// }
88+
],
89+
},
90+
plugins: [
91+
// new CopyWebpackPlugin([{
92+
// from: './assets/img',
93+
// to: __dirname + '/dist/assets/img'
94+
// }]),
95+
new HtmlWebpackPlugin({
96+
template: 'index.html.ejs',
97+
}),
98+
new webpack.ProvidePlugin({
99+
"React": "react",
100+
'ReactDOM': 'react-dom',
101+
}),
102+
],
103+
externals: {
104+
'React': 'react',
105+
'ReactDOM': 'react-dom',
106+
},
107+
performance: {
108+
hints: false,
109+
},
110+
};

0 commit comments

Comments
 (0)