Skip to content

Commit dbc0517

Browse files
committed
[*] Format files
1 parent 870b519 commit dbc0517

Some content is hidden

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

62 files changed

+1818
-1806
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules
1+
node_modules

.drone.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
pipeline:
2-
run-koa-react-starter-tests:
3-
image: node:8.9
4-
commands:
5-
- ./bin/run.sh
6-
when:
7-
status: [ failure, success ]
8-
event: [ pull_request ]
9-
10-
services:
11-
mongo:
12-
image: mongo:3.4
13-
branches: [ master, "*:master" ]
1+
pipeline:
2+
run-koa-react-starter-tests:
3+
image: node:8.9
4+
commands:
5+
- ./bin/run.sh
6+
when:
7+
status: [ failure, success ]
8+
event: [ pull_request ]
9+
10+
services:
11+
mongo:
12+
image: mongo:3.4
13+
branches: [ master, "*:master" ]

.eslintrc.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
module.exports = {
2-
"extends": "@paralect/eslint-config",
3-
"rules": {
4-
"import/no-extraneous-dependencies": ["error", {
5-
"devDependencies": [
6-
"**/webpack.config.js",
7-
"**/webpack.config.*.js",
8-
],
9-
}],
10-
"jsx-a11y/anchor-is-valid": [ "error", {
11-
"components": [ "Link" ],
12-
"specialLink": [ "to" ],
13-
}]
14-
},
15-
"settings": {
16-
"import/resolver": {
17-
"node": {
18-
"moduleDirectory": [
19-
"src",
20-
"node_modules",
21-
"server"
22-
],
23-
"paths": ["src/client"]
24-
},
25-
}
26-
}
27-
};
1+
module.exports = {
2+
"extends": "@paralect/eslint-config",
3+
"rules": {
4+
"import/no-extraneous-dependencies": ["error", {
5+
"devDependencies": [
6+
"**/webpack.config.js",
7+
"**/webpack.config.*.js",
8+
],
9+
}],
10+
"jsx-a11y/anchor-is-valid": [ "error", {
11+
"components": [ "Link" ],
12+
"specialLink": [ "to" ],
13+
}]
14+
},
15+
"settings": {
16+
"import/resolver": {
17+
"node": {
18+
"moduleDirectory": [
19+
"src",
20+
"node_modules",
21+
"server"
22+
],
23+
"paths": ["src/client"]
24+
},
25+
}
26+
}
27+
};

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
node_modules
2-
src/client/static/main.*
1+
node_modules
2+
src/client/static/main.*

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
save-exact=true
1+
save-exact=true

.stylelintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{
2-
"extends": "stylelint-config-standard"
1+
{
2+
"extends": "stylelint-config-standard"
33
}

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2017-present, Paralect LLC
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.
1+
MIT License
2+
3+
Copyright (c) 2017-present, Paralect LLC
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

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
## Koa React starter
2-
3-
Koa React starter is what we think an ideal starting point for the most React.JS frontend applications. It is based on the following primary technologies:
4-
5-
- react
6-
- react-router
7-
- webpack
8-
- postcss
9-
- eslint
10-
- koa
11-
12-
Application structured in a way, which we find most efficient in both short and long term projects. The main intention of the current structure is to keep logical components close to each other and define clear structure for the common things, such as routers, store, api wrappers, reducers, action creators, store selectors.
13-
14-
### Explanations of the files structure.
15-
16-
1. **[src/client/components](./src/client/components)** - this folder consist all UI components. Root level folders (such as [profile](./src/components/profile), [index](./src/client/components/index)) are typically pages of your application. Every such component should have all files related to the page: images, style files, jsx files, sub components. This folder also consist two none page components: [common](./src/client/components/common) and [layout](./src/client/components/common). *Common* folder should have all common components which are reused in **at least two** root level components. Layout - represent a layout of your application and should consist all layout related logic and other components, such as headers, footers, sidebars.
17-
2. **[src/client/components/routes.jsx](./src/client/components/routes.jsx)** - this file should consist all routes for your client side application.
18-
3. **[src/client/helpers](./src/client/helpers)** - this folder should consist off common helpers used in other components, such as date formatters, api wrappers, common functions and all other files that does not fit current structure. If you don't know where to put certain file - put it into this folder and we will eventually figure out the right place for it.
19-
4. **[src/client/resources](./src/client/resources/user)** - a folder consist of all redux/api related things. Typically resource maps 1 to 1 to the api endpoint, but not limited to only api endpoints. Every resource is responsible for management certain part of the redux store. If you need keep something client specific in the redux store, you can create separate resource for it. For example: navigation resource may contain something history of the all opened pages to without 1 to 1 connection to the rest api. Main moving parts of resource:
20-
- **[src/client/resources/store.js](./src/client/resources/store.js)** - initialization logic for the redux store. Combines all reducers, adds redux middlewares.
21-
- **[src/client/resources/*/*.actions.js](./src/client/resources/user/user.actions.js)** - consist redux action creators for the given resource.
22-
- **[src/client/resources/*/*.api.js](./src/client/resources/user/user.api.js)** - consist all api methods of the given resource. Optional.
23-
- **[src/client/resources/*/*.reducer.js](./src/client/resources/user/user.reducer.js)** - consist reducer for the give resource. All reducers combined together in the `[store.js](./src/client/resources/store.js)`.
24-
- **[src/client/resource/*/*.selectors.js](./src/client/resources/user/user.selectors.js)** - consist selectors for the given resource. You should never access store directly, but always use selectors instead. That would simplify things when structure of the store data changes.
25-
5. **[src/client/services](./src/client/services)** - folder should consist the logic for the the third party service integrations (such as Intercom, Segment, etc). Not limited only to the third party services, but could consist some standalone application related services.
26-
27-
### Important things to keep in mind
28-
29-
1. Logical components should be tightly coupled. Keep all component related files, such as images, styles, sub components as close as possible to the component. Do not put component into the `common` folder for the *future use*.
30-
2. Two separate page components should be loosely coupled. If there is two page components which use same image - keep two copies of every image within every page. Do not create generic images folder, as all images belong to some ui components.
31-
32-
### Conventions
33-
34-
1. Name of all files for components should start from lowercased letter.
35-
2. Code style. (TODO: add link to the common eslint configuration for the javascript)
36-
37-
### List of planned improvements
38-
39-
1. Add api wrapper which can be reused in `*.api.js` files
40-
2. Make two current pages stylish.
41-
3. Add stylish loading screen, while app loading (fake 3 seconds profile loading).
1+
## Koa React starter
2+
3+
Koa React starter is what we think an ideal starting point for the most React.JS frontend applications. It is based on the following primary technologies:
4+
5+
- react
6+
- react-router
7+
- webpack
8+
- postcss
9+
- eslint
10+
- koa
11+
12+
Application structured in a way, which we find most efficient in both short and long term projects. The main intention of the current structure is to keep logical components close to each other and define clear structure for the common things, such as routers, store, api wrappers, reducers, action creators, store selectors.
13+
14+
### Explanations of the files structure.
15+
16+
1. **[src/client/components](./src/client/components)** - this folder consist all UI components. Root level folders (such as [profile](./src/components/profile), [index](./src/client/components/index)) are typically pages of your application. Every such component should have all files related to the page: images, style files, jsx files, sub components. This folder also consist two none page components: [common](./src/client/components/common) and [layout](./src/client/components/common). *Common* folder should have all common components which are reused in **at least two** root level components. Layout - represent a layout of your application and should consist all layout related logic and other components, such as headers, footers, sidebars.
17+
2. **[src/client/components/routes.jsx](./src/client/components/routes.jsx)** - this file should consist all routes for your client side application.
18+
3. **[src/client/helpers](./src/client/helpers)** - this folder should consist off common helpers used in other components, such as date formatters, api wrappers, common functions and all other files that does not fit current structure. If you don't know where to put certain file - put it into this folder and we will eventually figure out the right place for it.
19+
4. **[src/client/resources](./src/client/resources/user)** - a folder consist of all redux/api related things. Typically resource maps 1 to 1 to the api endpoint, but not limited to only api endpoints. Every resource is responsible for management certain part of the redux store. If you need keep something client specific in the redux store, you can create separate resource for it. For example: navigation resource may contain something history of the all opened pages to without 1 to 1 connection to the rest api. Main moving parts of resource:
20+
- **[src/client/resources/store.js](./src/client/resources/store.js)** - initialization logic for the redux store. Combines all reducers, adds redux middlewares.
21+
- **[src/client/resources/*/*.actions.js](./src/client/resources/user/user.actions.js)** - consist redux action creators for the given resource.
22+
- **[src/client/resources/*/*.api.js](./src/client/resources/user/user.api.js)** - consist all api methods of the given resource. Optional.
23+
- **[src/client/resources/*/*.reducer.js](./src/client/resources/user/user.reducer.js)** - consist reducer for the give resource. All reducers combined together in the `[store.js](./src/client/resources/store.js)`.
24+
- **[src/client/resource/*/*.selectors.js](./src/client/resources/user/user.selectors.js)** - consist selectors for the given resource. You should never access store directly, but always use selectors instead. That would simplify things when structure of the store data changes.
25+
5. **[src/client/services](./src/client/services)** - folder should consist the logic for the the third party service integrations (such as Intercom, Segment, etc). Not limited only to the third party services, but could consist some standalone application related services.
26+
27+
### Important things to keep in mind
28+
29+
1. Logical components should be tightly coupled. Keep all component related files, such as images, styles, sub components as close as possible to the component. Do not put component into the `common` folder for the *future use*.
30+
2. Two separate page components should be loosely coupled. If there is two page components which use same image - keep two copies of every image within every page. Do not create generic images folder, as all images belong to some ui components.
31+
32+
### Conventions
33+
34+
1. Name of all files for components should start from lowercased letter.
35+
2. Code style. (TODO: add link to the common eslint configuration for the javascript)
36+
37+
### List of planned improvements
38+
39+
1. Add api wrapper which can be reused in `*.api.js` files
40+
2. Make two current pages stylish.
41+
3. Add stylish loading screen, while app loading (fake 3 seconds profile loading).

bin/run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/bin/sh
2-
npm install --quiet
3-
NODE_ENV=test npm test
1+
#!/bin/sh
2+
npm install --quiet
3+
NODE_ENV=test npm test

browserslist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
> 1%
2-
Last 2 versions
1+
> 1%
2+
Last 2 versions

git.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
tags=($(git tag))
4+
echo "${#tags[@]}"
5+
echo $tags
6+
7+
if [$tags -eq ''];
8+
then
9+
echo empty
10+
else
11+
echo not Empty
12+
fi
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
import React, { Component } from 'react';
2-
import PropTypes from 'prop-types';
3-
import classnames from 'classnames';
4-
5-
import styles from './button.styles.pcss';
6-
7-
const colors = {
8-
green: 'green',
9-
blue: 'blue',
10-
red: 'red',
11-
};
12-
13-
class Button extends Component {
14-
static propTypes = {
15-
children: PropTypes.node.isRequired,
16-
onClick: PropTypes.func,
17-
onKeyDown: PropTypes.func,
18-
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
19-
color: PropTypes.oneOf([colors.green, colors.blue, colors.red]),
20-
className: PropTypes.string,
21-
};
22-
23-
static defaultProps = {
24-
onClick: null,
25-
onKeyDown: null,
26-
tabIndex: 0,
27-
color: colors.blue,
28-
className: null,
29-
};
30-
31-
onEnterDown = (e) => {
32-
if (e.keyCode === 13 && this.props.onClick) {
33-
this.props.onClick(e);
34-
}
35-
};
36-
37-
render() {
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import classnames from 'classnames';
4+
5+
import styles from './button.styles.pcss';
6+
7+
const colors = {
8+
green: 'green',
9+
blue: 'blue',
10+
red: 'red',
11+
};
12+
13+
class Button extends Component {
14+
static propTypes = {
15+
children: PropTypes.node.isRequired,
16+
onClick: PropTypes.func,
17+
onKeyDown: PropTypes.func,
18+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
19+
color: PropTypes.oneOf([colors.green, colors.blue, colors.red]),
20+
className: PropTypes.string,
21+
};
22+
23+
static defaultProps = {
24+
onClick: null,
25+
onKeyDown: null,
26+
tabIndex: 0,
27+
color: colors.blue,
28+
className: null,
29+
};
30+
31+
onEnterDown = (e) => {
32+
if (e.keyCode === 13 && this.props.onClick) {
33+
this.props.onClick(e);
34+
}
35+
};
36+
37+
render() {
3838
const {
3939
children, tabIndex, onClick, onKeyDown, color, className,
40-
} = this.props;
41-
42-
return (
43-
<div
44-
className={classnames(styles.button, styles[color], className)}
45-
role="button"
46-
tabIndex={tabIndex}
47-
onClick={onClick}
48-
onKeyDown={onKeyDown || this.onEnterDown}
49-
>
50-
{children}
51-
</div>
52-
);
53-
}
54-
}
55-
56-
export default Button;
57-
export { colors };
40+
} = this.props;
41+
42+
return (
43+
<div
44+
className={classnames(styles.button, styles[color], className)}
45+
role="button"
46+
tabIndex={tabIndex}
47+
onClick={onClick}
48+
onKeyDown={onKeyDown || this.onEnterDown}
49+
>
50+
{children}
51+
</div>
52+
);
53+
}
54+
}
55+
56+
export default Button;
57+
export { colors };

0 commit comments

Comments
 (0)