Skip to content

Commit 3f11f04

Browse files
author
Daniil
committed
Setup dev mode for styled-components, update docs
1 parent d84af50 commit 3f11f04

File tree

7 files changed

+142
-42
lines changed

7 files changed

+142
-42
lines changed

README.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,58 @@
1-
<h3 align="center">
2-
React Project Template
3-
</h3>
1+
<h1 align="center">
2+
<p align="center">
3+
<img src="./docs/icon.svg" width="180" height="180" alt="Layered Architecture Icon">
4+
</p>
5+
React Project Boilerplate
6+
</h1>
47

58
<p align="center">
6-
Layered Architecture for Enterprise <a href="https://facebook.github.io/react">React</a> Projects
9+
Layered Architecture for Enterprise <a href="https://reactjs.org/">React</a>/<a href="https://vuejs.org/">Vue</a> Projects
710
</p>
811

912
## Quick Overview
1013

11-
Layered Architecture for developing web/mobile/desktop applications using JavaScript. You can use React/Angular/Vue/Svelte + Typescript for developing.
14+
Layered Architecture for developing web/mobile/desktop applications using JavaScript. You can use [React](https://reactjs.org/)/[Vue](https://vuejs.org/) + Typescript for developing.
15+
16+
> Of course you can use another framework :)
17+
18+
## Getting started
19+
20+
- Clone repository
21+
- Run `yarn` to install dependencies
22+
- Run `yarn build` to build project
1223

1324
## Docs
1425

