From aa555c5ccce11b7064035cacc7675535900d9ebb Mon Sep 17 00:00:00 2001 From: Chocolate1999 <2816778271@qq.com> Date: Mon, 12 Sep 2022 15:33:42 +0800 Subject: [PATCH] fix: fix vercel build error --- package.json | 4 +- src/pages/dev/[pw].tsx | 104 ----------------------------------------- yarn.lock | 20 ++++++-- 3 files changed, 19 insertions(+), 109 deletions(-) delete mode 100644 src/pages/dev/[pw].tsx diff --git a/package.json b/package.json index 49684ca..6b93407 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "lodash": "^4.17.21", "next": "^12.2.3", "next-themes": "^0.2.0", + "preact": "^10.10.6", "react": "^18.2.0", "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", @@ -51,8 +52,9 @@ "@testing-library/react": "^13.3.0", "@types/lodash": "^4.14.182", "@types/nprogress": "^0.2.0", - "@types/react": "^18.0.15", + "@types/react": "^18.0.19", "@types/react-copy-to-clipboard": "^5.0.4", + "@types/react-dom": "^18.0.6", "@types/umami": "^0.1.0", "@typescript-eslint/eslint-plugin": "^5.30.7", "@typescript-eslint/parser": "^5.30.7", diff --git a/src/pages/dev/[pw].tsx b/src/pages/dev/[pw].tsx deleted file mode 100644 index 3d7f9dd..0000000 --- a/src/pages/dev/[pw].tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { GetStaticPaths, GetStaticProps } from 'next'; -import * as React from 'react'; - -import { getFromLocalStorage } from '@/lib/helper'; - -import Accent from '@/components/Accent'; -import Button from '@/components/buttons/Button'; -import Layout from '@/components/layout/Layout'; -import Seo from '@/components/Seo'; - -export default function UmamiPage() { - const [, setRerender] = React.useState(false); - function forceRerender() { - setRerender((t) => !t); - } - - function addUmami() { - forceRerender(); - if (typeof localStorage !== 'undefined') { - return localStorage.setItem('umami.disabled', 'true'); - } - return null; - } - - function removeUmami() { - forceRerender(); - if (typeof localStorage !== 'undefined') { - return localStorage.removeItem('umami.disabled'); - } - return null; - } - - function addIncrement() { - forceRerender(); - if (typeof localStorage !== 'undefined') { - return localStorage.setItem('incrementMetaFlag', 'false'); - } - return null; - } - - function removeIncrement() { - forceRerender(); - if (typeof localStorage !== 'undefined') { - return localStorage.removeItem('incrementMetaFlag'); - } - return null; - } - - const umamiDisabled = getFromLocalStorage('umami.disabled') === 'true'; - const increaseViewDisabled = - getFromLocalStorage('incrementMetaFlag') === 'false'; - - return ( - - - -
-
-
-

Dev tools

-

- This is to block tracking. -

-
-

- Umami:{' '} - - {umamiDisabled ? 'Not Tracking' : 'Tracking'} - -

-

- View Count:{' '} - - {increaseViewDisabled ? 'Not Incrementing' : 'Incrementing'} - -

-
-
- - - - -
-
-
-
-
- ); -} - -export const getStaticPaths: GetStaticPaths = async () => { - return { - paths: [{ params: { pw: process.env.ADMIN_PASSWORD } }], - fallback: false, - }; -}; - -export const getStaticProps: GetStaticProps = async () => { - return { - props: {}, - }; -}; diff --git a/yarn.lock b/yarn.lock index 73290d3..8d64f05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2509,6 +2509,13 @@ dependencies: "@types/react" "*" +"@types/react-dom@^18.0.6": + version "18.0.6" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.6.tgz#36652900024842b74607a17786b6662dd1e103a1" + integrity sha512-/5OFZgfIPSwy+YuIBP/FgJnQnsxhZhjjrnxudMddeblOouIodEQ75X14Rr4wGSG/bknL+Omy9iWlLo1u/9GzAA== + dependencies: + "@types/react" "*" + "@types/react@*": version "18.0.6" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.6.tgz#30206c3830af6ce8639b91ace5868bc2d3d1d96c" @@ -2518,10 +2525,10 @@ "@types/scheduler" "*" csstype "^3.0.2" -"@types/react@^18.0.15": - version "18.0.15" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.15.tgz#d355644c26832dc27f3e6cbf0c4f4603fc4ab7fe" - integrity sha512-iz3BtLuIYH1uWdsv6wXYdhozhqj20oD4/Hk2DNXIn1kFsmp9x8d9QB6FnPhfkbhd2PgEONt9Q1x/ebkwjfFLow== +"@types/react@^18.0.19": + version "18.0.19" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.19.tgz#269a5f35b9a73c69dfb0c7189017013ab02acbaa" + integrity sha512-BDc3Q+4Q3zsn7k9xZrKfjWyJsSlEDMs38gD1qp2eDazLCdcPqAT+vq1ND+Z8AGel/UiwzNUk8ptpywgNQcJ1MQ== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -7498,6 +7505,11 @@ postcss@8.4.14, postcss@^8.4.14: picocolors "^1.0.0" source-map-js "^1.0.2" +preact@^10.10.6: + version "10.10.6" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.10.6.tgz#1fe62aecf93974b64e6a42e09ba1f00f93207d14" + integrity sha512-w0mCL5vICUAZrh1DuHEdOWBjxdO62lvcO++jbzr8UhhYcTbFkpegLH9XX+7MadjTl/y0feoqwQ/zAnzkc/EGog== + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"