Browse Source

Merge pull request #54 from Mochocyang/ci/silence-gha-warnings

ci: 消除 Node 20 与 Homebrew tap warning
darknessomi 1 month ago
parent
commit
37273e389f
5 changed files with 15 additions and 91 deletions
  1. 7 7
      .github/workflows/build.yml
  2. 5 3
      .github/workflows/ci.yml
  3. 2 67
      package-lock.json
  4. 0 1
      package.json
  5. 1 13
      src/components/editor/wiki-editor.tsx

+ 7 - 7
.github/workflows/build.yml

@@ -59,7 +59,7 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v4
+        uses: actions/checkout@v5
 
       - name: Install Rust stable
         if: matrix.rust_targets == ''
@@ -78,13 +78,13 @@ jobs:
 
       - name: Install macOS dependencies
         if: runner.os == 'macOS'
-        run: brew install protobuf
+        run: |
+          brew untap aws/tap || true
+          brew install protobuf
 
       - name: Install Windows dependencies
         if: runner.os == 'Windows'
-        uses: arduino/setup-protoc@v3
-        with:
-          repo-token: ${{ secrets.GITHUB_TOKEN }}
+        run: choco install protoc -y
 
       - name: Install Linux dependencies
         if: runner.os == 'Linux'
@@ -93,7 +93,7 @@ jobs:
           sudo apt-get install -y libwebkit2gtk-4.1-dev librsvg2-dev patchelf protobuf-compiler libgtk-3-dev libayatana-appindicator3-dev
 
       - name: Setup Node.js
-        uses: actions/setup-node@v4
+        uses: actions/setup-node@v5
         with:
           node-version: 24
           cache: npm
@@ -268,7 +268,7 @@ jobs:
 
       - name: Upload bundles as workflow artifacts
         if: failure()
-        uses: actions/upload-artifact@v4
+        uses: actions/upload-artifact@v6
         with:
           name: qmai-${{ matrix.label }}
           path: ${{ matrix.artifact_globs }}

+ 5 - 3
.github/workflows/ci.yml

@@ -20,14 +20,16 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v4
+        uses: actions/checkout@v5
 
       - name: Install Rust stable
         uses: dtolnay/rust-toolchain@stable
 
       - name: Install protoc (macOS)
         if: matrix.platform == 'macos-latest'
-        run: brew install protobuf
+        run: |
+          brew untap aws/tap || true
+          brew install protobuf
 
       - name: Install dependencies (Ubuntu)
         if: matrix.platform == 'ubuntu-22.04'
@@ -45,7 +47,7 @@ jobs:
           workspaces: src-tauri
 
       - name: Setup Node.js
-        uses: actions/setup-node@v4
+        uses: actions/setup-node@v5
         with:
           node-version: 24
 

+ 2 - 67
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "qmai",
-  "version": "3.1.5",
+  "version": "3.2.0",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "qmai",
-      "version": "3.1.5",
+      "version": "3.2.0",
       "license": "GPL-3.0-or-later",
       "dependencies": {
         "@base-ui/react": "^1.7.0",
@@ -15,7 +15,6 @@
         "@dnd-kit/utilities": "^3.2.2",
         "@fontsource-variable/geist": "^5.3.0",
         "@milkdown/kit": "^7.22.0",
-        "@milkdown/plugin-math": "^7.5.9",
         "@milkdown/react": "^7.22.0",
         "@milkdown/theme-nord": "^7.22.0",
         "@react-sigma/core": "^5.0.6",
@@ -1979,70 +1978,6 @@
         "lodash-es": "^4.17.21"
       }
     },
