diff --git a/.eslintignore b/.eslintignore index cb14493c..06f9f9ee 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ next-env.d.ts - +shims-env.d.ts ecosystem.config.js \ No newline at end of file diff --git a/next-env.d.ts b/next-env.d.ts index 7cd97de9..c6643fda 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,86 +1,3 @@ /// /// - -declare module '*.bmp' { - const src: string - export default src -} - -declare module '*.gif' { - const src: string - export default src -} - -declare module '*.jpg' { - const src: string - export default src -} - -declare module '*.jpeg' { - const src: string - export default src -} - -declare module '*.png' { - const src: string - export default src -} - -declare module '*.svg' { - import { SFC, SVGProps } from 'react' - - export const ReactComponent: SFC> - - const src: string - export default src -} - -declare module '*.cur' { - const src: string - export default src -} - -declare module 'aplayer' { - interface Audio { - name: string - url: string - cover: string - lrc: string - } - interface Props { - container: HTMLElement - lrcType: number - fixed: boolean - audio: Audio[] - } - class APlayer { - constructor({ container, lrcType, fixed, audio }: Props) {} - public lrc: { show: Function } - } - - export default APlayer -} - -interface Window { - ga: Function - GA_INITIALIZED: boolean -} - -declare namespace NodeJS { - export interface ProcessEnv { - NEXT_PUBLIC_API_URL: string - NEXT_PUBLIC_DOMAIN_URL: string - NEXT_PUBLIC_STATIC_FILE_URL: string - NEXT_PUBLIC_GA_KEY: string - NEXT_PUBLIC_SENTRY_DSN: string - NEXT_PUBLIC_HOTJAR_ID: string - NEXT_PUBLIC_HOTJAR_SV: string - NEXT_PUBLIC_DISCUSSION_KEY: string - NEXT_PUBLIC_ALGOLIA_SEARCH_APP_ID: string - NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: string - NEXT_PUBLIC_ALGOLIA_SEARCH_INDEX_NAME: string - } -} - -declare const __YANCEY_BLOG_VERSION__: string -declare const __GIT_HASH__: string +/// diff --git a/next.config.js b/next.config.js index cbed51f5..90e9afaf 100644 --- a/next.config.js +++ b/next.config.js @@ -1,30 +1,22 @@ -const withSourceMaps = require('@zeit/next-source-maps') const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }) module.exports = (phase, { defaultConfig }) => - withBundleAnalyzer( - withSourceMaps({ - compress: true, - pageExtensions: ['mdx', 'jsx', 'js', 'ts', 'tsx'], - future: { - webpack5: true, - }, - webpack: ( - config, - { buildId, dev, isServer, defaultLoaders, webpack }, - ) => { - config.module.rules.push({ - test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.webp$/, /\.cur$/], - use: [ - { - loader: 'url-loader', - }, - ], - }) + withBundleAnalyzer({ + compress: true, + pageExtensions: ['mdx', 'jsx', 'js', 'ts', 'tsx'], + productionBrowserSourceMaps: true, + webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { + config.module.rules.push({ + test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.webp$/, /\.cur$/], + use: [ + { + loader: 'url-loader', + }, + ], + }) - return config - }, - }), - ) + return config + }, + }) diff --git a/package.json b/package.json index cd60638f..61e2cab5 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "license": "MIT", "scripts": { "dev": "next", - "build": "next build", "start": "next start", + "build": "next build", "analyze": "ANALYZE=true yarn build", "commit": "npx git-cz", "push": "git push --follow-tags origin master", @@ -21,13 +21,12 @@ "sitemap": "node scripts/createSiteMap" }, "dependencies": { - "@apollo/client": "^3.3.19", + "@apollo/client": "^3.3.20", "@material-ui/core": "^4.11.4", "@material-ui/lab": "^4.0.0-alpha.57", - "@sentry/browser": "^6.2.3", - "@sentry/tracing": "^6.2.3", - "@zeit/next-source-maps": "^0.0.3", - "algoliasearch": "^4.8.6", + "@sentry/browser": "^6.7.2", + "@sentry/tracing": "^6.7.1", + "algoliasearch": "^4.9.3", "aplayer": "^1.10.1", "disqus-react": "^1.0.9", "graphql": "^15.5.0", @@ -35,8 +34,8 @@ "lodash.orderby": "^4.6.0", "lodash.throttle": "^4.1.1", "luxon": "^1.27.0", - "next": "^10.2.0", - "next-with-apollo": "^5.1.0", + "next": "^11.0.1", + "next-with-apollo": "^5.2.1", "normalize.css": "^8.0.1", "notistack": "^1.0.9", "nprogress": "^0.2.0", @@ -47,31 +46,29 @@ "react-hotjar": "^2.2.1", "react-instantsearch-core": "^6.11.0", "react-instantsearch-dom": "^6.11.0", - "react-lazyload": "^3.2.0", "react-markdown": "^6.0.2", "react-progressive-graceful-image": "^0.6.13", "react-share": "^4.4.0", "react-syntax-highlighter": "^15.4.3", "remark-gfm": "^1.0.0", - "sitemap": "^6.3.5", - "styled-components": "^5.0.1", + "sitemap": "^7.0.0", + "styled-components": "^5.3.0", "tocbot": "^4.12.3", "yancey-js-util": "^3.0.0" }, "devDependencies": { - "@babel/runtime": "^7.13.6", - "@commitlint/cli": "^12.1.1", - "@commitlint/config-conventional": "^12.0.1", - "@next/bundle-analyzer": "^10.2.0", + "@babel/runtime": "^7.14.5", + "@commitlint/cli": "^12.1.4", + "@commitlint/config-conventional": "^12.1.4", + "@next/bundle-analyzer": "^10.2.3", "@types/lodash.orderby": "^4.6.6", "@types/lodash.throttle": "^4.1.6", - "@types/luxon": "^1.26.0", - "@types/markdown-to-jsx": "^6.11.3", - "@types/node": "^14.14.35", + "@types/luxon": "^1.27.0", + "@types/node": "^15.12.2", "@types/nprogress": "^0.2.0", "@types/react": "^17.0.8", - "@types/react-instantsearch-dom": "^6.3.0", - "@types/react-syntax-highlighter": "^13.5.0", + "@types/react-instantsearch-dom": "^6.10.0", + "@types/react-syntax-highlighter": "^13.5.1", "@types/styled-components": "^5.1.7", "@typescript-eslint/eslint-plugin": "^4.26.0", "babel-plugin-styled-components": "^1.12.0", @@ -79,11 +76,12 @@ "cz-conventional-changelog": "^3.3.0", "eslint": "^7.22.0", "eslint-config-airbnb-typescript": "^11.4.0", - "eslint-config-prettier": "^8.1.0", - "eslint-plugin-import": "^2.22.1", + "eslint-config-next": "^11.0.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.23.4", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", "husky": "^4.3.6", "lint-staged": "^10.5.3", @@ -95,7 +93,7 @@ "stylelint-processor-styled-components": "^1.10.0", "typescript": "^4.3.2", "url-loader": "^4.1.1", - "webpack": "^5.20.2" + "webpack": "^5.38.1" }, "config": { "commitizen": { diff --git a/src/static/images/dot.png b/public/images/dot.png similarity index 100% rename from src/static/images/dot.png rename to public/images/dot.png diff --git a/src/static/images/normal.cur b/public/images/normal.cur similarity index 100% rename from src/static/images/normal.cur rename to public/images/normal.cur diff --git a/shims-env.d.ts b/shims-env.d.ts new file mode 100644 index 00000000..f69fcef0 --- /dev/null +++ b/shims-env.d.ts @@ -0,0 +1,83 @@ +declare module '*.bmp' { + const src: string + export default src +} + +declare module '*.gif' { + const src: string + export default src +} + +declare module '*.jpg' { + const src: string + export default src +} + +declare module '*.jpeg' { + const src: string + export default src +} + +declare module '*.png' { + const src: string + export default src +} + +declare module '*.svg' { + import { SFC, SVGProps } from 'react' + + export const ReactComponent: SFC> + + const src: string + export default src +} + +declare module '*.cur' { + const src: string + export default src +} + +declare module 'aplayer' { + interface Audio { + name: string + url: string + cover: string + lrc: string + } + interface Props { + container: HTMLElement + lrcType: number + fixed: boolean + audio: Audio[] + } + class APlayer { + constructor({ container, lrcType, fixed, audio }: Props) {} + public lrc: { show: Function } + } + + export default APlayer +} + +interface Window { + ga: Function + GA_INITIALIZED: boolean +} + +declare namespace NodeJS { + export interface ProcessEnv { + NEXT_PUBLIC_API_URL: string + NEXT_PUBLIC_DOMAIN_URL: string + NEXT_PUBLIC_STATIC_FILE_URL: string + NEXT_PUBLIC_GA_KEY: string + NEXT_PUBLIC_SENTRY_DSN: string + NEXT_PUBLIC_HOTJAR_ID: string + NEXT_PUBLIC_HOTJAR_SV: string + NEXT_PUBLIC_DISCUSSION_KEY: string + NEXT_PUBLIC_ALGOLIA_SEARCH_APP_ID: string + NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: string + NEXT_PUBLIC_ALGOLIA_SEARCH_INDEX_NAME: string + } +} + +declare const __YANCEY_BLOG_VERSION__: string +declare const __GIT_HASH__: string diff --git a/src/containers/Archive/Archive.tsx b/src/containers/Archive/Archive.tsx index 8d19db36..440ff6f2 100644 --- a/src/containers/Archive/Archive.tsx +++ b/src/containers/Archive/Archive.tsx @@ -66,7 +66,7 @@ const Archive: FC = () => { {DateTime.fromISO(day.createdAt).day} {': '} - + {day.title} ({day.pv} PV ) diff --git a/src/containers/Home/components/Cover.tsx b/src/containers/Home/components/Cover.tsx index c4ea154e..ab4a1395 100644 --- a/src/containers/Home/components/Cover.tsx +++ b/src/containers/Home/components/Cover.tsx @@ -1,7 +1,6 @@ import { FC } from 'react' import styled from 'styled-components' import LazyLoadImage from 'src/components/LazyLoadImage/LazyLoadImage' -import dot from 'src/static/images/dot.png' import { ICover } from '../types' @@ -18,9 +17,8 @@ const Covers = styled.figure` height: 100%; top: 0; left: 0; - background-image: url(${dot}); + background-image: url('images/dot.png'); background-repeat: repeat; - background-attachment: scroll; opacity: 0.5; } ` diff --git a/src/containers/Layout/components/Footer/Footer.tsx b/src/containers/Layout/components/Footer/Footer.tsx index e4754a74..acfdfb78 100644 --- a/src/containers/Layout/components/Footer/Footer.tsx +++ b/src/containers/Layout/components/Footer/Footer.tsx @@ -35,7 +35,7 @@ const Footer: FC = ({ globalSetting }) => { affiliates.