Skip to content

Commit

Permalink
Merge pull request #90 from martis-git/dev
Browse files Browse the repository at this point in the history
Release v.0.0.X
  • Loading branch information
azinit authored Nov 18, 2020
2 parents 740d236 + a733666 commit cc1a61f
Show file tree
Hide file tree
Showing 105 changed files with 15,035 additions and 10,806 deletions.
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 120
tab_width = 4

[*.scss]
indent_style = space

[{*.ats,*.ts,*.tsx}]
indent_style = space
tab_width = 2
ij_typescript_use_double_quotes = true

[{*.cjs,*.js,*.jsx}]
indent_style = space
tab_width = 2
ij_javascript_use_double_quotes = true

[{*.graphql,*.graphqls,*.gql}]
indent_style = space

[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
indent_style = space
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ SKIP_PREFLIGHT_CHECK=true
API_GENCOMMENT=/** @generated THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */

REACT_APP_API_URL=https://api.github.com/graphql
# TODO: Убрать позднее (пока что нужен для кодогенерации)
REACT_APP_ACCESS_TOKEN=d70d97689ae25f0eb61a1f49ee49fa4b9fc3c370
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/**
dist/**
build/**
*.gen.ts
.github
22 changes: 20 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
browser: true,
es6: true,
},
plugins: ["react", "@typescript-eslint"],
plugins: ["react", "@typescript-eslint", "@graphql-eslint"],
extends: [
"react-app",
"eslint:recommended",
Expand All @@ -30,7 +30,14 @@ module.exports = {
"import/order": [
2,
{
pathGroups: ["shared/**", "pages", "features"].map((pattern) => ({
pathGroups: [
"shared",
"shared/**",
"pages",
"features",
"features/**",
"models",
].map((pattern) => ({
pattern,
group: "internal",
position: "after",
Expand All @@ -40,5 +47,16 @@ module.exports = {
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
},
],
"@graphql-eslint/no-anonymous-operations": 2,
},
overrides: [
{
files: ["*.gql"],
parser: "@graphql-eslint/eslint-plugin",
plugins: ["@graphql-eslint"],
rules: {
"prettier/prettier": 0,
},
},
],
};
14 changes: 13 additions & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"projects": {
"default": "github-client-47c49"
},
"targets": {
"github-client-47c49": {
"hosting": {
"dev": [
"dev-github-client"
],
"prod": [
"github-client-47c49"
]
}
}
}
}
}
45 changes: 45 additions & 0 deletions .github/workflows/dev-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- dev
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install

- name: Run Tests
run: npm run test
env:
CI: true

- name: Build
run: npm run build

- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:dev
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/dev-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
jobs:
build_and_preview:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install

- name: Run Tests
run: npm run test
env:
CI: true

- name: Build
run: npm run build

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GITHUB_CLIENT_47C49 }}'
projectId: github-client-47c49
expires: 20d
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
52 changes: 0 additions & 52 deletions .github/workflows/dev.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ jobs:
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
args: deploy --only hosting:prod
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
printWidth: 120,
printWidth: 100,
tabWidth: 4,
singleQuote: false,
semi: true,
Expand Down
11 changes: 11 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-recommended",
"stylelint-config-recess-order"
],
"rules": {
"indentation": 4,
"color-hex-length": "long"
}
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
"tailwindCSS.includeLanguages": {
"plaintext": "javascript"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"graphql"
],
}
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# github-client
Github клиент в рамках курса *React Akvelon 2020*.

<div style="display:flex">
<div style="display: flex;">
<img title="github" alt="github" width="64" src="https://image.flaticon.com/icons/png/512/25/25231.png"/>
<img title="react" alt="react" width="64" src="https://cdn.auth0.com/blog/react-js/react.png"/>
<img title="antdesign" alt="antdesign" width="64" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"/>
Expand All @@ -21,37 +21,37 @@ Github клиент в рамках курса *React Akvelon 2020*.
- **Fetching**: `graphql`, `apollo-client (3+)`
- **API Codegen**: `graphql-codegen`
- **Routing**: `react-router`
- **Tests**: `eslint + prettier`, `testing-library + jest`
- **Tests**: `eslint`, `prettier`, `graphql-eslint`, `stylelint`

## Использование

### Запуск локального dev-стенда
```bash
npm i (установка зависимостей)
npm run start (запуск стенда)
```sh
$ npm i # установка зависимостей
$ npm run start # запуск стенда
```

### Запуск тестов
```bash
npm run test (запуск всех тестов)
```sh
$ npm run test # запуск всех тестов
```

```bash
npm run react:test (unit тесты)
npm run lint:test (тесты линтера)
npm run lint:fix (тесты линтера с исправлением)
```sh
$ npm run react:test # unit тесты
$ npm run lint:test # тесты линтеров
$ npm run lint:fix # тесты линтеров с исправлением
```

### Работа с зависимостями
```bash
npm run deps:clean (удаление лишних созданных файлов, node_modules)
npm run deps:reinstall (переустановка зависимостей)
```sh
$ npm run deps:clean # удаление лишних созданных файлов, node_modules
$ npm run deps:reinstall # переустановка зависимостей
```

### Кодогенерация API
```bash
npm run api:gen (сгенерировать типы и хуки для работы с API - одноразово)
npm run api:gen--watch (сгенерировать типы и хуки для работы с API - watch-mode)
```sh
$ npm run api:gen # сгенерировать типы и хуки для работы с API - одноразово
$ npm run api:gen--watch # сгенерировать типы и хуки для работы с API - watch-mode
```

## VSCode
Expand All @@ -61,4 +61,4 @@ npm run api:gen--watch (сгенерировать типы и хуки для
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) - Автокомплит Tailwind классов в компонентах
- [Apollo GraphQL](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) - IntelliSense с автокомплитом (но возможны подтормаживания)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Форматирование по сохранению, pre-commit-hook, тестирование от линта
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint) - Форматирование по сохранению, тестирование от линта
14 changes: 14 additions & 0 deletions RECOMMENDATIONS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Recommendations

## Commits
- Use [semantic commits](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
> commits:
> - `feature(scope): details`
> - `fix(scope): details`
> - `refactor(scope): details`
> - and etc..
- Use [gitflow](https://datasift.github.io/gitflow/IntroducingGitFlow.html)
> branches:
> - `feature/{name}` => `dev`
> - `bugfix/{name}` => `dev`
> - and etc..
## Code
- Don't be blinded by `DRY` principle
> TODO: add comments
Expand Down
Loading

0 comments on commit cc1a61f

Please sign in to comment.