-    "node_modules/@milkdown/plugin-math": {
-      "version": "7.5.9",
-      "resolved": "https://registry.npmjs.org/@milkdown/plugin-math/-/plugin-math-7.5.9.tgz",
-      "integrity": "sha512-LzFZKNc7zm3uOTs9mEN/12/X+UdGoyQRp5Gt9GE7lPJ96jOZaGJD0vMtX0mTauTOmUxDQoQS0I7NW1g9UhC6qQ==",
-      "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
-      "license": "MIT",
-      "dependencies": {
-        "@milkdown/exception": "7.5.9",
-        "@milkdown/utils": "7.5.9",
-        "@types/katex": "^0.16.0",
-        "katex": "^0.16.0",
-        "remark-math": "^6.0.0",
-        "tslib": "^2.5.0"
-      },
-      "peerDependencies": {
-        "@milkdown/core": "^7.2.0",
-        "@milkdown/ctx": "^7.2.0",
-        "@milkdown/prose": "^7.2.0"
-      }
-    },
-    "node_modules/@milkdown/plugin-math/node_modules/@milkdown/exception": {
-      "version": "7.5.9",
-      "resolved": "https://registry.npmjs.org/@milkdown/exception/-/exception-7.5.9.tgz",
-      "integrity": "sha512-9g+WpiRjgLsVlHt7DotlUmKK9oT6Lsr5TgxE0NdDvtr81CC43mgNtoekI6rg/PatEBBXifDK1GJJ4LKnRSseVQ==",
-      "license": "MIT",
-      "dependencies": {
-        "tslib": "^2.5.0"
-      }
-    },
-    "node_modules/@milkdown/plugin-math/node_modules/@milkdown/utils": {
-      "version": "7.5.9",
-      "resolved": "https://registry.npmjs.org/@milkdown/utils/-/utils-7.5.9.tgz",
-      "integrity": "sha512-udxaIdKm6pOiNACIKR7+NQ7Vj+QivhA5jcRqksEuQOfDFQBFcGaAhGEEiU1cKwE7fmP2ayigfD0IZ01rjLS2fA==",
-      "license": "MIT",
-      "dependencies": {
-        "@milkdown/exception": "7.5.9",
-        "nanoid": "^5.0.0",
-        "tslib": "^2.5.0"
-      },
-      "peerDependencies": {
-        "@milkdown/core": "^7.2.0",
-        "@milkdown/ctx": "^7.2.0",
-        "@milkdown/prose": "^7.2.0",
-        "@milkdown/transformer": "^7.2.0"
-      }
-    },
-    "node_modules/@milkdown/plugin-math/node_modules/nanoid": {
-      "version": "5.1.16",
-      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.16.tgz",
-      "integrity": "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/ai"
-        }
-      ],
-      "license": "MIT",
-      "bin": {
-        "nanoid": "bin/nanoid.js"
-      },
-      "engines": {
-        "node": "^18 || >=20"
-      }
-    },
     "node_modules/@milkdown/plugin-slash": {
       "version": "7.22.0",
       "resolved": "https://registry.npmjs.org/@milkdown/plugin-slash/-/plugin-slash-7.22.0.tgz",

+ 0 - 1
package.json

@@ -24,7 +24,6 @@
     "@dnd-kit/utilities": "^3.2.2",
     "@fontsource-variable/geist": "^5.3.0",
     "@milkdown/kit": "^7.22.0",
-    "@milkdown/plugin-math": "^7.5.9",
     "@milkdown/react": "^7.22.0",
     "@milkdown/theme-nord": "^7.22.0",
     "@react-sigma/core": "^5.0.6",

+ 1 - 13
src/components/editor/wiki-editor.tsx

@@ -12,11 +12,9 @@ import { commonmark } from "@milkdown/kit/preset/commonmark";
 import { gfm } from "@milkdown/kit/preset/gfm";
 import { history } from "@milkdown/kit/plugin/history";
 import { listener, listenerCtx } from "@milkdown/kit/plugin/listener";
-import { math } from "@milkdown/plugin-math";
 import { nord } from "@milkdown/theme-nord";
 import { Milkdown, MilkdownProvider, useEditor } from "@milkdown/react";
 import "@milkdown/theme-nord/style.css";
-import "katex/dist/katex.min.css";
 import { Pencil, Eye } from "lucide-react";
 import { formatChapterWriting } from "@/lib/chapter-formatting";
 import { parseFrontmatter } from "@/lib/frontmatter";
@@ -569,7 +567,6 @@ function WikiEditorInner({ content, onSave }: WikiEditorInnerProps) {
         })
         .use(commonmark)
         .use(gfm)
-        .use(math)
         .use(history)
         .use(listener),
     [],
@@ -597,13 +594,6 @@ export interface WikiEditorHandle {
   setImmersiveScrollTop: (scrollTop: number) => void;
 }
 
-function wrapBareMathBlocks(text: string): string {
-  return text.replace(
-    /(?<!\$\$\s*)(\\begin\{[^}]+\}[\s\S]*?\\end\{[^}]+\})(?!\s*\$\$)/g,
-    (_match, block: string) => `$$\n${block}\n$$`,
-  );
-}
-
 export const WikiEditor = forwardRef<WikiEditorHandle, WikiEditorProps>(
   function WikiEditor(
     {
@@ -643,8 +633,6 @@ export const WikiEditor = forwardRef<WikiEditorHandle, WikiEditorProps>(
       [content],
     );
 
-    const processedBody = useMemo(() => wrapBareMathBlocks(body), [body]);
-
     const handleSave = useMemo(
       () => (markdown: string) => onSave(rawBlock + markdown),
       [onSave, rawBlock],
@@ -749,7 +737,7 @@ export const WikiEditor = forwardRef<WikiEditorHandle, WikiEditorProps>(
               {!immersiveWriting && frontmatter && (
                 <FrontmatterPanel data={frontmatter} />
               )}
-              <WikiEditorInner content={processedBody} onSave={handleSave} />
+              <WikiEditorInner content={body} onSave={handleSave} />
             </div>
           </MilkdownProvider>
         )}