From ba8c26ca46e9851d9205c13a3b03266e2e107b18 Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:13:29 +0400 Subject: [PATCH 1/6] Refactor serviceWorker.js for better readability The code in serviceWorker.js has been refactored to improve readability. Changes include modifying Boolean statements' formatting and updating string concatenations to provide a cleaner look for messages. This makes it easier to understand the operations, specifically identifying local host addresses and the messaging about serviceWorker functions. From 49fc9e67bc7d9048c4358ae80d76c88f7bae2a64 Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:35:19 +0400 Subject: [PATCH 2/6] Add CircleCI configuration file This commit introduces a new configuration file for CircleCI, outlining the pipeline for testing, building, and deploying the project. The file establishes jobs for testing code, building the app, and then deploying the built app to GitHub Pages. --- .circleci/config.yml | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..2f869aa --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,106 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference + +# For a detailed guide to building and testing with Node, read the docs: +# https://circleci.com/docs/language-javascript/ for more details +version: 2.1 + +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# See: https://circleci.com/docs/orb-intro/ +orbs: + # See the Node orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node + node: circleci/node@5.2 + +jobs: + # Below is the definition of your job to build and test your app, you can rename and customize it as you want. + test: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job + docker: + # Specify the version you desire here + # See: https://circleci.com/developer/images/image/cimg/node + - image: cimg/node:16.20.1 + + # Add steps to the job + # See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps + steps: + # Checkout the code as the first step. + - checkout + - node/install-packages + - run: + name: Run linter + command: node run lint + - run: + name: Run tests + command: node run test + + build: + docker: + - image: cimg/node:16.20.1 + steps: + - checkout + - node/install-packages + - run: + name: Build app + command: node run build + - persist_to_workspace: + root: out + paths: + - . + + deploy: + docker: + - image: cimg/node:16.20.1 + steps: + - add_ssh_keys: + fingerprints: + - 'SHA256:K13r15ubS1ee0uPhmBa67AXCfMvz+s1us8DoK5yj1GA' + - attach_workspace: + at: /tmp/out + - checkout + - run: + name: Deploy to GitHub Pages + command: | + git fetch + git checkout gh-pages + rm -rf ./* + mv /tmp/out/* . + touch .nojekyll + git config user.email "1903291+hex22a@users.noreply.github.com" + git config user.name "CircleCI (on behalf of Crash)" + git add . + git commit -m "CircleCI deploy to GitHub Pages" + git push -u origin gh-pages +# Orchestrate jobs using workflows +# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows +workflows: + deploy-gh-pages: # This is the name of the workflow, feel free to change it to better match your workflow. + # Inside the workflow, you define the jobs you want to run. + jobs: + - test: + filters: + tags: + only: /.*/ + branches: + ignore: + - gh-pages + # For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines. + # - node/test + - build: + filters: + tags: + only: /^\d+.\d+.\d+$/ + branches: + ignore: /.*/ + requires: + - test + + - deploy: + filters: + tags: + only: /^\d+.\d+.\d+$/ + branches: + ignore: /.*/ + requires: + - test + - build From 74a1c225373d4669fb612395886bbea685aaca6d Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:42:21 +0400 Subject: [PATCH 3/6] Update SSH key in CircleCI configuration The SSH key fingerprint used in the CircleCI configuration file has been updated. The old key has been replaced with the new one to maintain the security and integrity of the system. This change is necessary to reflect updated security credentials. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2f869aa..259e724 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ jobs: steps: - add_ssh_keys: fingerprints: - - 'SHA256:K13r15ubS1ee0uPhmBa67AXCfMvz+s1us8DoK5yj1GA' + - 'SHA256:5aE7AmvtKBZR+3Zs0AakVuWjtQ+oRAiw3k714FR/KeU' - attach_workspace: at: /tmp/out - checkout From 16548bd58a311d5e0a9b16f6498c79c24e352e2b Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:45:00 +0400 Subject: [PATCH 4/6] Update npm install command in CircleCI config The CircleCI configuration has been updated to use a different npm install command. The new command, "npm install --legacy-peer-deps", is set to override the previous install command. This change applies to both 'Run linter' and 'Build app' steps. --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 259e724..417eb10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,8 @@ jobs: steps: # Checkout the code as the first step. - checkout - - node/install-packages + - node/install-packages: + override-ci-command: npm install --legacy-peer-deps - run: name: Run linter command: node run lint @@ -39,7 +40,8 @@ jobs: - image: cimg/node:16.20.1 steps: - checkout - - node/install-packages + - node/install-packages: + override-ci-command: npm install --legacy-peer-deps - run: name: Build app command: node run build From 2bea9ba4d0db65fb3674eaecad6f8b613c1f0b5b Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 17:53:47 +0400 Subject: [PATCH 5/6] Update CircleCI config to use npm commands This commit modifies the CircleCI configuration file commands to use npm instead of node. This change was applied in three sections: running the linter, running the tests, and building the app. --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 417eb10..0e936d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,10 +30,10 @@ jobs: override-ci-command: npm install --legacy-peer-deps - run: name: Run linter - command: node run lint + command: npm run lint - run: name: Run tests - command: node run test + command: npm run test build: docker: @@ -44,7 +44,7 @@ jobs: override-ci-command: npm install --legacy-peer-deps - run: name: Build app - command: node run build + command: npm run build - persist_to_workspace: root: out paths: From 31bdcb6bd7abb68574e32706611a22abaae9ae24 Mon Sep 17 00:00:00 2001 From: Crash <1903291+hex22a@users.noreply.github.com> Date: Fri, 14 Jun 2024 18:07:19 +0400 Subject: [PATCH 6/6] Add 'prettier' to ESLint configuration This commit adds 'prettier' to the extends array in the ESLint configuration file. The necessary 'eslint-config-prettier' package was also added to the dependencies in 'package.json' and 'package-lock.json' files. This ensures the project follows the styling rules defined by Prettier. --- .eslintrc | 2 +- package-lock.json | 19 +++++++++++++++++++ package.json | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 951d4d4..cc71088 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": ["react-app", "airbnb-base"], + "extends": ["react-app", "airbnb-base", "prettier"], "parser": "@babel/eslint-parser", "ignorePatterns": [ "./node_modules/*" diff --git a/package-lock.json b/package-lock.json index 982a9fd..68a905b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "enzyme-to-json": "^3.6.2", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^13.2.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", "husky": "^1.3.1", "jest-dom": "^3.5.0", @@ -11173,6 +11174,18 @@ "eslint-plugin-import": "^2.17.2" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-config-react-app": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", @@ -40543,6 +40556,12 @@ "object.entries": "^1.1.0" } }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true + }, "eslint-config-react-app": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", diff --git a/package.json b/package.json index b0a58bf..4c1067e 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "enzyme-to-json": "^3.6.2", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^13.2.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", "husky": "^1.3.1", "jest-dom": "^3.5.0",