From b5891942a291b1464df90e6d20d3c5949d899130 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:59:48 +0200 Subject: [PATCH 01/10] feat: add husky --- package.json | 2 ++ yarn.lock | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 7ba8cf43c..9099815b2 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "preinstall": "node ./scripts/use-yarn.js", "find:unused": "next-unused", "prebuild": "node ./scripts/check-envs.js", + "postinstall": "husky", "dev": "yarn && next dev -p 3001", "dev:tw": "TAILWIND_MODE=watch tailwindcss -o src/tailwind.css --watch", "build": "node ./scripts/check-envs.js && next build", @@ -73,6 +74,7 @@ "babel-plugin-istanbul": "^6.1.1", "cypress": "^13.11.0", "eslint": "^7.32.0", + "husky": "^9.0.11", "next-unused": "^0.0.6", "postcss": "8.4.31", "prettier": "2.7.1", diff --git a/yarn.lock b/yarn.lock index 454f6b28a..4cba0cd76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4610,6 +4610,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +husky@^9.0.11: + version "9.0.11" + resolved "https://registry.yarnpkg.com/husky/-/husky-9.0.11.tgz#fc91df4c756050de41b3e478b2158b87c1e79af9" + integrity sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw== + idb-keyval@^6.2.0: version "6.2.1" resolved "https://registry.yarnpkg.com/idb-keyval/-/idb-keyval-6.2.1.tgz#94516d625346d16f56f3b33855da11bfded2db33" From 9b4ce90378520f1f5bcaf1858af9dadecc2ccf9e Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Wed, 26 Jun 2024 19:19:12 +0200 Subject: [PATCH 02/10] feat: update Action name --- .github/workflows/pre-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-build.yml b/.github/workflows/pre-build.yml index f1bcb2090..cb9815301 100644 --- a/.github/workflows/pre-build.yml +++ b/.github/workflows/pre-build.yml @@ -23,5 +23,5 @@ jobs: - name: Install dependencies run: yarn install - - name: Build project + - name: Build project before deployment run: yarn build From b693cef9bf55c4fbbf0e8cce6aacf3baa92c3181 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Thu, 27 Jun 2024 08:45:08 +0200 Subject: [PATCH 03/10] feat: add pre-commit script (husky) --- .husky/pre-commit | 1 + package.json | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..8f56d750c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarn build diff --git a/package.json b/package.json index 9099815b2..ea026143c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "preinstall": "node ./scripts/use-yarn.js", "find:unused": "next-unused", "prebuild": "node ./scripts/check-envs.js", - "postinstall": "husky", "dev": "yarn && next dev -p 3001", "dev:tw": "TAILWIND_MODE=watch tailwindcss -o src/tailwind.css --watch", "build": "node ./scripts/check-envs.js && next build", @@ -15,7 +14,11 @@ "prod": "next export", "cypress:open": "cypress open", "cypress:run": "cypress run --browser chrome", - "lint": "eslint './**/*.{js,ts,tsx}'" + "lint": "eslint './**/*.{js,ts,tsx}'", + "postinstall": "husky", + "prepack": "pinst --disable", + "postpack": "pinst --enable", + "prepare": "husky" }, "dependencies": { "@coderosh/images-to-pdf": "^2.1.0", From 345d791ba1396c4432ce176d62bb91bb003c26eb Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:32:00 +0200 Subject: [PATCH 04/10] feat: add eslint to the build process --- .eslintrc.json | 9 +- package.json | 3 + src/components/Snackbar.tsx | 1 - .../CtaSection.tsx | 12 +- .../HeroSection.tsx | 4 +- src/components/banners/LoginBFBanner.tsx | 8 +- src/components/banners/WheelBanner.tsx | 113 ------- .../banners/components/WheelComponent.tsx | 148 --------- src/components/components/Countdown.tsx | 17 +- src/components/dealfuel/PriceCard.tsx | 23 +- src/components/dealfuel/PriceTable.tsx | 4 - src/components/home/InfoSection.tsx | 2 - src/components/home/SocialProofSection.tsx | 1 - src/components/home/TestimonialsSection.tsx | 9 +- src/components/home/ThirdFeaturesSection.tsx | 22 +- src/components/home/components/FileItem.tsx | 14 +- src/components/home/components/Label.tsx | 7 +- .../components/heroSection/TitleAndSignup.tsx | 6 +- .../components/heroSection/TitleAndSurvey.tsx | 8 +- src/components/layout/BFBanner.tsx | 113 ------- src/components/layout/Layout.tsx | 10 +- src/components/layout/ProductsNavigation.tsx | 12 +- .../layout/components/LanguageBox.tsx | 51 ++- .../components/navbar/ItemsNavigation.tsx | 244 +++++++------- src/components/layout/footers/Footer.tsx | 44 ++- .../layout/footers/MinimalFooter.tsx | 4 +- .../layout/navbars/MinimalNavbar.tsx | 2 +- src/components/layout/navbars/Navbar.tsx | 40 +-- .../legal/TermsAndConditionsOverview.tsx | 11 +- .../legal/components/SelectSection.tsx | 14 +- src/components/lifetime/CtaSection.tsx | 2 +- src/components/lifetime/HeroSection.tsx | 4 +- .../lifetime/PriceBannerForCampaigns.tsx | 2 +- .../lifetime/celebration/HeroSection.tsx | 2 +- src/components/media-area/KitSection.tsx | 2 +- .../newsletter/MakePrivacySection.tsx | 44 +-- .../partner-discount/HeroSection.tsx | 12 +- .../partner-discount/InfoSection.tsx | 12 +- .../partner-discount/PaymentSection.tsx | 7 +- .../partnerships/freemonth/FeatureSection.js | 121 ------- .../partnerships/freemonth/HeroSection.js | 50 --- .../partnerships/freemonth/PriceCard.js | 306 ------------------ .../partnerships/guru99/FeatureSection.js | 121 ------- .../partnerships/guru99/HeroSection.js | 87 ----- .../partnerships/guru99/PriceCard.js | 304 ----------------- .../password-checker/FeaturesSection.tsx | 17 +- .../password-checker/HeroSection.tsx | 14 +- .../password-generator/HeroSection.tsx | 11 +- .../password-generator/InfoSection.tsx | 10 +- .../components/CheckboxSettings.tsx | 12 +- .../components/PasswordSettings.tsx | 12 +- .../password-generator/utils/index.ts | 2 +- .../prices/CyberAwarenessSpecialCard.tsx | 16 +- src/components/prices/FreePlanCard.tsx | 6 +- src/components/prices/PriceCard.tsx | 10 +- src/components/prices/PriceTable.tsx | 8 +- src/components/prices/SpecialPriceCard.tsx | 8 +- src/components/pricing/BestStorageSection.tsx | 7 +- src/components/pricing/CtaSection.tsx | 8 +- src/components/pricing/HeroSection.tsx | 6 +- .../privacy-directory/HeroSection2.tsx | 5 +- .../privacy-directory/SupportNGOsSection.tsx | 3 +- .../privacy/BetterTomorrowSection.tsx | 7 +- src/components/privacy/FeatureSection.tsx | 8 +- src/components/privacy/HeroSection.tsx | 8 +- src/components/privacy/HeroSection2.tsx | 8 +- src/components/privacy/InxtAppsSection.tsx | 7 +- src/components/privacy/ManifestoSection.tsx | 11 +- src/components/privacy/ManifestoSection2.tsx | 11 +- src/components/privacy/SecuritumSection.tsx | 6 +- src/components/services/stripe.service.ts | 2 +- .../shared/CommandTextInputCopy.tsx | 4 +- .../shared/CompanyLogosRecognitions.tsx | 2 +- src/components/shared/DownloadComponent.tsx | 4 +- src/components/shared/DropArea.tsx | 2 +- src/components/shared/FaqSection.tsx | 2 +- src/components/shared/Header.tsx | 11 +- src/components/shared/HeroSectionSafeArea.tsx | 14 +- src/components/shared/ProductCard.tsx | 52 ++- src/components/shared/RedirectButton.tsx | 2 +- src/components/shared/RenderDescription.tsx | 7 +- src/components/shared/StarsRate.tsx | 2 +- src/components/shared/ToolsSection.tsx | 7 +- .../specialoffer/MarqueeComponent.tsx | 2 +- .../specialoffer/WhatWeDoSection.tsx | 2 +- .../success-stories/HeroSection.tsx | 6 +- src/components/success-stories/WhatWeDo.tsx | 7 +- .../techradar-discount/HeroSection.tsx | 16 +- .../techradar-discount/InfoSection.tsx | 7 +- .../techradar-discount/PaymentsSection.tsx | 6 +- src/components/temp-email/HeroSection.tsx | 6 +- src/components/temp-email/InfoSection.tsx | 12 +- src/components/temp-email/SignupSection.tsx | 19 +- .../temp-email/components/EmailToolBar.tsx | 81 +++-- .../temp-email/components/InboxView.tsx | 2 +- .../temp-email/components/Messages.tsx | 48 +-- .../temp-email/services/icon-service.ts | 2 +- .../utils/schema-markup-generator.ts | 4 +- .../virus-scanner/BannersSection.tsx | 11 +- src/components/virus-scanner/CtaSection.tsx | 7 +- .../virus-scanner/FeaturesSection.tsx | 6 +- src/components/virus-scanner/HeroSection.tsx | 6 +- src/components/vpn-extension/HeroSection.tsx | 8 +- .../vpn-extension/SecureVPNSection.tsx | 2 +- src/components/webdav/HowToUseCLISection.tsx | 2 +- .../webdav/WebDAVSupportSection.tsx | 2 +- src/lib/analytics.ts | 11 +- src/lib/auth.ts | 1 + src/lib/brave.ts | 4 +- src/lib/{checker.js => checker.ts} | 24 +- src/lib/{gtag.js => gtag.ts} | 0 src/pages/_app.tsx | 2 +- src/pages/about.tsx | 5 +- src/pages/affiliates/[filename].tsx | 13 +- src/pages/affiliates/index.tsx | 11 +- src/pages/annual.tsx | 3 +- src/pages/b.tsx | 3 +- src/pages/black-friday.tsx | 5 +- src/pages/byte-converter.tsx | 7 +- src/pages/cloud-storage-comparison.tsx | 7 +- src/pages/cloud-storage-for-education.tsx | 3 +- src/pages/cloudwards.tsx | 11 +- src/pages/cyber-awareness.tsx | 7 +- src/pages/cyber-security-quiz.tsx | 9 +- src/pages/dealfuel.tsx | 17 +- src/pages/dealmirror.tsx | 17 +- src/pages/drive.tsx | 7 +- src/pages/file-converter/[filename].tsx | 5 +- src/pages/file-converter/index.tsx | 3 +- src/pages/freemonth.tsx | 52 --- src/pages/index.tsx | 3 +- src/pages/legal.tsx | 3 +- src/pages/lifetime/celebration/[filename].tsx | 7 +- src/pages/lifetime/index.tsx | 9 +- src/pages/lifetime_special.tsx | 5 +- src/pages/locker.tsx | 11 +- src/pages/media-area.tsx | 11 +- src/pages/mightydeals.tsx | 21 +- src/pages/newsletter-subscribe.tsx | 11 +- src/pages/open-source.tsx | 5 +- src/pages/partner-discount.tsx | 14 +- src/pages/password-checker.tsx | 13 +- src/pages/password-generator.tsx | 7 +- src/pages/pccomponentes-products.tsx | 11 +- src/pages/pcloud-alternative.tsx | 3 +- src/pages/pricing.tsx | 7 +- src/pages/privacy-directory.tsx | 7 +- src/pages/privacy.tsx | 11 +- src/pages/{sitemap.xml.js => sitemap.xml.ts} | 0 src/pages/specialoffer/freeuser.tsx | 3 +- src/pages/stackcommerce.tsx | 40 ++- src/pages/startpage.tsx | 27 +- src/pages/techradar-discount.tsx | 29 +- src/pages/temporary-email.tsx | 8 +- src/pages/virus-scanner.tsx | 27 +- src/pages/vpn.tsx | 22 +- src/pages/webdav.tsx | 11 +- src/pages/what-does-google-know-about-me.tsx | 15 +- tests/redeem-codes.test.ts | 25 +- yarn.lock | 48 +++ 160 files changed, 1081 insertions(+), 2188 deletions(-) delete mode 100644 src/components/banners/WheelBanner.tsx delete mode 100644 src/components/banners/components/WheelComponent.tsx delete mode 100644 src/components/layout/BFBanner.tsx delete mode 100644 src/components/partnerships/freemonth/FeatureSection.js delete mode 100644 src/components/partnerships/freemonth/HeroSection.js delete mode 100644 src/components/partnerships/freemonth/PriceCard.js delete mode 100644 src/components/partnerships/guru99/FeatureSection.js delete mode 100644 src/components/partnerships/guru99/HeroSection.js delete mode 100644 src/components/partnerships/guru99/PriceCard.js rename src/lib/{checker.js => checker.ts} (71%) rename src/lib/{gtag.js => gtag.ts} (100%) delete mode 100644 src/pages/freemonth.tsx rename src/pages/{sitemap.xml.js => sitemap.xml.ts} (100%) diff --git a/.eslintrc.json b/.eslintrc.json index 5e621e651..95826e251 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,15 @@ +// TODO: Add next core-web-vitals. E.g. "extends": ["next/core-web-vitals"] + { "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], "rules": { - "quotes": ["error", "single"], + "quotes": ["warn", "single"], "semi": ["error", "always"], "linebreak-style": ["error", "unix"], "no-console": "off", - "max-len": "off" + "max-len": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-empty-function": "off", + "no-async-promise-executor": "warn" } } diff --git a/package.json b/package.json index 73edf782b..63c41c884 100644 --- a/package.json +++ b/package.json @@ -77,10 +77,13 @@ "babel-plugin-istanbul": "^6.1.1", "cypress": "^13.12.0", "eslint": "^7.32.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", "husky": "^9.0.11", "next-unused": "^0.0.6", "postcss": "8.4.31", "prettier": "2.7.1", + "prettier-plugin-organize-imports": "^3.2.4", "prettier-plugin-tailwindcss": "0.1.13", "reset-css": "5.0.1", "sass": "1.41.0", diff --git a/src/components/Snackbar.tsx b/src/components/Snackbar.tsx index 3a684dbc8..40af755d1 100644 --- a/src/components/Snackbar.tsx +++ b/src/components/Snackbar.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { toast, ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; diff --git a/src/components/annual-plans-for-affiliates/CtaSection.tsx b/src/components/annual-plans-for-affiliates/CtaSection.tsx index 8facc216b..e77363af5 100644 --- a/src/components/annual-plans-for-affiliates/CtaSection.tsx +++ b/src/components/annual-plans-for-affiliates/CtaSection.tsx @@ -2,10 +2,12 @@ const PRICE_TABLE_ID = 'pricing-table'; const CtaSection = ({ textContent }: { textContent: any }) => { function redirectToPricingTable() { - window.scrollTo({ - top: document?.getElementById(PRICE_TABLE_ID)?.offsetTop! + 500, - behavior: 'smooth', - }); + if (document.getElementById(PRICE_TABLE_ID)) { + window.scrollTo({ + top: document.getElementById(PRICE_TABLE_ID)!.offsetTop + 500, + behavior: 'smooth', + }); + } } return ( @@ -16,7 +18,7 @@ const CtaSection = ({ textContent }: { textContent: any }) => { className="overflow-hidden bg-primary bg-cover px-5 py-14" >
{textContent.title}
{textContent.description}