fix: js 执行崩溃
Some checks failed
continuous-integration/drone/push Build is failing

- deps and types.
- use pnpm instead of npm.
- fix cpu 100%.
This commit is contained in:
Ivan Li 2022-10-08 22:45:31 +08:00
parent 85fa2ae57f
commit 2ed23c4327
9 changed files with 8033 additions and 55 deletions

View File

@ -1,16 +1,25 @@
{ {
"cSpell.words": [ "cSpell.words": [
"alpn", "alpn",
"appleboy",
"blackhole", "blackhole",
"BUTTONDOWN",
"Commento", "Commento",
"CONVERTKIT",
"Cusdis", "Cusdis",
"Disqus", "Disqus",
"dokodemo", "dokodemo",
"EMAILOCTOPUS",
"fullchain", "fullchain",
"Giscus", "Giscus",
"KLAVIYO",
"lastmod", "lastmod",
"MAILCHIMP",
"nextjs",
"outbounds", "outbounds",
"rprx", "rprx",
"unist",
"vfile",
"VLESS", "VLESS",
"vmess", "vmess",
"xtls" "xtls"

View File

@ -2,13 +2,15 @@ FROM node:16-alpine as base
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package-lock.json package.json ./ COPY package-lock.json package.json ./
RUN npm ci --no-audit --legacy-peer-deps RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7 &&\
pnpm i &&\
pnpm build
COPY . . COPY . .
FROM node:16-alpine as release FROM node:16-alpine as release
WORKDIR /app WORKDIR /app
COPY --from=base /app ./ COPY --from=base /app ./
RUN npm run build &&\ RUN pnpm build &&\
npm prune --omit dev --legacy-peer-deps pnpm prune --prod
EXPOSE 80 EXPOSE 80
CMD npm run serve -- --port 80 CMD pnpm serve -p 80

View File

@ -62,7 +62,7 @@ export async function getFileBySlug<T>(type: 'authors' | 'blog', slug: string |
source, source,
// mdx imports can be automatically source from the components directory // mdx imports can be automatically source from the components directory
cwd: path.join(root, 'components'), cwd: path.join(root, 'components'),
mdxOptions(options, frontmatter) { xdmOptions(options, frontmatter) {
// this is the recommended way to add custom remark/rehype plugins: // this is the recommended way to add custom remark/rehype plugins:
// The syntax might look weird, but it protects you in case we add/remove // The syntax might look weird, but it protects you in case we add/remove
// plugins in the future. // plugins in the future.

View File

@ -1,5 +1,4 @@
import { Parent } from 'unist' import { visit, Parent } from 'unist-util-visit'
import { visit } from 'unist-util-visit'
export default function remarkCodeTitles() { export default function remarkCodeTitles() {
return (tree: Parent & { lang?: string }) => return (tree: Parent & { lang?: string }) =>

View File

@ -1,6 +1,5 @@
import { Parent } from 'unist'
import { VFile } from 'vfile' import { VFile } from 'vfile'
import { visit } from 'unist-util-visit' import { visit, Parent } from 'unist-util-visit'
import { load } from 'js-yaml' import { load } from 'js-yaml'
export default function extractFrontmatter() { export default function extractFrontmatter() {

View File

@ -1,5 +1,5 @@
import { Parent, Node, Literal } from 'unist' import { Literal } from 'unist'
import { visit } from 'unist-util-visit' import { visit, Parent, Node } from 'unist-util-visit'
import sizeOf from 'image-size' import sizeOf from 'image-size'
import fs from 'fs' import fs from 'fs'

BIN
package-lock.json generated

Binary file not shown.

View File

@ -12,63 +12,66 @@
"prepare": "husky install" "prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@fontsource/inter": "4.5.13", "@fontsource/inter": "4.5.2",
"@mailchimp/mailchimp_marketing": "^3.0.78", "@mailchimp/mailchimp_marketing": "^3.0.58",
"@next/bundle-analyzer": "12.3.1", "@next/bundle-analyzer": "12.0.9",
"@tailwindcss/forms": "^0.5.3", "@tailwindcss/forms": "^0.4.0",
"@tailwindcss/typography": "^0.5.7", "@tailwindcss/typography": "^0.5.0",
"autoprefixer": "^10.4.12", "autoprefixer": "^10.4.0",
"esbuild": "^0.14.0", "esbuild": "^0.13.13",
"github-slugger": "^1.4.0", "github-slugger": "^1.3.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.2",
"image-size": "1.0.2", "image-size": "1.0.0",
"mdx-bundler": "^9.0.1", "js-yaml": "^4.1.0",
"next": "12.3.1", "mdx-bundler": "^8.0.0",
"next-themes": "^0.2.1", "next": "^12.2.0",
"postcss": "^8.4.17", "next-themes": "^0.0.14",
"preact": "^10.11.1", "postcss": "^8.4.5",
"react": "18.2.0", "preact": "^10.6.2",
"react": "17.0.2",
"react-commento": "^1.0.0", "react-commento": "^1.0.0",
"react-cusdis": "^2.1.3", "react-cusdis": "^2.1.3",
"react-dom": "18.2.0", "react-dom": "17.0.2",
"reading-time": "1.5.0", "reading-time": "1.3.0",
"rehype-autolink-headings": "^6.1.1", "rehype-autolink-headings": "^6.1.0",
"rehype-citation": "^0.4.0", "rehype-citation": "^0.2.0",
"rehype-katex": "^6.0.2", "rehype-katex": "^6.0.2",
"rehype-preset-minify": "6.0.0", "rehype-preset-minify": "6.0.0",
"rehype-prism-plus": "^1.5.0", "rehype-prism-plus": "^1.1.3",
"rehype-slug": "^5.0.1", "rehype-slug": "^5.0.0",
"remark-footnotes": "^4.0.1", "remark-footnotes": "^4.0.1",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"remark-math": "^5.1.1", "remark-math": "^5.1.1",
"sharp": "^0.31.1", "sharp": "^0.28.3",
"smoothscroll-polyfill": "^0.4.4", "smoothscroll-polyfill": "^0.4.4",
"tailwindcss": "^3.1.8", "tailwindcss": "^3.0.18",
"unist-util-visit": "^4.1.1" "unist-util-visit": "^4.0.0",
"vfile": "^5.3.5"
}, },
"devDependencies": { "devDependencies": {
"@svgr/webpack": "^6.4.0", "@svgr/webpack": "^6.1.2",
"@types/react": "^18.0.21", "@types/react": "^17.0.50",
"@types/tailwindcss": "^3.0.11", "@types/tailwindcss": "^2.2.0",
"@typescript-eslint/eslint-plugin": "^5.39.0", "@types/unist": "^2.0.6",
"@typescript-eslint/parser": "^5.39.0", "@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"eslint": "^8.24.0", "eslint": "^7.29.0",
"eslint-config-next": "12.3.1", "eslint-config-next": "12.0.9",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^3.3.1",
"file-loader": "^6.2.0", "file-loader": "^6.0.0",
"globby": "11.0.3", "globby": "11.0.3",
"husky": "^8.0.1", "husky": "^6.0.0",
"inquirer": "^9.1.3", "inquirer": "^8.1.1",
"lint-staged": "^13.0.3", "lint-staged": "^11.0.0",
"next-remote-watch": "^2.0.0", "next-remote-watch": "^1.0.0",
"prettier": "^2.7.1", "prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.13", "prettier-plugin-tailwindcss": "^0.1.4",
"socket.io": "^4.5.2", "socket.io": "^4.4.0",
"socket.io-client": "^4.5.2", "socket.io-client": "^4.4.0",
"typescript": "^4.8.4" "typescript": "^4.6.1-rc"
}, },
"lint-staged": { "lint-staged": {
"*.+(js|jsx|ts|tsx)": [ "*.+(js|jsx|ts|tsx)": [

7966
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff