Skip to content

Commit 813e548

Browse files
rootsherKonrad Kowalski
authored and
Konrad Kowalski
committed
Initial commit.
0 parents  commit 813e548

19 files changed

+10616
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
dist/
3+
.git/
4+
.idea/
5+
*~
6+
*.log
7+
*.tmp
8+
*.swp

.prettierignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules/
2+
dist/
3+
.git/
4+
.idea/
5+
*~
6+
*.log
7+
*.tmp
8+
*.swp
9+
yarn.lock
10+
.gitignore
11+
.prettierignore

README.md

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# react-webpack-starter
2+
3+
## 1. Requirements
4+
5+
* node (v8.9.4)
6+
* yarn (v1.3.2)
7+
8+
## 2. Installation
9+
10+
```sh
11+
yarn # [enter] or yarn install
12+
```
13+
14+
## 3. Scripts
15+
16+
### \* webpack-dev-server (watch mode)
17+
18+
```sh
19+
$ yarn start
20+
```
21+
22+
```sh
23+
$ yarn start -- --host=0.0.0.0 # default: localhost
24+
```
25+
26+
```sh
27+
$ yarn start -- --port=8081 # default: 8080
28+
```
29+
30+
### \* production build (output in `./dist`)
31+
32+
```sh
33+
$ yarn build
34+
```
35+
36+
## 4. Features
37+
38+
* ES5, ES6 (ES2015), ES2016, ESNext
39+
* webpack
40+
* webpack-dev-server + HMR
41+
* HMR
42+
* dynamic imports
43+
* typescript
44+
* babel + polyfills
45+
* jsx + react + react-router v4
46+
* material design (material-ui)
47+
* css + scss + postcss (CSS modules + cssnext)
48+
* prettier + linters
49+
50+
## 5. Capabilities
51+
52+
### _ importing image files i.e. `_.jpg`,`_.png`,`_.gif`,`\*.svg`
53+
54+
before:
55+
56+
```jsx
57+
import image from "./example/path/image.png";
58+
59+
<img src={image} />;
60+
```
61+
62+
after:
63+
64+
```jsx
65+
<img src="./assets/image/23tr82r3278r28332.png" />
66+
```
67+
68+
### _ using fonts (without import) in `_.scss` file
69+
70+
before:
71+
72+
```css
73+
@font-face {
74+
font-family: Font;
75+
src: url("./fonts/font.woff") format("woff");
76+
}
77+
```
78+
79+
after:
80+
81+
```css
82+
@font-face {
83+
font-family: Font;
84+
src: url("./assets/fonts/1387r122f3273.woff") format("woff");
85+
}
86+
```
87+
88+
### _ importing `_.json` files
89+
90+
```jsx
91+
import file from "./path/image.json"; // { key: 'value' }
92+
```
93+
94+
### \* using CSS modules - :local (default) and :global scope
95+
96+
before:
97+
98+
```scss
99+
.myBox {
100+
color: red;
101+
}
102+
:global {
103+
.globalBox {
104+
color: blue;
105+
}
106+
}
107+
```
108+
109+
after:
110+
111+
```scss
112+
._37f65 {
113+
color: red;
114+
}
115+
.globalBox {
116+
color: blue;
117+
}
118+
```
119+
120+
...and in JS:
121+
122+
```jsx
123+
import { myBox, globalBox } from "./box-styles.scss"; // myBox -> "_37f65", globalBox -> "globalBox"
124+
125+
<div className={myBox}>
126+
<div className={globalBox} />
127+
</div>;
128+
```

package.json

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "react-webpack-starter",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "webpack-dev-server --config webpack.dev.js --history-api-fallback",
8+
"build": "webpack --config webpack.prod.js",
9+
"test": "lint-staged",
10+
"prettier": "prettier -l --write src/**/*.*",
11+
"precommit": "lint-staged"
12+
},
13+
"author": "Konrad Kowalski <[email protected]>",
14+
"license": "ISC",
15+
"lint-staged": {
16+
"src/*.*": ["yarn prettier", "git add"]
17+
},
18+
"devDependencies": {
19+
"@babel/core": "^7.0.0-beta.47",
20+
"@babel/preset-env": "^7.0.0-beta.47",
21+
"awesome-typescript-loader": "^5.0.0",
22+
"babel-eslint": "^8.2.1",
23+
"babel-loader": "8.0.0-beta.0",
24+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
25+
"clean-webpack-plugin": "^0.1.18",
26+
"css-loader": "^0.28.9",
27+
"cssnano": "^3.10.0",
28+
"eslint": "^4.17.0",
29+
"eslint-config-prettier": "^2.9.0",
30+
"eslint-loader": "^1.9.0",
31+
"eslint-plugin-prettier": "^2.6.0",
32+
"file-loader": "^1.1.6",
33+
"html-webpack-plugin": "^3.2.0",
34+
"html-webpack-root-plugin": "^0.10.0",
35+
"husky": "^0.14.3",
36+
"lint-staged": "^7.1.0",
37+
"node-sass": "^4.7.2",
38+
"postcss-cssnext": "^3.1.0",
39+
"postcss-flexbugs-fixes": "^3.3.0",
40+
"postcss-import": "^11.0.0",
41+
"postcss-loader": "^2.1.0",
42+
"postcss-scss": "^1.0.3",
43+
"prettier": "^1.12.1",
44+
"prettier-webpack-plugin": "^1.0.0",
45+
"sass-loader": "^6.0.6",
46+
"style-loader": "^0.20.1",
47+
"stylelint": "^9.2.0",
48+
"sugarss": "^1.0.1",
49+
"ts-loader": "^3.4.0",
50+
"tslint": "^5.10.0",
51+
"tslint-config-prettier": "^1.12.0",
52+
"tslint-eslint-rules": "^5.3.1",
53+
"typescript": "^2.8.3",
54+
"uglifyjs-webpack-plugin": "^1.1.8",
55+
"webpack": "^4.8.3",
56+
"webpack-cli": "^2.1.3",
57+
"webpack-dev-server": "^3.1.4",
58+
"webpack-merge": "^4.1.1"
59+
},
60+
"dependencies": {
61+
"@types/react": "^16.0.36",
62+
"@types/react-dom": "^16.0.3",
63+
"@types/react-router-dom": "^4.2.3",
64+
"classnames": "^2.2.5",
65+
"lodash": "^4.17.5",
66+
"@material-ui/core": "^1.0.0-rc.1",
67+
"@material-ui/icons": "^1.0.0-rc.0",
68+
"prop-types": "^15.6.0",
69+
"react": "^16.3.2",
70+
"react-dom": "^16.3.2",
71+
"react-hot-loader": "^3.1.3",
72+
"react-router": "^4.3.0-rc.3",
73+
"react-router-dom": "^4.2.2",
74+
"rxjs": "^5.5.6"
75+
}
76+
}

