Skip to content

Commit f17275a

Browse files
committed
Improve contributing experience
1 parent d929d3f commit f17275a

File tree

11 files changed

+723
-670
lines changed

11 files changed

+723
-670
lines changed

.github/workflows/linters.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,8 @@ jobs:
3535
- name: Install modules
3636
run: yarn install --immutable
3737

38-
- name: Run Type check
39-
run: yarn type-check
40-
41-
- name: Run ESLint
42-
run: yarn lint
43-
44-
- name: Run Prettier
45-
run: yarn prettier --check
38+
- name: Run checks
39+
run: yarn check
4640

4741
- name: Build project
4842
run: yarn build

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npx lint-staged
2+
npm run type-check

.prettierignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ yarn.lock
44
*.html
55
!public/upload*.html
66
build
7-
*.d.ts
8-
*.json

CONTRIBUTING.md

Lines changed: 87 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,102 @@
1-
# SyncMaster UI
1+
# Contributing Guide
22

3-
## Getting started
3+
Welcome! There are many ways to contribute, including submitting bug
4+
reports, improving documentation, submitting feature requests, reviewing
5+
new submissions, or contributing code that can be incorporated into the
6+
project.
47

5-
### Development
8+
## Review process
69

7-
First, install the dependencies of the project:
10+
For any **significant** changes please create a new GitHub issue and
11+
enhancements that you wish to make. Describe the feature you would like
12+
to see, why you need it, and how it will work. Discuss your ideas
13+
transparently and get community feedback before proceeding.
14+
15+
Small changes can directly be crafted and submitted to the GitHub
16+
Repository as a Pull Request. This requires creating a **repo fork** using
17+
[instruction](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
18+
19+
## Initial setup for local development
20+
21+
### Install Git
22+
23+
Please follow
24+
[instruction](https://docs.github.com/en/get-started/quickstart/set-up-git).
25+
26+
### Clone the repo
27+
28+
Open terminal and run these commands:
29+
30+
```bash
31+
git clone [email protected]:myuser/syncmaster-ui.git
32+
33+
cd syncmaster-ui
34+
```
35+
36+
### Setup environment
37+
38+
To install all necessary dependencies, run these commands:
39+
40+
```bash
41+
yarn install --immutable
42+
yarn run pre-commit-install
43+
```
44+
45+
# How to
46+
47+
## Run development server
848

949
```bash
10-
yarn
50+
yarn run dev
1151
```
1252

13-
Run the application in development mode:
53+
### Create pull request
54+
55+
Commit your changes:
56+
1457
```bash
15-
yarn start
58+
git commit -m "Commit message"
59+
git push
1660
```
17-
Open [https://localhost:3000](https://localhost:3000) with your browser to see the result.
1861

19-
### Linters
62+
Then open Github interface and [create pull request](https://docs.github.com/en/get-started/quickstart/contributing-to-projects#making-a-pull-request).
63+
Please follow guide from PR body template.
64+
65+
After pull request is created, it get a corresponding number, e.g. 123
66+
(`pr_number`).
67+
68+
## Release Process
69+
70+
Note: this is only for repo maintainers
71+
72+
0. Checkout to ``develop`` branch and update it to the actual state
73+
74+
```bash
75+
git checkout develop
76+
git pull -p
77+
```
78+
79+
1. Merge ``develop`` branch to ``master``, **WITHOUT** squashing
80+
81+
```bash
82+
git checkout master
83+
git pull
84+
git merge develop
85+
git push
86+
```
87+
88+
2. Add git tag to the latest commit in ``master`` branch
89+
90+
```bash
91+
git tag "$VERSION"
92+
git push origin "$VERSION"
93+
```
2094

21-
When you commit your changes, the pre-commit operation will be launched using husky and lint-staged packages. This setting is installed automatically along with the installation of dependencies.
95+
VERSION should be the same as for backend.
2296

23-
### Build
97+
3. Update version in ``develop`` branch **after release**:
2498

25-
If you want to build the project, use next command:
2699
```bash
27-
yarn build
100+
sed -i "s#\"version\": \"[[:digit:]]\.[[:digit:]]\.[[:digit:]]\"#\"version\": \"$VERSION\"#" package.json package-lock.json
101+
npm i
28102
```
29-
Then use `yarn start:prod` for running the project in production mode.

package.json

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
"license": "Apache-2.0",
77
"packageManager": "[email protected]",
88
"scripts": {
9-
"start": "cross-env NODE_ENV=development webpack serve",
10-
"start:prod": "cross-env NODE_ENV=production webpack serve",
9+
"dev": "cross-env NODE_ENV=development webpack serve",
10+
"prod": "cross-env NODE_ENV=production webpack serve",
1111
"build": "rimraf ./dist && cross-env NODE_OPTIONS=--max_old_space_size=8192 && cross-env NODE_ENV=production webpack",
12-
"lint": "eslint .",
12+
"lint": "eslint --fix src/**/*.tsx src/**/*.ts",
13+
"lint-check": "eslint src/**/*.tsx src/**/*.ts",
1314
"type-check": "tsc --noEmit",
15+
"prettier": "prettier 'src/**/*.{ts,tsx,js,json}' --write --list-different",
16+
"prettier-check": "prettier 'src/**/*.{ts,tsx,js,json}' --check --list-different",
17+
"bundle-analyze": "cross-env BUNDLE_ANALYZER=true cross-env NODE_ENV=production webpack --progress",
1418
"check": "yarn lint && yarn type-check",
15-
"prettier:check": "prettier --check \"**/*.{ts,tsx}\"",
16-
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
17-
"bundle:analyze": "cross-env BUNDLE_ANALYZER=true cross-env NODE_ENV=production webpack --progress",
18-
"prepare": "husky"
19+
"pre-commit-install": "husky"
1920
},
2021
"dependencies": {
2122
"@ant-design/icons": "5.6.1",
@@ -79,15 +80,7 @@
7980
"npm": ">10"
8081
},
8182
"lint-staged": {
82-
"*.(ts|tsx|js|jsx)": [
83-
"node tsc-check.js",
84-
"eslint --fix",
85-
"prettier --write"
86-
]
87-
},
88-
"husky": {
89-
"hooks": {
90-
"pre-commit": "yarn lint-staged"
91-
}
83+
"src/**/*": "prettier --write --list-different",
84+
"src/**/*.{ts,tsx}": "eslint --fix"
9285
}
9386
}

src/shared/config/i18n/i18n.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import "i18next";
2-
import en from "./translations/en.json"
1+
import 'i18next';
2+
import en from './translations/en.json';
33

4-
declare module "i18next" {
4+
declare module 'i18next' {
55
interface CustomTypeOptions {
6-
resources: typeof en,
7-
defaultNS: 'shared'
6+
resources: typeof en;
7+
defaultNS: 'shared';
88
}
9-
}
9+
}

0 commit comments

Comments
 (0)