From 8f72700983e0347e83b153183bb84b7c468b7562 Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 21:37:11 +0300 Subject: [PATCH 1/6] chore: update angular to v18.1 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index cfe4c2e..8130c85 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@angular-eslint/eslint-plugin-template": "^18.0.1", "@angular-eslint/schematics": "^18.0.1", "@angular-eslint/template-parser": "^18.0.1", - "@angular/cli": "^18.0.6", + "@angular/cli": "^18.1.4", "@angular/compiler-cli": "^18.0.0", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", @@ -72,12 +72,12 @@ "karma-jasmine-html-reporter": "~2.1.0", "lint-staged": "^15.2.7", "normalize-scss": "^8.0.0", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "stylelint": "^16.6.1", "stylelint-config-clean-order": "^6.0.0", "stylelint-config-standard": "^36.0.1", "stylelint-config-standard-scss": "^13.1.0", "stylelint-order": "^6.0.4", - "typescript": "~5.4.2" + "typescript": "^5.5.4" } } From b6751d0f935371b297eb6bab7fd2832022769707 Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 21:49:17 +0300 Subject: [PATCH 2/6] chore: update dependencies --- package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 8130c85..e9d9f2c 100644 --- a/package.json +++ b/package.json @@ -28,25 +28,25 @@ "@angular/ssr": "^18.0.6", "@ngrx/effects": "^18.0.1", "@ngrx/router-store": "^18.0.1", - "@ngrx/store": "^18.0.1", + "@ngrx/store": "^18.0.2", "@ngrx/store-devtools": "^18.0.1", "eslint-plugin-unused-imports": "^4.1.3", "express": "^4.18.2", "primeng": "^17.18.8", - "rxjs": "~7.8.0", + "rxjs": "^7.8.1", "tslib": "^2.3.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^18.0.6", - "@angular-eslint/eslint-plugin": "^18.0.1", - "@angular-eslint/eslint-plugin-template": "^18.0.1", - "@angular-eslint/schematics": "^18.0.1", - "@angular-eslint/template-parser": "^18.0.1", + "@angular-devkit/build-angular": "^18.1.4", + "@angular-eslint/eslint-plugin": "^18.3.0", + "@angular-eslint/eslint-plugin-template": "^18.3.0", + "@angular-eslint/schematics": "^18.3.0", + "@angular-eslint/template-parser": "^18.3.0", "@angular/cli": "^18.1.4", - "@angular/compiler-cli": "^18.0.0", - "@commitlint/cli": "^19.3.0", + "@angular/compiler-cli": "^18.1.4", + "@commitlint/cli": "^19.4.0", "@commitlint/config-conventional": "^19.2.2", - "@ngrx/eslint-plugin": "^18.0.1", + "@ngrx/eslint-plugin": "^18.0.2", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/express": "^4.17.17", "@types/inquirer": "^9.0.7", @@ -62,7 +62,7 @@ "eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", - "husky": "^9.0.11", + "husky": "^9.1.4", "inquirer": "^8.2.6", "jasmine-core": "~5.1.0", "karma": "~6.4.0", @@ -70,10 +70,10 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", - "lint-staged": "^15.2.7", + "lint-staged": "^15.2.9", "normalize-scss": "^8.0.0", "prettier": "^3.3.3", - "stylelint": "^16.6.1", + "stylelint": "^16.8.1", "stylelint-config-clean-order": "^6.0.0", "stylelint-config-standard": "^36.0.1", "stylelint-config-standard-scss": "^13.1.0", From 4e73d981aeca8753ea6a75f3bc3a9de75ae1643e Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 21:50:19 +0300 Subject: [PATCH 3/6] chore: add modern normalize --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e9d9f2c..614bf2c 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@ngrx/store-devtools": "^18.0.1", "eslint-plugin-unused-imports": "^4.1.3", "express": "^4.18.2", + "modern-normalize": "^3.0.0", "primeng": "^17.18.8", "rxjs": "^7.8.1", "tslib": "^2.3.0" From 3063e261d5b9ce6abb4d28c0696469145117897e Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 22:03:32 +0300 Subject: [PATCH 4/6] chore: add branch name validation --- .husky/pre-push | 1 + .lintstagedrc | 2 +- .validate-branch-namerc.cjs | 9 +++++++++ package.json | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .husky/pre-push create mode 100644 .validate-branch-namerc.cjs diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..8bb222b --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1 @@ +npx validate-branch-name \ No newline at end of file diff --git a/.lintstagedrc b/.lintstagedrc index 9629066..649c147 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -1,5 +1,5 @@ { "*": ["prettier --write --ignore-unknown"], - "*.{cjs,js,mjs,jsx,ts,tsx}": ["eslint --max-warnings 0"], + "*.{js,mjs,jsx,ts,tsx}": ["eslint --max-warnings 0"], "*.scss": "npx stylelint --fix" } diff --git a/.validate-branch-namerc.cjs b/.validate-branch-namerc.cjs new file mode 100644 index 0000000..7c881a5 --- /dev/null +++ b/.validate-branch-namerc.cjs @@ -0,0 +1,9 @@ +module.exports = { + pattern: /^(feat|fix|hotfix|chore|refactor|revert|docs|style|test|)\/tu-0[1-3]-\d{2}\/[a-zA-Z0-9-]+$/, + errorMsg: 'Please use correct branch name', +}; + +// Branch Name Examples: + +// "feat/tu-01-01/add-login-form" // where 01 is the sprint number and 01 is the issue number +// "fix/tu-02-03/fix-router" // where 02 is the sprint number and 03 is the issue number diff --git a/package.json b/package.json index 614bf2c..d2765af 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "stylelint-config-standard": "^36.0.1", "stylelint-config-standard-scss": "^13.1.0", "stylelint-order": "^6.0.4", - "typescript": "^5.5.4" + "typescript": "^5.5.4", + "validate-branch-name": "^1.3.1" } } From 04d6b97ed0e3c692c808c1919adcc17d6808687b Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 22:09:28 +0300 Subject: [PATCH 5/6] chore: update pre-commit husky hook --- .husky/pre-commit | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..d17b96c 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,32 @@ -npx lint-staged +#!/bin/bash + +BASIC_RED="\e[0;31m" +BASIC_GREEN="\e[0;32m" +BASIC_BLUE="\e[0;34m" +BASIC_CYAN="\e[0;36m" +ENDCOLOR="\e[0m" + +run_linter () { + echo -e "${BASIC_CYAN}Checking for linting errors in the src directory${ENDCOLOR}" + npx lint-staged + if [[ $? -ne 0 ]] + then + echo -e "${BASIC_RED}Linting failed. Please fix the errors and try again.${ENDCOLOR}" + exit 1 + fi +} + +run_tsc () { + echo -e "${BASIC_BLUE}Checking for TypeScript errors${ENDCOLOR}" + npx tsc + if [[ $? -ne 0 ]] + then + echo -e "${BASIC_RED}TypeScript compilation failed. Please fix the errors and try again.${ENDCOLOR}" + exit 1 + fi +} + +run_linter +run_tsc + +printf "${BASIC_GREEN} โœ” All checks passed. Happy coding${ENDCOLOR}!\n" \ No newline at end of file From a867f2bde6316936963918e301bd11f179c605bf Mon Sep 17 00:00:00 2001 From: Margarita Golubeva Date: Tue, 13 Aug 2024 22:50:10 +0300 Subject: [PATCH 6/6] chore: add github workflows --- .github/labeler.yml | 47 ++++++++++++++++++++++++ .github/pull_request_template.md | 54 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 45 +++++++++++++++++++++++ .github/workflows/labeler.yml | 18 ++++++++++ .github/workflows/request_review.yml | 52 +++++++++++++++++++++++++++ 5 files changed, 216 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/request_review.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..0ec77ac --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,47 @@ +documentation: + - changed-files: + - any-glob-to-any-file: '**/*.md' + +chore: + - any: + - changed-files: + - any-glob-to-all-files: '*' + - head-branch: + - '^chore' + +feature: + - head-branch: + - '^feat' + +fix: + - head-branch: + - '^fix' + - '^hotfix' + +refactor: + - head-branch: + - '^refactor' + +test: + - any: + - head-branch: + - '^test' + - changed-files: + - any-glob-to-any-file: '**/*.spec.ts' + +revert: + - head-branch: + - '^revert' + +styles: + - changed-files: + - any-glob-to-any-file: '**/*.scss' + +sprint1: + - head-branch: 'tu-01' + +sprint2: + - head-branch: 'tu-02' + +sprint3: + - head-branch: 'tu-03' diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..b558407 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,54 @@ +## PR Title โœจ + +๐Ÿ“ conforms with the following format: + +- [ ] prefix (following the [convention](https://www.conventionalcommits.org/en/v1.0.0-beta.2/): `feat`, `fix`, `hotfix`, `chore`, `refactor`, `revert`, `docs`, `style`, `test`) +- [ ] sprint and issue number (e.g. `tu-01-02`, where `01` - is the sprint number and `02` - is the issue number) +- [ ] short description + +๐Ÿ‘€ Example: `feat(tu-01-02): description` + +## PR Description ๐Ÿง™โ€โ™‚๏ธ + +_Add a comprehensive description of the changes in the PR_ ๐Ÿค” + +#### Affected Scope ๐Ÿ’ก + +Provide affected modules or areas + +#### Styles ๐ŸŽจ + +Provide any style changes details + +#### Testing Strategy ๐Ÿงผ + +Describe the testing strategy for the changes + +#### Screenshots/Demo ๐Ÿ“ธ + +If necessary provide screenshots or a demo link to visually demonstrate the changes + +#### Documentation Updates ๐Ÿ“– + +Specify if any documentation updates are required and provide details on what needs to be updated + +#### Provide any other relevant information ๐Ÿฆ‰ + +## Auto-Review ๐Ÿค– + +- [x] The reviewers have been requested ๐Ÿ“ + [![Request Review on PR Open](https://github.com/kleostro/tu-tu/actions/workflows/request_review.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/request_review.yml) +- [x] The labels have been added ๐ŸŽจ + [![Pull Request Labeler](https://github.com/kleostro/tu-tu/actions/workflows/labeler.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/labeler.yml) +- [x] My code doesn't generate any errors or warnings โ›“๏ธ + [![Continuous Integration](https://github.com/kleostro/tu-tu/actions/workflows/ci.yml/badge.svg)](https://github.com/kleostro/tu-tu/actions/workflows/ci.yml) +- [x] My code builds successfully โš™๏ธ + [![Netlify Status](https://api.netlify.com/api/v1/badges/9704b9db-b410-40b1-8d2b-2eeed828626e/deploy-status)](https://app.netlify.com/sites/mad-wizards-tu-tu/deploys) + +## Self-Check ๐ŸŒŸ + +- [ ] I wrote the correct title for the PR ๐Ÿ—๏ธ +- [ ] I wrote a comprehensive description for the PR ๐Ÿ“œ +- [ ] I have performed a self-review of my own code โœ… +- [ ] I have commented my code where needed ๐Ÿ“ +- [ ] I am happy with my PR and ready to merge โค๏ธโ€๐Ÿ”ฅ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f4a772b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: Continuous Integration + +on: + pull_request: + branches: + - develop + - sprint-1 + - sprint-2 + - sprint-3 + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Format code with Prettier + run: npm run ci:format + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Run Karma tests + run: npm test diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..b53a799 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,18 @@ +name: 'Pull Request Labeler' +on: + pull_request_target: + +jobs: + labeler: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Label Pull Request + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/request_review.yml b/.github/workflows/request_review.yml new file mode 100644 index 0000000..2607f57 --- /dev/null +++ b/.github/workflows/request_review.yml @@ -0,0 +1,52 @@ +name: Request Review on PR Open + +on: + pull_request: + types: [opened] + +jobs: + automate-review: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Get PR Author + id: pr_author + run: echo "::set-output name=author::${{ github.event.pull_request.user.login }}" + + - name: Request Review + if: steps.pr_author.outputs.author == 'stardustmeg' + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: '["Kleostro", "ki8vi", "katyastan"]' + + - name: Request Review + if: steps.pr_author.outputs.author == 'Kleostro' + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: '["stardustmeg", "ki8vi", "katyastan"]' + + - name: Request Review + if: steps.pr_author.outputs.author == 'ki8vi' + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: '["stardustmeg", "Kleostro", "katyastan"]' + + - name: Request Review + if: steps.pr_author.outputs.author == 'katyastan' + uses: octokit/request-action@v2.x + with: + route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers + mediaType: '{"previews":["luke-cage"]}' + token: ${{ secrets.GITHUB_TOKEN }} + reviewers: '["stardustmeg", "Kleostro", "ki8vi"]'