15-
- [Startup](./docs/SCRIPTS.md "Project Startup Documentation")
26+
- [Technologies Used](#technologies-used)
27+
- [Project Scripts](./docs/SCRIPTS.md "Project Scripts Documentation")
1628
- [Architecture](./docs/ARCHITECTURE.md "Project Architecture Documentation")
1729
- [Code Conventions](./docs/CODE_CONVENTIONS.md "Project Code Conventions") *In progress*
1830
- [Style Guides](./docs/CODE_CONVENTIONS.md "Project Code Conventions") *In progress*
1931

32+
## Technologies Used
33+
- Core
34+
- [TypeScript](http://www.typescriptlang.org/)
35+
- [InversifyJS](https://github.com/inversify/InversifyJS)
36+
- [MobX](https://mobx.js.org/README.html)
37+
- [Axios](https://github.com/axios/axios)
38+
- Web
39+
- [React](https://reactjs.org/)
40+
- [React Router](https://reactrouter.com/)
41+
- [React Hook Form](https://react-hook-form.com/)
42+
- [Styled Components](https://styled-components.com/)
43+
- Testing
44+
- [Jest](https://jestjs.io)
45+
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro)
46+
- Code Quality
47+
- [Prettier](https://prettier.io/)
48+
- [ESLint](https://eslint.org/)
49+
- Bundlers
50+
- [ViteJs](https://vitejs.dev/)
51+
52+
## System Requirements
53+
- [Node.js 14+](https://nodejs.org/en/download/)
54+
- [yarn](https://yarnpkg.com/en)
55+
2056
## Contributing
2157

2258
You are welcome to contribute to this project, just open a Pull Request.

configs/.babelrc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
["@babel/preset-env", { "targets": { "node": "current" } }],
44
"@babel/preset-typescript"
55
],
6-
"env": {
7-
"test": {
8-
"plugins": [
9-
["@babel/plugin-proposal-decorators", { "legacy": true }],
10-
["@babel/plugin-proposal-class-properties", { "loose": true }]
11-
]
12-
}
13-
}
6+
"plugins": [
7+
["babel-plugin-styled-components", {
8+
"minify": false,
9+
"transpileTemplateLiterals": false
10+
}],
11+
["@babel/plugin-proposal-decorators", { "legacy": true }],
12+
["@babel/plugin-proposal-class-properties", { "loose": true }]
13+
]
1414
}

configs/vite/plugins.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import reactRefresh from '@vitejs/plugin-react-refresh';
21
import importToCDN, { autoComplete } from 'vite-plugin-cdn-import';
32
import viteCompression from 'vite-plugin-compression';
43
import reactSvgPlugin from 'vite-plugin-react-svg';
54
import tsconfigPaths from 'vite-tsconfig-paths';
5+
import react from '@vitejs/plugin-react'
66

77
const BasePlugins = [
88
importToCDN({
@@ -26,7 +26,24 @@ const BasePlugins = [
2626
}),
2727
];
2828

29-
export const DevPlugins = [...BasePlugins, reactRefresh()];
29+
export const DevPlugins = [
30+
...BasePlugins,
31+
react({
32+
include: '**/*.tsx',
33+
exclude: 'node_modules/**',
34+
babel: {
35+
plugins: [
36+
['babel-plugin-styled-components', {
37+
displayName: true,
38+
fileName: false,
39+
}],
40+
],
41+
parserOpts: {
42+
plugins: ['decorators-legacy']
43+
}
44+
}
45+
}),
46+
];
3047

3148
export const BuildPlugins = [
3249
...BasePlugins,

docs/SCRIPTS.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
# Available Scripts
1+
# Project Scripts
22

3-
In the project directory, you can run:
3+
All available scripts for project.
44

5-
### `npm install` - install all dependencies;
5+
`yarn` - install dependencies;
66

7-
### `npm start` - run dev server;
7+
## Running Application
88

9-
### `npm preview` - run build preview server;
9+
`yarn start` - run dev server;
1010

11-
### `npm build` - build your application;
11+
`yarn preview` - run build preview server;
1212

13-
### `npm lint` - check project using eslint and tslint;
13+
`yarn build` - build your application.
1414

15-
### `npm eslint` - check project using eslint;
15+
## Running Linters
1616

17-
- --fix - boolean.
18-
`Default:` none.
19-
`Description:` Will fix all possible eslint issues.
17+
`yarn lint` - check project using eslint and tslint;
2018

21-
### `npm tslint` - check project using tslint;
19+
`yarn eslint` - check project using eslint;
2220

23-
### `npm test` - run all project tests;
21+
- `yarn eslint --fix` - fix all possible eslint issues;
2422

25-
- --updateSnapshot
26-
`Description:` Will update every snapshot that fails during this test run.
27-
- --watch
28-
`Description:` Track changes and rerun tests related to changed files.
29-
- --coverage
30-
`Description:` Collect code coverage.
23+
`yarn tslint` - check project using tslint.
3124

32-
### `npm test:ci` - run all project tests and collect coverage;
25+
## Running Tests
3326

34-
### `npm test:ci` - run all project tests and collect coverage;
27+
`yarn test` - run all project tests;
3528

36-
> Note: You can use `yarn` instead of `npm`
29+
- `yarn test --updateSnapshot` - update every snapshot that fails during this test run;
30+
31+
- `yarn test --watch` - watch for changes and re-run tests;
32+
33+
- `yarn test --coverage` - collect code coverage by tests;
34+
35+
`yarn test:ci` - run all project tests and collect coverage.

docs/icon.svg

Lines changed: 6 additions & 0 deletions
Loading

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build": "yarn vite build",
1515
"lint": "yarn eslint && yarn tslint",
1616
"eslint": "eslint \"./src/**/*.ts\" \"./src/**/*.tsx\" --max-warnings 0",
17+
"eslint:perf": "set TIMING=1 & yarn eslint",
1718
"tslint": "yarn tsc --pretty --noEmit",
1819
"jest": "jest --config ./configs/jest/config.ts",
1920
"test": "yarn jest --verbose --runInBand",
@@ -53,6 +54,7 @@
5354
"@types/jest": "27.0.2",
5455
"@typescript-eslint/eslint-plugin": "4.31.2",
5556
"@typescript-eslint/parser": "4.31.2",
57+
"@vitejs/plugin-react": "^1.0.1",
5658
"@vitejs/plugin-react-refresh": "1.3.6",
5759
"eslint": "7.32.0",
5860
"eslint-config-prettier": "8.3.0",
@@ -70,7 +72,6 @@
7072
"typescript": "4.4.3",
7173
"vite": "2.5.10",
7274
"vite-plugin-cdn-import": "0.3.5",
73-
"vite-plugin-compress": "2.1.0",
7475
"vite-plugin-compression": "0.3.5",
7576
"vite-plugin-react-svg": "0.2.0",
7677
"vite-tsconfig-paths": "3.3.14"
@@ -89,6 +90,8 @@
8990
"extends": "./configs/.babelrc"
9091
},
9192
"eslintConfig": {
92-
"extends": ["./configs/.eslintrc"]
93+
"extends": [
94+
"./configs/.eslintrc"
95+
]
9396
}
9497
}

yarn.lock

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
semver "^6.3.0"
4848
source-map "^0.5.0"
4949

50-
"@babel/core@^7.14.8", "@babel/core@^7.7.2":
50+
"@babel/core@^7.14.8", "@babel/core@^7.15.5", "@babel/core@^7.7.2":
5151
version "7.15.5"
5252
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.5.tgz#f8ed9ace730722544609f90c9bb49162dc3bf5b9"
5353
integrity sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==
@@ -916,13 +916,27 @@
916916
dependencies:
917917
"@babel/helper-plugin-utils" "^7.14.5"
918918

919+
"@babel/plugin-transform-react-jsx-development@^7.14.5":
920+
version "7.14.5"
921+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.14.5.tgz#1a6c73e2f7ed2c42eebc3d2ad60b0c7494fcb9af"
922+
integrity sha512-rdwG/9jC6QybWxVe2UVOa7q6cnTpw8JRRHOxntG/h6g/guAOe6AhtQHJuJh5FwmnXIT1bdm5vC2/5huV8ZOorQ==
923+
dependencies:
924+
"@babel/plugin-transform-react-jsx" "^7.14.5"
925+
919926
"@babel/plugin-transform-react-jsx-self@^7.14.5":
920927
version "7.14.5"
921928
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.14.5.tgz#703b5d1edccd342179c2a99ee8c7065c2b4403cc"
922929
integrity sha512-M/fmDX6n0cfHK/NLTcPmrfVAORKDhK8tyjDhyxlUjYyPYYO8FRWwuxBA3WBx8kWN/uBUuwGa3s/0+hQ9JIN3Tg==
923930
dependencies:
924931
"@babel/helper-plugin-utils" "^7.14.5"
925932

933+
"@babel/plugin-transform-react-jsx-self@^7.14.9":
934+
version "7.14.9"
935+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.14.9.tgz#33041e665453391eb6ee54a2ecf3ba1d46bd30f4"
936+
integrity sha512-Fqqu0f8zv9W+RyOnx29BX/RlEsBRANbOf5xs5oxb2aHP4FKbLXxIaVPUiCti56LAR1IixMH4EyaixhUsKqoBHw==
937+
dependencies:
938+
"@babel/helper-plugin-utils" "^7.14.5"
939+
926940
"@babel/plugin-transform-react-jsx-source@^7.14.5":
927941
version "7.14.5"
928942
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.14.5.tgz#79f728e60e6dbd31a2b860b0bf6c9765918acf1d"
@@ -941,6 +955,17 @@
941955
"@babel/plugin-syntax-jsx" "^7.14.5"
942956
"@babel/types" "^7.14.5"
943957

958+
"@babel/plugin-transform-react-jsx@^7.14.5", "@babel/plugin-transform-react-jsx@^7.14.9":
959+
version "7.14.9"
960+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.14.9.tgz#3314b2163033abac5200a869c4de242cd50a914c"
961+
integrity sha512-30PeETvS+AeD1f58i1OVyoDlVYQhap/K20ZrMjLmmzmC2AYR/G43D4sdJAaDAqCD3MYpSWbmrz3kES158QSLjw==
962+
dependencies:
963+
"@babel/helper-annotate-as-pure" "^7.14.5"
964+
"@babel/helper-module-imports" "^7.14.5"
965+
"@babel/helper-plugin-utils" "^7.14.5"
966+
"@babel/plugin-syntax-jsx" "^7.14.5"
967+
"@babel/types" "^7.14.9"
968+
944969
"@babel/plugin-transform-regenerator@^7.14.5":
945970
version "7.14.5"
946971
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.14.5.tgz#9676fd5707ed28f522727c5b3c0aa8544440b04f"
@@ -1203,7 +1228,7 @@
12031228
"@babel/helper-validator-identifier" "^7.14.5"
12041229
to-fast-properties "^2.0.0"
12051230

1206-
"@babel/types@^7.15.4", "@babel/types@^7.15.6":
1231+
"@babel/types@^7.14.9", "@babel/types@^7.15.4", "@babel/types@^7.15.6":
12071232
version "7.15.6"
12081233
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f"
12091234
integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==
@@ -1978,6 +2003,20 @@
19782003
"@rollup/pluginutils" "^4.1.1"
19792004
react-refresh "^0.10.0"
19802005

2006+
"@vitejs/plugin-react@^1.0.1":
2007+
version "1.0.1"
2008+
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-1.0.1.tgz#3cd13da4abcbbfa7b1b57aeaee6b34ae1bc17821"
2009+
integrity sha512-BJ4Wq31XtOup5ysVefXGbjIFIGPo47p7T8HxPyOsGFV8AlnodkwHEUaV+kQnj2WOqsupiyEgPahltC93yBf5sg==
2010+
dependencies:
2011+
"@babel/core" "^7.15.5"
2012+
"@babel/plugin-transform-react-jsx" "^7.14.9"
2013+
"@babel/plugin-transform-react-jsx-development" "^7.14.5"
2014+
"@babel/plugin-transform-react-jsx-self" "^7.14.9"
2015+
"@babel/plugin-transform-react-jsx-source" "^7.14.5"
2016+
"@rollup/pluginutils" "^4.1.1"
2017+
react-refresh "^0.10.0"
2018+
resolve "^1.20.0"
2019+
19812020
abab@^2.0.3, abab@^2.0.5:
19822021
version "2.0.5"
19832022
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"

0 commit comments

Comments
 (0)