prettier.config.js

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
module.exports = {
2+
filepath: 'src',
3+
tabWidth: 4,
4+
useTabs: false,
5+
printWidth: 100,
6+
overrides: [
7+
{
8+
files: '*.{ts,tsx,scss}',
9+
options: {
10+
parser: 'typescript',
11+
useTabs: true,
12+
},
13+
},
14+
{
15+
files: '*.{ts,tsx}',
16+
options: {
17+
parser: 'typescript',
18+
singleQuote: true,
19+
trailingComma: 'all',
20+
semi: true,
21+
bracketSpacing: true,
22+
jsxBracketSameLine: false,
23+
arrowParens: 'avoid',
24+
},
25+
},
26+
{
27+
files: '*.js',
28+
options: {
29+
parser: 'babylon',
30+
singleQuote: true,
31+
trailingComma: 'all',
32+
},
33+
},
34+
{
35+
files: '*.scss',
36+
options: {
37+
parser: 'css',
38+
},
39+
},
40+
{
41+
files: '*.md',
42+
options: {
43+
parser: 'markdown',
44+
},
45+
},
46+
{
47+
files: '*.json',
48+
options: {
49+
parser: 'json',
50+
tabWidth: 2,
51+
},
52+
},
53+
],
54+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import React from 'react';
2+
3+
import Button from '@material-ui/core/Button';
4+
5+
import Dialog from '@material-ui/core/Dialog';
6+
import DialogActions from '@material-ui/core/DialogActions';
7+
import DialogContent from '@material-ui/core/DialogContent';
8+
import DialogContentText from '@material-ui/core/DialogContentText';
9+
import DialogTitle from '@material-ui/core/DialogTitle';
10+
11+
class AlertDialog extends React.Component {
12+
state = {
13+
open: false,
14+
};
15+
16+
handleClickOpen = () => {
17+
this.setState({ open: true });
18+
};
19+
20+
handleClose = () => {
21+
this.setState({ open: false });
22+
};
23+
24+
render() {
25+
return (
26+
<div>
27+
<Button onClick={this.handleClickOpen}>Open alert dialog</Button>
28+
<Dialog
29+
open={this.state.open}
30+
onClose={this.handleClose}
31+
aria-labelledby="alert-dialog-title"
32+
aria-describedby="alert-dialog-description"
33+
>
34+
<DialogTitle id="alert-dialog-title">
35+
{"Use Google's location service?"}
36+
</DialogTitle>
37+
<DialogContent>
38+
<DialogContentText id="alert-dialog-description">
39+
Let Google help apps determine location. This means sending anonymous
40+
location data to Google, even when no apps are running.
41+
</DialogContentText>
42+
</DialogContent>
43+
<DialogActions>
44+
<Button onClick={this.handleClose} color="primary">
45+
Disagree
46+
</Button>
47+
<Button onClick={this.handleClose} color="primary" autoFocus>
48+
Agree
49+
</Button>
50+
</DialogActions>
51+
</Dialog>
52+
</div>
53+
);
54+
}
55+
}
56+
57+
export default AlertDialog;

src/app/core/models/.gitkeep

Whitespace-only changes.

src/app/core/scss/style.scss

Whitespace-only changes.

src/app/core/services/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React, { Component } from 'react';
2+
3+
import './index.component.scss';
4+
5+
import AlertDialog from '../../../core/components/examples/dialogs/alert-dialog/alert-dialog.component';
6+
7+
class IndexComponent extends Component<any, any> {
8+
render() {
9+
return <AlertDialog />;
10+
}
11+
}
12+
13+
export const Index = IndexComponent;

src/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import { Routing } from './routing.component';
4+
import './app/core/scss/style.scss';
5+
6+
ReactDOM.render(<Routing />, document.getElementById('app'));

src/main.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.json';
2+
declare module '*.png';
3+
declare module '*.jpg';
4+
declare module '*.scss';

src/routing.component.tsx

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React, { Component } from 'react';
2+
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
3+
4+
import { Index } from './app/main/content/index/index.component';
5+
6+
const About = () => (
7+
<div>
8+
<h2>About</h2>
9+
</div>
10+
);
11+
12+
export class Routing extends Component {
13+
render() {
14+
return (
15+
<Router>
16+
<Switch>
17+
<Route exact path="/" component={Index} />
18+
<Route path="/about" component={About} />
19+
</Switch>
20+
</Router>
21+
);
22+
}
23+
}

0 commit comments

Comments
 (0)