From 3a4ee0ce0cd41a3e57d384ad66dc449e8ea496a3 Mon Sep 17 00:00:00 2001 From: Napoleon-Christos Oikonomou Date: Wed, 19 May 2021 15:27:55 +0300 Subject: [PATCH] update deps --- .github/workflows/publish.yml | 2 +- template.json | 108 ++++++++++-------- template/.github/workflows/ci.yml | 8 +- template/src/api/index.js | 2 +- template/src/index.js | 13 ++- ...eportWebVitals.js => report-web-vitals.js} | 0 template/src/screens/Home.js | 11 +- ...tion.js => service-worker-registration.js} | 4 +- template/src/service-worker.js | 2 - template/src/utils/index.js | 4 +- ...{useGlobalState.js => use-global-state.js} | 0 .../utils/{useSnackbar.js => use-snackbar.js} | 0 12 files changed, 89 insertions(+), 65 deletions(-) rename template/src/{reportWebVitals.js => report-web-vitals.js} (100%) rename template/src/{serviceWorkerRegistration.js => service-worker-registration.js} (94%) rename template/src/utils/{useGlobalState.js => use-global-state.js} (100%) rename template/src/utils/{useSnackbar.js => use-snackbar.js} (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 79d049a..59bdfef 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - name: โŽ” Setup node uses: actions/setup-node@v2 with: - node-version: 14 + node-version: 16 registry-url: "https://npm.pkg.github.com" scope: "@iamnapo" diff --git a/template.json b/template.json index 8d01671..d8ee521 100644 --- a/template.json +++ b/template.json @@ -36,73 +36,89 @@ "iamnapo/with-react" ], "rules": { - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": [ - "cypress/**/*.js" + "unicorn/prefer-module": "off" + }, + "overrides": [ + { + "files": [ + "src/service-worker.js" + ], + "rules": { + "no-restricted-globals": "off" + } + }, + { + "files": [ + "cypress/**/*" + ], + "rules": { + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": true + } ] } - ] - }, + } + ], "ignorePatterns": [ "build", "coverage" ] }, "dependencies": { - "@craco/craco": "^6.1.1", - "@emotion/react": "^11.1.5", - "@emotion/styled": "^11.1.5", - "@fontsource/roboto": "^4.2.2", - "@iamnapo/construct-url": "^2.0.0", - "@material-ui/core": "^5.0.0-alpha.27", - "@material-ui/icons": "^5.0.0-alpha.27", - "@material-ui/lab": "^5.0.0-alpha.27", - "@sentry/browser": "^6.2.3", + "@craco/craco": "^6.1.2", + "@emotion/react": "^11.4.0", + "@emotion/styled": "^11.3.0", + "@fontsource/roboto": "^4.3.0", + "@iamnapo/construct-url": "^2.0.1", + "@material-ui/core": "^5.0.0-alpha.34", + "@material-ui/icons": "^5.0.0-alpha.34", + "@material-ui/lab": "^5.0.0-alpha.34", + "@sentry/browser": "^6.4.0", "clsx": "^1.1.1", - "date-fns": "^2.19.0", + "date-fns": "^2.21.3", "history": "^4.10.1", - "ky": "^0.27.0", - "notistack": "^1.0.5", + "ky": "^0.28.1", + "notistack": "^1.0.8", "prop-types": "^15.7.2", "query-string": "^7.0.0", "react-ga": "^3.3.0", "react-router-dom": "^5.2.0", - "swr": "^0.5.4", - "web-vitals": "^1.1.1", - "workbox-background-sync": "^6.1.2", - "workbox-broadcast-update": "^6.1.2", - "workbox-cacheable-response": "^6.1.2", - "workbox-core": "^6.1.2", - "workbox-expiration": "^6.1.2", - "workbox-google-analytics": "^6.1.2", - "workbox-navigation-preload": "^6.1.2", - "workbox-precaching": "^6.1.2", - "workbox-range-requests": "^6.1.2", - "workbox-routing": "^6.1.2", - "workbox-strategies": "^6.1.2", - "workbox-streams": "^6.1.2", - "zustand": "^3.3.3" + "swr": "^0.5.6", + "web-vitals": "^1.1.2", + "workbox-background-sync": "^6.1.5", + "workbox-broadcast-update": "^6.1.5", + "workbox-cacheable-response": "^6.1.5", + "workbox-core": "^6.1.5", + "workbox-expiration": "^6.1.5", + "workbox-google-analytics": "^6.1.5", + "workbox-navigation-preload": "^6.1.5", + "workbox-precaching": "^6.1.5", + "workbox-range-requests": "^6.1.5", + "workbox-routing": "^6.1.5", + "workbox-strategies": "^6.1.5", + "workbox-streams": "^6.1.5", + "zustand": "^3.5.1" }, "devDependencies": { - "@cypress/code-coverage": "^3.9.2", + "@cypress/code-coverage": "^3.9.5", "@cypress/instrument-cra": "^1.4.0", - "@iamnapo/prettier-config": "^1.0.2", + "@iamnapo/prettier-config": "^1.0.3", "babel-plugin-import": "^1.13.3", - "cypress": "^6.8.0", - "dotenv": "^8.2.0", - "eslint": "^7.22.0", - "eslint-config-iamnapo": "^12.0.1", - "eslint-plugin-cypress": "^2.11.2", - "eslint-plugin-import": "^2.22.1", + "cypress": "^7.3.0", + "dotenv": "^9.0.2", + "eslint": "^7.26.0", + "eslint-config-iamnapo": "^15.0.0", + "eslint-plugin-cypress": "^2.11.3", + "eslint-plugin-import": "^2.23.2", "eslint-plugin-jsx-a11y": "^6.4.1", - "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react": "^7.23.2", "eslint-plugin-react-hooks": "^4.2.0", - "eslint-plugin-unicorn": "^28.0.2", - "sass": "^1.32.8", + "eslint-plugin-unicorn": "^32.0.1", + "sass": "^1.32.13", "source-map-explorer": "^2.5.2", - "start-server-and-test": "^1.12.1" + "start-server-and-test": "^1.12.2" }, "engines": { "node": ">=14" diff --git a/template/.github/workflows/ci.yml b/template/.github/workflows/ci.yml index d4385d5..609ce8e 100644 --- a/template/.github/workflows/ci.yml +++ b/template/.github/workflows/ci.yml @@ -14,14 +14,12 @@ jobs: uses: actions/checkout@v2 - name: โŽ” Setup node - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: - node-version: 14 + node-version: 16 - name: ๐Ÿ“ฅ Download deps - run: bahmutov/npm-install@v1 - with: - useLockFile: false + run: npm i --legacy-peer-deps - name: ๐Ÿงช Run test script run: npm test diff --git a/template/src/api/index.js b/template/src/api/index.js index 6ab174d..266352f 100644 --- a/template/src/api/index.js +++ b/template/src/api/index.js @@ -1,5 +1,5 @@ import useSWR from "swr"; -import ky from "ky"; +import ky from "ky/distribution"; import queryString from "query-string"; import constructUrl from "@iamnapo/construct-url"; diff --git a/template/src/index.js b/template/src/index.js index 8759055..9cb68b2 100644 --- a/template/src/index.js +++ b/template/src/index.js @@ -1,8 +1,8 @@ import { lazy, StrictMode, Suspense, useCallback, useEffect } from "react"; import ReactDOM from "react-dom"; import { Router, Switch, Route, useLocation } from "react-router-dom"; -import { LinearProgress, StyledEngineProvider } from "@material-ui/core"; -import { ThemeProvider, createMuiTheme } from "@material-ui/core/styles"; +import { LinearProgress } from "@material-ui/core"; +import { ThemeProvider, createTheme, StyledEngineProvider } from "@material-ui/core/styles"; import { SnackbarProvider } from "notistack"; import ReactGA from "react-ga"; import * as Sentry from "@sentry/browser"; @@ -14,8 +14,9 @@ import "./index.scss"; import history from "./history"; import { useGlobalState } from "./utils"; -import * as serviceWorkerRegistration from "./serviceWorkerRegistration"; -import reportWebVitals from "./reportWebVitals"; +import api from "./api"; +import * as serviceWorkerRegistration from "./service-worker-registration"; +import reportWebVitals from "./report-web-vitals"; const Home = lazy(() => import("./screens/Home")); @@ -26,8 +27,8 @@ Sentry.init({ enabled: process.env.NODE_ENV === "production", }); ReactGA.initialize(process.env.REACT_APP_GA, { testMode: process.env.NODE_ENV !== "production" }); -const swrConfig = { revalidateOnFocus: false, shouldRetryOnError: false }; -const theme = createMuiTheme({ +const swrConfig = { revalidateOnFocus: false, shouldRetryOnError: false, fetcher: api.get }; +const theme = createTheme({ palette: { primary: { main: "#61dafb", diff --git a/template/src/reportWebVitals.js b/template/src/report-web-vitals.js similarity index 100% rename from template/src/reportWebVitals.js rename to template/src/report-web-vitals.js diff --git a/template/src/screens/Home.js b/template/src/screens/Home.js index 7de0437..eb98e35 100644 --- a/template/src/screens/Home.js +++ b/template/src/screens/Home.js @@ -10,7 +10,16 @@ const Home = () => { return ( - + diff --git a/template/src/serviceWorkerRegistration.js b/template/src/service-worker-registration.js similarity index 94% rename from template/src/serviceWorkerRegistration.js rename to template/src/service-worker-registration.js index 1741b7b..d0ed17c 100644 --- a/template/src/serviceWorkerRegistration.js +++ b/template/src/service-worker-registration.js @@ -59,6 +59,8 @@ function checkValidServiceWorker(swUrl, config) { export function unregister() { if ("serviceWorker" in navigator) { - navigator.serviceWorker.ready.then((registration) => registration.unregister()).catch((error) => console.error(error.message)); + navigator.serviceWorker.ready + .then((registration) => registration.unregister()) + .catch((error) => console.error(error.message)); } } diff --git a/template/src/service-worker.js b/template/src/service-worker.js index 8728080..5d34f15 100644 --- a/template/src/service-worker.js +++ b/template/src/service-worker.js @@ -1,5 +1,3 @@ -/* eslint-disable no-restricted-globals */ - import { clientsClaim } from "workbox-core"; import { ExpirationPlugin } from "workbox-expiration"; import { precacheAndRoute, createHandlerBoundToURL } from "workbox-precaching"; diff --git a/template/src/utils/index.js b/template/src/utils/index.js index 6527652..11576a7 100644 --- a/template/src/utils/index.js +++ b/template/src/utils/index.js @@ -1,3 +1,3 @@ -export { default as useSnackbar } from "./useSnackbar"; -export { default as useGlobalState } from "./useGlobalState"; +export { default as useSnackbar } from "./use-snackbar"; +export { default as useGlobalState } from "./use-global-state"; export const STUFF = [1, 2, 3]; diff --git a/template/src/utils/useGlobalState.js b/template/src/utils/use-global-state.js similarity index 100% rename from template/src/utils/useGlobalState.js rename to template/src/utils/use-global-state.js diff --git a/template/src/utils/useSnackbar.js b/template/src/utils/use-snackbar.js similarity index 100% rename from template/src/utils/useSnackbar.js rename to template/src/utils/use-snackbar.js