From 99ee8b94465f6af1949f6c4af609d45506238029 Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 22:21:23 +0800 Subject: [PATCH 01/10] :arrow_up: Upgrade dependencies --- package.json | 12 +- yarn.lock | 400 ++++++++++++++++++++++++++------------------------- 2 files changed, 209 insertions(+), 203 deletions(-) diff --git a/package.json b/package.json index 3c89aae..328dd8e 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,9 @@ "typecheck": "tsc" }, "dependencies": { - "@docusaurus/core": "^3.1.1", - "@docusaurus/plugin-google-gtag": "^3.1.1", - "@docusaurus/preset-classic": "^3.1.1", + "@docusaurus/core": "^3.5.2", + "@docusaurus/plugin-google-gtag": "^3.5.2", + "@docusaurus/preset-classic": "^3.5.2", "@easyops-cn/docusaurus-search-local": "^0.33.6", "@giscus/react": "^2.2.8", "@mdx-js/react": "^3.0.0", @@ -40,11 +40,13 @@ "typeit-react": "^2.7.1" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.1.1", + "@docusaurus/module-type-aliases": "^3.5.2", + "@docusaurus/tsconfig": "^3.5.2", + "@docusaurus/types": "^3.5.2", "@tsconfig/docusaurus": "^1.0.5", "sass": "^1.59.2", "sass-loader": "^13.2.0", - "typescript": "^4.7.4" + "typescript": "^5.6.2" }, "browserslist": { "production": [ diff --git a/yarn.lock b/yarn.lock index 68f021b..f533279 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1363,10 +1363,10 @@ webpack-merge "^5.8.0" webpackbar "^5.0.2" -"@docusaurus/core@3.4.0", "@docusaurus/core@^3.1.1": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-3.4.0.tgz#bdbf1af4b2f25d1bf4a5b62ec6137d84c821cb3c" - integrity sha512-g+0wwmN2UJsBqy2fQRQ6fhXruoEa62JDeEa5d8IdTJlMoaDaEDfHh7WjwGRn4opuTQWpjAwP/fbcgyHKlE+64w== +"@docusaurus/core@3.5.2", "@docusaurus/core@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-3.5.2.tgz#3adedb90e7b6104592f1231043bd6bf91680c39c" + integrity sha512-4Z1WkhCSkX4KO0Fw5m/Vuc7Q3NxBG53NE5u59Rs96fWkMPZVSrzEPP16/Nk6cWb/shK7xXPndTmalJtw7twL/w== dependencies: "@babel/core" "^7.23.3" "@babel/generator" "^7.23.3" @@ -1378,12 +1378,12 @@ "@babel/runtime" "^7.22.6" "@babel/runtime-corejs3" "^7.22.6" "@babel/traverse" "^7.22.8" - "@docusaurus/cssnano-preset" "3.4.0" - "@docusaurus/logger" "3.4.0" - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/cssnano-preset" "3.5.2" + "@docusaurus/logger" "3.5.2" + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" autoprefixer "^10.4.14" babel-loader "^9.1.3" babel-plugin-dynamic-import-node "^2.3.3" @@ -1447,10 +1447,10 @@ postcss-sort-media-queries "^4.2.1" tslib "^2.4.0" -"@docusaurus/cssnano-preset@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-3.4.0.tgz#dc7922b3bbeabcefc9b60d0161680d81cf72c368" - integrity sha512-qwLFSz6v/pZHy/UP32IrprmH5ORce86BGtN0eBtG75PpzQJAzp9gefspox+s8IEOr0oZKuQ/nhzZ3xwyc3jYJQ== +"@docusaurus/cssnano-preset@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-3.5.2.tgz#6c1f2b2f9656f978c4694c84ab24592b04dcfab3" + integrity sha512-D3KiQXOMA8+O0tqORBrTOEQyQxNIfPm9jEaJoALjjSjc2M/ZAWcUfPQEnwr2JB2TadHw2gqWgpZckQmrVWkytA== dependencies: cssnano-preset-advanced "^6.1.2" postcss "^8.4.38" @@ -1465,10 +1465,10 @@ chalk "^4.1.2" tslib "^2.4.0" -"@docusaurus/logger@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-3.4.0.tgz#8b0ac05c7f3dac2009066e2f964dee8209a77403" - integrity sha512-bZwkX+9SJ8lB9kVRkXw+xvHYSMGG4bpYHKGXeXFvyVc79NMeeBSGgzd4TQLHH+DYeOJoCdl8flrFJVxlZ0wo/Q== +"@docusaurus/logger@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-3.5.2.tgz#1150339ad56844b30734115c19c580f3b25cf5ed" + integrity sha512-LHC540SGkeLfyT3RHK3gAMK6aS5TRqOD4R72BEU/DE2M/TY8WwEUAMY576UUc/oNJXv8pGhBmQB6N9p3pt8LQw== dependencies: chalk "^4.1.2" tslib "^2.6.0" @@ -1496,14 +1496,14 @@ url-loader "^4.1.1" webpack "^5.73.0" -"@docusaurus/mdx-loader@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-3.4.0.tgz#483d7ab57928fdbb5c8bd1678098721a930fc5f6" - integrity sha512-kSSbrrk4nTjf4d+wtBA9H+FGauf2gCax89kV8SUSJu3qaTdSIKdWERlngsiHaCFgZ7laTJ8a67UFf+xlFPtuTw== +"@docusaurus/mdx-loader@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-3.5.2.tgz#99781641372c5037bcbe09bb8ade93a0e0ada57d" + integrity sha512-ku3xO9vZdwpiMIVd8BzWV0DCqGEbCP5zs1iHfKX50vw6jX8vQo0ylYo1YJMZyz6e+JFJ17HYHT5FzVidz2IflA== dependencies: - "@docusaurus/logger" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/logger" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" "@mdx-js/mdx" "^3.0.0" "@slorber/remark-comment" "^1.0.0" escape-html "^1.0.3" @@ -1540,12 +1540,12 @@ react-helmet-async "*" react-loadable "npm:@docusaurus/react-loadable@5.5.2" -"@docusaurus/module-type-aliases@3.4.0", "@docusaurus/module-type-aliases@^3.1.1": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-3.4.0.tgz#2653bde58fc1aa3dbc626a6c08cfb63a37ae1bb8" - integrity sha512-A1AyS8WF5Bkjnb8s+guTDuYmUiwJzNrtchebBHpc0gz0PyHJNMaybUlSrmJjHVcGrya0LKI4YcR3lBDQfXRYLw== +"@docusaurus/module-type-aliases@3.5.2", "@docusaurus/module-type-aliases@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-3.5.2.tgz#4e8f9c0703e23b2e07ebfce96598ec83e4dd2a9e" + integrity sha512-Z+Xu3+2rvKef/YKTMxZHsEXp1y92ac0ngjDiExRdqGTmEKtCUpkbNYH8v5eXo5Ls+dnW88n6WTa+Q54kLOkwPg== dependencies: - "@docusaurus/types" "3.4.0" + "@docusaurus/types" "3.5.2" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1553,19 +1553,20 @@ react-helmet-async "*" react-loadable "npm:@docusaurus/react-loadable@6.0.0" -"@docusaurus/plugin-content-blog@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.4.0.tgz#6373632fdbababbda73a13c4a08f907d7de8f007" - integrity sha512-vv6ZAj78ibR5Jh7XBUT4ndIjmlAxkijM3Sx5MAAzC1gyv0vupDQNhzuFg1USQmQVj3P5I6bquk12etPV3LJ+Xw== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/logger" "3.4.0" - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" - cheerio "^1.0.0-rc.12" +"@docusaurus/plugin-content-blog@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.5.2.tgz#649c07c34da7603645f152bcebdf75285baed16b" + integrity sha512-R7ghWnMvjSf+aeNDH0K4fjyQnt5L0KzUEnUhmf1e3jZrv3wogeytZNN6n7X8yHcMsuZHPOrctQhXWnmxu+IRRg== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/logger" "3.5.2" + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/theme-common" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" + cheerio "1.0.0-rc.12" feed "^4.2.2" fs-extra "^11.1.1" lodash "^4.17.21" @@ -1576,19 +1577,20 @@ utility-types "^3.10.0" webpack "^5.88.1" -"@docusaurus/plugin-content-docs@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.4.0.tgz#3088973f72169a2a6d533afccec7153c8720d332" - integrity sha512-HkUCZffhBo7ocYheD9oZvMcDloRnGhBMOZRyVcAQRFmZPmNqSyISlXA1tQCIxW+r478fty97XXAGjNYzBjpCsg== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/logger" "3.4.0" - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/module-type-aliases" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" +"@docusaurus/plugin-content-docs@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-3.5.2.tgz#adcf6c0bd9a9818eb192ab831e0069ee62d31505" + integrity sha512-Bt+OXn/CPtVqM3Di44vHjE7rPCEsRCB/DMo2qoOuozB9f7+lsdrHvD0QCHdBs0uhz6deYJDppAr2VgqybKPlVQ== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/logger" "3.5.2" + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/module-type-aliases" "3.5.2" + "@docusaurus/theme-common" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" "@types/react-router-config" "^5.0.7" combine-promises "^1.1.0" fs-extra "^11.1.1" @@ -1620,96 +1622,96 @@ utility-types "^3.10.0" webpack "^5.73.0" -"@docusaurus/plugin-content-pages@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.4.0.tgz#1846172ca0355c7d32a67ef8377750ce02bbb8ad" - integrity sha512-h2+VN/0JjpR8fIkDEAoadNjfR3oLzB+v1qSXbIAKjQ46JAHx3X22n9nqS+BWSQnTnp1AjkjSvZyJMekmcwxzxg== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" +"@docusaurus/plugin-content-pages@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-3.5.2.tgz#2b59e43f5bc5b5176ff01835de706f1c65c2e68b" + integrity sha512-WzhHjNpoQAUz/ueO10cnundRz+VUtkjFhhaQ9jApyv1a46FPURO4cef89pyNIOMny1fjDz/NUN2z6Yi+5WUrCw== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" fs-extra "^11.1.1" tslib "^2.6.0" webpack "^5.88.1" -"@docusaurus/plugin-debug@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-3.4.0.tgz#74e4ec5686fa314c26f3ac150bacadbba7f06948" - integrity sha512-uV7FDUNXGyDSD3PwUaf5YijX91T5/H9SX4ErEcshzwgzWwBtK37nUWPU3ZLJfeTavX3fycTOqk9TglpOLaWkCg== +"@docusaurus/plugin-debug@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-3.5.2.tgz#c25ca6a59e62a17c797b367173fe80c06fdf2f65" + integrity sha512-kBK6GlN0itCkrmHuCS6aX1wmoWc5wpd5KJlqQ1FyrF0cLDnvsYSnh7+ftdwzt7G6lGBho8lrVwkkL9/iQvaSOA== dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" + "@docusaurus/core" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" fs-extra "^11.1.1" react-json-view-lite "^1.2.0" tslib "^2.6.0" -"@docusaurus/plugin-google-analytics@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.4.0.tgz#5f59fc25329a59decc231936f6f9fb5663da3c55" - integrity sha512-mCArluxEGi3cmYHqsgpGGt3IyLCrFBxPsxNZ56Mpur0xSlInnIHoeLDH7FvVVcPJRPSQ9/MfRqLsainRw+BojA== +"@docusaurus/plugin-google-analytics@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-3.5.2.tgz#1143e78d1461d3c74a2746f036d25b18d4a2608d" + integrity sha512-rjEkJH/tJ8OXRE9bwhV2mb/WP93V441rD6XnM6MIluu7rk8qg38iSxS43ga2V2Q/2ib53PcqbDEJDG/yWQRJhQ== dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/core" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" tslib "^2.6.0" -"@docusaurus/plugin-google-gtag@3.4.0", "@docusaurus/plugin-google-gtag@^3.1.1": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.4.0.tgz#42489ac5fe1c83b5523ceedd5ef74f9aa8bc251b" - integrity sha512-Dsgg6PLAqzZw5wZ4QjUYc8Z2KqJqXxHxq3vIoyoBWiLEEfigIs7wHR+oiWUQy3Zk9MIk6JTYj7tMoQU0Jm3nqA== +"@docusaurus/plugin-google-gtag@3.5.2", "@docusaurus/plugin-google-gtag@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-3.5.2.tgz#60b5a9e1888c4fa16933f7c5cb5f2f2c31caad3a" + integrity sha512-lm8XL3xLkTPHFKKjLjEEAHUrW0SZBSHBE1I+i/tmYMBsjCcUB5UJ52geS5PSiOCFVR74tbPGcPHEV/gaaxFeSA== dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/core" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" "@types/gtag.js" "^0.0.12" tslib "^2.6.0" -"@docusaurus/plugin-google-tag-manager@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.4.0.tgz#cebb03a5ffa1e70b37d95601442babea251329ff" - integrity sha512-O9tX1BTwxIhgXpOLpFDueYA9DWk69WCbDRrjYoMQtFHSkTyE7RhNgyjSPREUWJb9i+YUg3OrsvrBYRl64FCPCQ== +"@docusaurus/plugin-google-tag-manager@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-3.5.2.tgz#7a37334d2e7f00914d61ad05bc09391c4db3bfda" + integrity sha512-QkpX68PMOMu10Mvgvr5CfZAzZQFx8WLlOiUQ/Qmmcl6mjGK6H21WLT5x7xDmcpCoKA/3CegsqIqBR+nA137lQg== dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/core" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" tslib "^2.6.0" -"@docusaurus/plugin-sitemap@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.4.0.tgz#b091d64d1e3c6c872050189999580187537bcbc6" - integrity sha512-+0VDvx9SmNrFNgwPoeoCha+tRoAjopwT0+pYO1xAbyLcewXSemq+eLxEa46Q1/aoOaJQ0qqHELuQM7iS2gp33Q== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/logger" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" +"@docusaurus/plugin-sitemap@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-3.5.2.tgz#9c940b27f3461c54d65295cf4c52cb20538bd360" + integrity sha512-DnlqYyRAdQ4NHY28TfHuVk414ft2uruP4QWCH//jzpHjqvKyXjj2fmDtI8RPUBh9K8iZKFMHRnLtzJKySPWvFA== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/logger" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" fs-extra "^11.1.1" sitemap "^7.1.1" tslib "^2.6.0" -"@docusaurus/preset-classic@^3.1.1": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-3.4.0.tgz#6082a32fbb465b0cb2c2a50ebfc277cff2c0f139" - integrity sha512-Ohj6KB7siKqZaQhNJVMBBUzT3Nnp6eTKqO+FXO3qu/n1hJl3YLwVKTWBg28LF7MWrKu46UuYavwMRxud0VyqHg== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/plugin-content-blog" "3.4.0" - "@docusaurus/plugin-content-docs" "3.4.0" - "@docusaurus/plugin-content-pages" "3.4.0" - "@docusaurus/plugin-debug" "3.4.0" - "@docusaurus/plugin-google-analytics" "3.4.0" - "@docusaurus/plugin-google-gtag" "3.4.0" - "@docusaurus/plugin-google-tag-manager" "3.4.0" - "@docusaurus/plugin-sitemap" "3.4.0" - "@docusaurus/theme-classic" "3.4.0" - "@docusaurus/theme-common" "3.4.0" - "@docusaurus/theme-search-algolia" "3.4.0" - "@docusaurus/types" "3.4.0" +"@docusaurus/preset-classic@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-3.5.2.tgz#977f78510bbc556aa0539149eef960bb7ab52bd9" + integrity sha512-3ihfXQ95aOHiLB5uCu+9PRy2gZCeSZoDcqpnDvf3B+sTrMvMTr8qRUzBvWkoIqc82yG5prCboRjk1SVILKx6sg== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/plugin-content-blog" "3.5.2" + "@docusaurus/plugin-content-docs" "3.5.2" + "@docusaurus/plugin-content-pages" "3.5.2" + "@docusaurus/plugin-debug" "3.5.2" + "@docusaurus/plugin-google-analytics" "3.5.2" + "@docusaurus/plugin-google-gtag" "3.5.2" + "@docusaurus/plugin-google-tag-manager" "3.5.2" + "@docusaurus/plugin-sitemap" "3.5.2" + "@docusaurus/theme-classic" "3.5.2" + "@docusaurus/theme-common" "3.5.2" + "@docusaurus/theme-search-algolia" "3.5.2" + "@docusaurus/types" "3.5.2" "@docusaurus/react-loadable@5.5.2": version "5.5.2" @@ -1719,27 +1721,27 @@ "@types/react" "*" prop-types "^15.6.2" -"@docusaurus/theme-classic@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-3.4.0.tgz#1b0f48edec3e3ec8927843554b9f11e5927b0e52" - integrity sha512-0IPtmxsBYv2adr1GnZRdMkEQt1YW6tpzrUPj02YxNpvJ5+ju4E13J5tB4nfdaen/tfR1hmpSPlTFPvTf4kwy8Q== - dependencies: - "@docusaurus/core" "3.4.0" - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/module-type-aliases" "3.4.0" - "@docusaurus/plugin-content-blog" "3.4.0" - "@docusaurus/plugin-content-docs" "3.4.0" - "@docusaurus/plugin-content-pages" "3.4.0" - "@docusaurus/theme-common" "3.4.0" - "@docusaurus/theme-translations" "3.4.0" - "@docusaurus/types" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" +"@docusaurus/theme-classic@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-3.5.2.tgz#602ddb63d987ab1f939e3760c67bc1880f01c000" + integrity sha512-XRpinSix3NBv95Rk7xeMF9k4safMkwnpSgThn0UNQNumKvmcIYjfkwfh2BhwYh/BxMXQHJ/PdmNh22TQFpIaYg== + dependencies: + "@docusaurus/core" "3.5.2" + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/module-type-aliases" "3.5.2" + "@docusaurus/plugin-content-blog" "3.5.2" + "@docusaurus/plugin-content-docs" "3.5.2" + "@docusaurus/plugin-content-pages" "3.5.2" + "@docusaurus/theme-common" "3.5.2" + "@docusaurus/theme-translations" "3.5.2" + "@docusaurus/types" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" "@mdx-js/react" "^3.0.0" clsx "^2.0.0" copy-text-to-clipboard "^3.2.0" - infima "0.2.0-alpha.43" + infima "0.2.0-alpha.44" lodash "^4.17.21" nprogress "^0.2.0" postcss "^8.4.26" @@ -1750,18 +1752,15 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-common@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-3.4.0.tgz#01f2b728de6cb57f6443f52fc30675cf12a5d49f" - integrity sha512-0A27alXuv7ZdCg28oPE8nH/Iz73/IUejVaCazqu9elS4ypjiLhK3KfzdSQBnL/g7YfHSlymZKdiOHEo8fJ0qMA== - dependencies: - "@docusaurus/mdx-loader" "3.4.0" - "@docusaurus/module-type-aliases" "3.4.0" - "@docusaurus/plugin-content-blog" "3.4.0" - "@docusaurus/plugin-content-docs" "3.4.0" - "@docusaurus/plugin-content-pages" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" +"@docusaurus/theme-common@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-3.5.2.tgz#b507ab869a1fba0be9c3c9d74f2f3d74c3ac78b2" + integrity sha512-QXqlm9S6x9Ibwjs7I2yEDgsCocp708DrCrgHgKwg2n2AY0YQ6IjU0gAK35lHRLOvAoJUfCKpQAwUykB0R7+Eew== + dependencies: + "@docusaurus/mdx-loader" "3.5.2" + "@docusaurus/module-type-aliases" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1771,19 +1770,19 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-search-algolia@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.4.0.tgz#c499bad71d668df0d0f15b0e5e33e2fc4e330fcc" - integrity sha512-aiHFx7OCw4Wck1z6IoShVdUWIjntC8FHCw9c5dR8r3q4Ynh+zkS8y2eFFunN/DL6RXPzpnvKCg3vhLQYJDmT9Q== +"@docusaurus/theme-search-algolia@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-3.5.2.tgz#466c83ca7e8017d95ae6889ccddc5ef8bf6b61c6" + integrity sha512-qW53kp3VzMnEqZGjakaV90sst3iN1o32PH+nawv1uepROO8aEGxptcq2R5rsv7aBShSRbZwIobdvSYKsZ5pqvA== dependencies: "@docsearch/react" "^3.5.2" - "@docusaurus/core" "3.4.0" - "@docusaurus/logger" "3.4.0" - "@docusaurus/plugin-content-docs" "3.4.0" - "@docusaurus/theme-common" "3.4.0" - "@docusaurus/theme-translations" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-validation" "3.4.0" + "@docusaurus/core" "3.5.2" + "@docusaurus/logger" "3.5.2" + "@docusaurus/plugin-content-docs" "3.5.2" + "@docusaurus/theme-common" "3.5.2" + "@docusaurus/theme-translations" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-validation" "3.5.2" algoliasearch "^4.18.0" algoliasearch-helper "^3.13.3" clsx "^2.0.0" @@ -1793,10 +1792,10 @@ tslib "^2.6.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-3.4.0.tgz#e6355d01352886c67e38e848b2542582ea3070af" - integrity sha512-zSxCSpmQCCdQU5Q4CnX/ID8CSUUI3fvmq4hU/GNP/XoAWtXo9SAVnM3TzpU8Gb//H3WCsT8mJcTfyOk3d9ftNg== +"@docusaurus/theme-translations@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-3.5.2.tgz#38f9ebf2a5d860397022206a05fef66c08863c89" + integrity sha512-GPZLcu4aT1EmqSTmbdpVrDENGR2yObFEX8ssEFYTCiAIVc0EihNSdOIBTazUvgNqwvnoU1A8vIs1xyzc3LITTw== dependencies: fs-extra "^11.1.1" tslib "^2.6.0" @@ -1809,6 +1808,11 @@ fs-extra "^10.1.0" tslib "^2.4.0" +"@docusaurus/tsconfig@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/tsconfig/-/tsconfig-3.5.2.tgz#98878103ba217bff355cd8944926d9ca06e6e153" + integrity sha512-rQ7toURCFnWAIn8ubcquDs0ewhPwviMzxh6WpRjBW7sJVCXb6yzwUaY3HMNa0VXCFw+qkIbFywrMTf+Pb4uHWQ== + "@docusaurus/types@2.4.3": version "2.4.3" resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-2.4.3.tgz#4aead281ca09f721b3c0a9b926818450cfa3db31" @@ -1823,10 +1827,10 @@ webpack "^5.73.0" webpack-merge "^5.8.0" -"@docusaurus/types@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-3.4.0.tgz#237c3f737e9db3f7c1a5935a3ef48d6eadde8292" - integrity sha512-4jcDO8kXi5Cf9TcyikB/yKmz14f2RZ2qTRerbHAsS+5InE9ZgSLBNLsewtFTcTOXSVcbU3FoGOzcNWAmU1TR0A== +"@docusaurus/types@3.5.2", "@docusaurus/types@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-3.5.2.tgz#058019dbeffbee2d412c3f72569e412a727f9608" + integrity sha512-N6GntLXoLVUwkZw7zCxwy9QiuEXIcTVzA9AkmNw16oc0AP3SXLrMmDMMBIfgqwuKWa6Ox6epHol9kMtJqekACw== dependencies: "@mdx-js/mdx" "^3.0.0" "@types/history" "^4.7.11" @@ -1845,10 +1849,10 @@ dependencies: tslib "^2.4.0" -"@docusaurus/utils-common@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-3.4.0.tgz#2a43fefd35b85ab9fcc6833187e66c15f8bfbbc6" - integrity sha512-NVx54Wr4rCEKsjOH5QEVvxIqVvm+9kh7q8aYTU5WzUU9/Hctd6aTrcZ3G0Id4zYJ+AeaG5K5qHA4CY5Kcm2iyQ== +"@docusaurus/utils-common@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-3.5.2.tgz#4d7f5e962fbca3e2239d80457aa0e4bd3d8f7e0a" + integrity sha512-i0AZjHiRgJU6d7faQngIhuHKNrszpL/SHQPgF1zH4H+Ij6E9NBYGy6pkcGWToIv7IVPbs+pQLh1P3whn0gWXVg== dependencies: tslib "^2.6.0" @@ -1863,14 +1867,14 @@ js-yaml "^4.1.0" tslib "^2.4.0" -"@docusaurus/utils-validation@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-3.4.0.tgz#0176f6e503ff45f4390ec2ecb69550f55e0b5eb7" - integrity sha512-hYQ9fM+AXYVTWxJOT1EuNaRnrR2WGpRdLDQG07O8UOpsvCPWUVOeo26Rbm0JWY2sGLfzAb+tvJ62yF+8F+TV0g== +"@docusaurus/utils-validation@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-3.5.2.tgz#1b2b2f02082781cc8ce713d4c85e88d6d2fc4eb3" + integrity sha512-m+Foq7augzXqB6HufdS139PFxDC5d5q2QKZy8q0qYYvGdI6nnlNsGH4cIGsgBnV7smz+mopl3g4asbSDvMV0jA== dependencies: - "@docusaurus/logger" "3.4.0" - "@docusaurus/utils" "3.4.0" - "@docusaurus/utils-common" "3.4.0" + "@docusaurus/logger" "3.5.2" + "@docusaurus/utils" "3.5.2" + "@docusaurus/utils-common" "3.5.2" fs-extra "^11.2.0" joi "^17.9.2" js-yaml "^4.1.0" @@ -1899,13 +1903,13 @@ url-loader "^4.1.1" webpack "^5.73.0" -"@docusaurus/utils@3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-3.4.0.tgz#c508e20627b7a55e2b541e4a28c95e0637d6a204" - integrity sha512-fRwnu3L3nnWaXOgs88BVBmG1yGjcQqZNHG+vInhEa2Sz2oQB+ZjbEMO5Rh9ePFpZ0YDiDUhpaVjwmS+AU2F14g== +"@docusaurus/utils@3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-3.5.2.tgz#17763130215f18d7269025903588ef7fb373e2cb" + integrity sha512-33QvcNFh+Gv+C2dP9Y9xWEzMgf3JzrpL2nW9PopidiohS1nDcyknKRx2DWaFvyVTTYIkkABVSr073VTj/NITNA== dependencies: - "@docusaurus/logger" "3.4.0" - "@docusaurus/utils-common" "3.4.0" + "@docusaurus/logger" "3.5.2" + "@docusaurus/utils-common" "3.5.2" "@svgr/webpack" "^8.1.0" escape-string-regexp "^4.0.0" file-loader "^6.2.0" @@ -3857,7 +3861,7 @@ cheerio-select@^2.1.0: domhandler "^5.0.3" domutils "^3.0.1" -cheerio@^1.0.0-rc.12, cheerio@^1.0.0-rc.3: +cheerio@1.0.0-rc.12, cheerio@^1.0.0-rc.3: version "1.0.0-rc.12" resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.12.tgz#788bf7466506b1c6bf5fae51d24a2c4d62e47683" integrity sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q== @@ -6298,10 +6302,10 @@ infer-owner@^1.0.4: resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== -infima@0.2.0-alpha.43: - version "0.2.0-alpha.43" - resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.43.tgz#f7aa1d7b30b6c08afef441c726bac6150228cbe0" - integrity sha512-2uw57LvUqW0rK/SWYnd/2rRfxNA5DDNOh33jxF7fy46VWoNhGxiUQyVZHbBMjQ33mQem0cjdDVwgWVAmlRfgyQ== +infima@0.2.0-alpha.44: + version "0.2.0-alpha.44" + resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.44.tgz#9cd9446e473b44d49763f48efabe31f32440861d" + integrity sha512-tuRkUSO/lB3rEhLJk25atwAjgLuzq070+pOW8XcvpHky/YbENnRRdPd85IBkyeTgttmOy5ah+yHYsK1HhUd4lQ== inflight@^1.0.4: version "1.0.6" @@ -10887,10 +10891,10 @@ typeit@^8.8.3: dependencies: "@types/web-animations-js" "^2.2.16" -typescript@^4.7.4: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== undici-types@~5.26.4: version "5.26.5" From 2b8d42fa72f34577e13b73453bd5254fa781dc40 Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 22:22:05 +0800 Subject: [PATCH 02/10] :fire: Remove ai-summary and ai-translate --- docusaurus.config.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index d93ea35..3f5cdfd 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -122,7 +122,8 @@ const config = { editUrl: "https://github.com/MuelNova/NovaNo1r-Blog/tree/main/", feedOptions: { type: "rss", - description: "Nova 是一个做 PWN 的二次元,Nova 的博客用于输出无营养内容。", + description: + "Nova 是一个做 PWN 的二次元,Nova 的博客用于输出无营养内容。", copyright: `Copyright © ${new Date().getFullYear()} NovaNo1r with ❤`, }, remarkPlugins: [remarkMath], @@ -157,23 +158,23 @@ const config = { // anonymizeIP: true, // }, // ], - [ - require.resolve("./src/plugins/ai-summary"), - { - OPENAI_API_KEY: process.env.OPENAI_API_KEY, - OPENAI_BASE_URL: process.env.OPENAI_BASE_URL, - OPENAI_SUMMARY_MODEL: process.env.OPENAI_SUMMARY_MODEL, - }, - ], - [ - require.resolve("./src/plugins/ai-translate"), - { - OPENAI_API_KEY: process.env.OPENAI_API_KEY, - OPENAI_BASE_URL: process.env.OPENAI_BASE_URL, - OPENAI_TRANSLATE_MODEL: process.env.OPENAI_TRANSLATE_MODEL, - OPENAI_TOKEN_SIZE: process.env.OPENAI_TOKEN_SIZE, - }, - ], + // [ + // require.resolve("./src/plugins/ai-summary"), + // { + // OPENAI_API_KEY: process.env.OPENAI_API_KEY, + // OPENAI_BASE_URL: process.env.OPENAI_BASE_URL, + // OPENAI_SUMMARY_MODEL: process.env.OPENAI_SUMMARY_MODEL, + // }, + // ], + // [ + // require.resolve("./src/plugins/ai-translate"), + // { + // OPENAI_API_KEY: process.env.OPENAI_API_KEY, + // OPENAI_BASE_URL: process.env.OPENAI_BASE_URL, + // OPENAI_TRANSLATE_MODEL: process.env.OPENAI_TRANSLATE_MODEL, + // OPENAI_TOKEN_SIZE: process.env.OPENAI_TOKEN_SIZE, + // }, + // ], ], themes: [ From e010d5d20e74e40e671b13c1f4f1151d6e49550a Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 22:34:43 +0800 Subject: [PATCH 03/10] :construction_worker: Work with GitHub Pages --- .env.example | 1 + .github/workflows/deploy.yml | 52 +++++++++++++++++++++++++++++++ .github/workflows/test-deploy.yml | 27 ++++++++++++++++ .gitmodules | 3 -- docusaurus.config.js | 4 ++- go-github-webhooks | 1 - src/static/CNAME | 0 7 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test-deploy.yml delete mode 160000 go-github-webhooks create mode 100644 src/static/CNAME diff --git a/.env.example b/.env.example index 24e0a7d..0abb2fa 100644 --- a/.env.example +++ b/.env.example @@ -5,6 +5,7 @@ GISCUS_CATEGORY_ID="DIC_kwDOIXU0aM4CXB7m" GISCUS_LIGHT_CSS="https://oss.nova.gal/css/giscus-light.css" GISCUS_DARK_CSS="https://oss.nova.gal/css/giscus-dark.css" + # GTAG, can be string array GTAG="G-XXXXXXXXXX" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1526404 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + - v2 + # Review gh actions docs if you want to further define triggers, paths, etc + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + +jobs: + build: + name: Build Docusaurus + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Build website + run: yarn build + + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + name: Deploy to GitHub Pages + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 0000000..66b3a39 --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -0,0 +1,27 @@ +name: Test deployment + +on: + pull_request: + branches: + - main + - v2 + # Review gh actions docs if you want to further define triggers, paths, etc + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + +jobs: + test-deploy: + name: Test deployment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test build website + run: yarn build diff --git a/.gitmodules b/.gitmodules index 489651d..e69de29 100755 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "go-github-webhooks"] - path = go-github-webhooks - url = https://github.com/MuelNova/go-github-webhooks diff --git a/docusaurus.config.js b/docusaurus.config.js index 3f5cdfd..d35d07b 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,5 +1,5 @@ // dotenv -require("dotenv").config(); +import "dotenv/config"; // @ts-check // Note: type annotations allow type checking and IDEs autocompletion @@ -26,6 +26,8 @@ const config = { // If you aren't using GitHub pages, you don't need these. organizationName: "MuelNova", // Usually your GitHub org/user name. projectName: "Muel-Nova_Blog", // Usually your repo name. + deploymentBranch: "gh-pages", // The branch your GitHub pages site is deployed from. + trailingSlash: false, // Even if you don't use internalization, you can use this field to set useful // metadata like html lang. For example, if your site is Chinese, you may want diff --git a/go-github-webhooks b/go-github-webhooks deleted file mode 160000 index ec732de..0000000 --- a/go-github-webhooks +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ec732de995dfc65a47739376c772af7bd4a88e32 diff --git a/src/static/CNAME b/src/static/CNAME new file mode 100644 index 0000000..e69de29 From 50c2635d0a1b8f0bc5d8ae9e4d6d2abaa9d82053 Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 23:16:57 +0800 Subject: [PATCH 04/10] :fire: Remove ai-summary and ai-translate --- src/plugins/ai-summary/index.ts | 160 ------------------------------ src/plugins/ai-translate/index.ts | 157 ----------------------------- 2 files changed, 317 deletions(-) delete mode 100644 src/plugins/ai-summary/index.ts delete mode 100644 src/plugins/ai-translate/index.ts diff --git a/src/plugins/ai-summary/index.ts b/src/plugins/ai-summary/index.ts deleted file mode 100644 index 9fd4b4e..0000000 --- a/src/plugins/ai-summary/index.ts +++ /dev/null @@ -1,160 +0,0 @@ -// 获取 docusaurus 配置 -const path = require("path"); -const fs = require("fs"); -import { - LoadContext, - Plugin, - PluginOptions, - PluginContentLoadedActions, -} from "@docusaurus/types"; -import openai from "openai"; - -interface BlogPluginOptions extends PluginOptions { - id?: string; - path?: string; - routeBasePath?: string; - [key: string]: any; -} - -interface PluginConfig extends PluginOptions { - OPENAI_API_KEY?: string; - OPENAI_BASE_URL?: string; - OPENAI_SUMMARY_MODEL?: string; - OPENAI_SUMMARY_SYSTEM_PROMPT?: string; -} - -export default async function AISummary( - context: LoadContext, - options: PluginConfig -): Promise { - // ... - return { - name: "ai-summary", - async loadContent() { - const { siteConfig } = context; - const blogPlugins = siteConfig.plugins.filter( - (plugin) => - Array.isArray(plugin) && - plugin[0] === "@docusaurus/plugin-content-blog" - ); - - const summaries: { [key: string]: { [key: string]: string } } = {}; - let skipFlag = false; - - if (!options || !options.OPENAI_API_KEY) { - console.warn( - "OPENAI_API key is not set in siteConfig.customFields, skipping AI summary generation" - ); - skipFlag = true; - } - - const openaiClient = skipFlag - ? new openai({ apiKey: "dummy_api" }) - : new openai({ - apiKey: options.OPENAI_API_KEY, - baseURL: options.OPENAI_BASE_URL, - }); - const model = (options.OPENAI_SUMMARY_MODEL as string) || "gpt-4o"; - const systemPrompt = - (options.OPENAI_SUMMARY_SYSTEM_PROMPT as string) || - `你是一位专业的内容总结助手,你的任务是根据用户提供的文本生成简洁的总结。 - 请确保总结清晰、简明,抓住文章的主要内容和作者的主要经历。 - 注意,你需要使用和文章主要语言相同的语种,更推荐你不使用 markdown。 - 在数个自然段内完成总结,注意 nova 即为博客作者,且为男性。`; - const generateSummary = async (content: string) => { - const response = await openaiClient.chat.completions.create({ - model: model, - messages: [ - { - role: "system", - content: systemPrompt, - }, - { - role: "user", - content, - }, - ], - }); - return response.choices[0]?.message?.content; - }; - - for (const blogPlugin of blogPlugins) { - if (!blogPlugin) { - console.warn("No blog plugin found, skipping AI summary generation"); - skipFlag = true; - } - const pluginOptions = blogPlugin[1] as BlogPluginOptions; - const blogPath = pluginOptions.path; - const blogRoute = pluginOptions.routeBasePath || "blog"; - - const blogDir = path.join(context.siteDir, blogPath); - const files = fs.readdirSync(blogDir); - - for (const file of files) { - // 判断是否是 md 或者 mdx 文件 - if ( - (!file.endsWith(".md") && !file.endsWith(".mdx")) || - file.startsWith("__") - ) { - continue; - } - const filePath = path.join(blogDir, file); - const fileName = file.replace(/\.(md|mdx)$/, "").replace(" ", "-"); - // 判断是不是文件夹 - if (fs.statSync(filePath).isDirectory()) { - continue; - } - let content = fs.readFileSync(filePath, "utf-8"); - // 使用正则表达式全局替换代码块和引用块 - const codeBlockRegex = /```[^]+?```/g; - content = content.replace(codeBlockRegex, ""); - - // 替换多行引用块 - const quoteRegex = />>[^]+/g; - content = content.replace(quoteRegex, ""); - - // 检查文件是否需要更新摘要(可以根据文件的时间戳或其他标志) - const summaryFilePath = filePath.replace(/\.(md|mdx)$/, ".summary"); - const summaryExists = fs.existsSync(summaryFilePath); - if (summaryExists) { - const summaryStats = fs.statSync(summaryFilePath); - const blogStats = fs.statSync(filePath); - if (summaryStats.mtime >= blogStats.mtime) { - summaries[blogRoute] = summaries[blogRoute] || {}; - summaries[blogRoute][fileName] = fs.readFileSync( - summaryFilePath, - "utf-8" - ); - continue; - } - } - - // 生成摘要 - if (skipFlag) continue; - console.log("Generating summary for", file); - const response = await generateSummary(content); - if (!response) { - console.warn(`Failed to generate summary for ${file}`); - continue; - } - summaries[blogRoute] = summaries[blogRoute] || {}; - summaries[blogRoute][file] = response; - fs.writeFileSync(summaryFilePath, response); - } - } - return { aisummary: summaries }; - }, - - async contentLoaded({ - content, - actions, - }: { - content: any; - actions: PluginContentLoadedActions; - }) { - const { createData } = actions; - createData("aisummary.json", JSON.stringify(content.aisummary, null, 2)); - }, - /* other lifecycle API */ - }; -} diff --git a/src/plugins/ai-translate/index.ts b/src/plugins/ai-translate/index.ts deleted file mode 100644 index a3ccfe9..0000000 --- a/src/plugins/ai-translate/index.ts +++ /dev/null @@ -1,157 +0,0 @@ -import { Plugin, LoadContext, PluginOptions } from "@docusaurus/types"; -import openai from "openai"; - -import path from "path"; -import fs from "fs"; - -interface BlogPluginOptions extends PluginOptions { - id?: string; - path: string; - routeBasePath?: string; - [key: string]: any; -} - -interface PluginConfig extends PluginOptions { - OPENAI_API_KEY?: string; - OPENAI_BASE_URL?: string; - OPENAI_TRANSLATE_MODEL?: string; - OPENAI_TRANSLATE_SYSTEM_PROMPT?: string; - OPENAI_TOKEN_SIZE?: string; -} - -export default async function AITranslate( - context: LoadContext, - options: PluginConfig -) { - return { - name: "ai-translate", - async loadContent() { - // 获取 docusaurus 配置 - const { siteConfig } = context; - const blogPlugins = siteConfig.plugins.filter( - (plugin) => - Array.isArray(plugin) && - plugin[0] === "@docusaurus/plugin-content-blog" - ); - - if (!options || !options.OPENAI_API_KEY) { - console.warn( - "OPENAI_API key is not set in Plugin Options, skipping AI Translate generation" - ); - return; - } - - const openaiClient = new openai({ - apiKey: options.OPENAI_API_KEY, - baseURL: options.OPENAI_BASE_URL, - }); - const model = (options.OPENAI_TRANSLATE_MODEL as string) || "gpt-4o"; - const systemPrompt = - (options.OPENAI_TRANSLATE_SYSTEM_PROMPT as string) || - `你是一位专业的内容翻译助手,任务是将用户文本翻译为英文,同时翻译代码块注释。 - 注意你不应该修改任何文章结构,不要对标题的括号进行修改。 - 你的回答应该只包含翻译部分,不包含任何说明。`; - const generateTranslate = async (content: string) => { - const response = await openaiClient.chat.completions.create({ - model: model, - messages: [ - { - role: "system", - content: systemPrompt, - }, - { - role: "user", - content, - }, - ], - }); - console.debug(response); - return response.choices[0]?.message?.content; - }; - - const translatedPath = siteConfig.i18n.path; - if (!translatedPath) { - console.warn( - "i18n.path is not set in siteConfig, skipping AI Translate generation" - ); - return; - } - - for (const blogPlugin of blogPlugins) { - if (!blogPlugin) { - console.warn( - "No blog plugin found, skipping AI Translate generation" - ); - return; - } - const pluginOptions = blogPlugin[1] as BlogPluginOptions; - const blogPath = pluginOptions.path; - const blogDir = path.join(context.siteDir, blogPath); - const translatedBlogPath = path.join( - context.siteDir, - translatedPath, - "en", - "docusaurus-plugin-content-blog" + - (pluginOptions.id == "default" ? "" : "-" + pluginOptions.id) - ); - const files = fs.readdirSync(blogDir); - - for (const file of files) { - // 判断是否是 md 或者 mdx 文件 - if ( - (!file.endsWith(".md") && !file.endsWith(".mdx")) || - file.startsWith("__") - ) { - continue; - } - const filePath = path.join(blogDir, file); - // 判断是不是文件夹 - if (fs.statSync(filePath).isDirectory()) { - continue; - } - - const translatedFilePath = path.join(translatedBlogPath, file); - - if (fs.existsSync(translatedFilePath)) { - const translateStats = fs.statSync(translatedFilePath); - const blogStats = fs.statSync(filePath); - if (translateStats.mtime >= blogStats.mtime) { - continue; - } - - const content = fs.readFileSync(translatedFilePath, "utf-8"); - if (!content.includes("")) { - console.info( - `Skipping ${translatedFilePath} as it has been translated by yourself at ${translateStats.mtime}` - ); - continue; - } - } - - const content = fs.readFileSync(filePath, "utf-8"); - console.info("Translating", file); - let translatedContent = ""; - // split content, translate each part, and join them back - let currentIdx = 0; - // only 8k for deepseek - console.log(options); - - const TRANS_SIZE = Number(options.OPENAI_TOKEN_SIZE) || 8192; - while (currentIdx < content.length) { - const chunk = content.slice(currentIdx, currentIdx + TRANS_SIZE); - console.log("Translating chunk", currentIdx, chunk.length); - const translatedChunk = await generateTranslate(chunk); - translatedContent += translatedChunk; - currentIdx += TRANS_SIZE; - } - - translatedContent += - "\n\n:::info\nThis Content is generated by ChatGPT and might be wrong / incomplete, refer to Chinese version if you find something wrong.\n:::\n\n\n"; - - // write translated content to file - fs.writeFileSync(translatedFilePath, translatedContent); - } - } - }, - }; -} From a753851bfc7510bbfae21c063829a2db8ac47e4d Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 23:26:31 +0800 Subject: [PATCH 05/10] :construction_worker: Work with GitHub Pages --- .github/workflows/deploy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1526404..f43ec88 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,6 +23,10 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + + - name: Setup environment variables + run: echo "${{ secrets.ENV_FILE }}" > .env + - name: Build website run: yarn build From 3b13062132b7811159f1a9886a1d70bfc34146e6 Mon Sep 17 00:00:00 2001 From: MuelNova Date: Sat, 28 Sep 2024 23:16:57 +0800 Subject: [PATCH 06/10] :poop: Optimize build This reverts commit 50c2635d0a1b8f0bc5d8ae9e4d6d2abaa9d82053. --- src/plugins/ai-summary/index.ts | 160 ++++++++++++++++++++++++++++++ src/plugins/ai-translate/index.ts | 157 +++++++++++++++++++++++++++++ src/theme/BlogPostPage/index.tsx | 15 ++- 3 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 src/plugins/ai-summary/index.ts create mode 100644 src/plugins/ai-translate/index.ts diff --git a/src/plugins/ai-summary/index.ts b/src/plugins/ai-summary/index.ts new file mode 100644 index 0000000..9fd4b4e --- /dev/null +++ b/src/plugins/ai-summary/index.ts @@ -0,0 +1,160 @@ +// 获取 docusaurus 配置 +const path = require("path"); +const fs = require("fs"); +import { + LoadContext, + Plugin, + PluginOptions, + PluginContentLoadedActions, +} from "@docusaurus/types"; +import openai from "openai"; + +interface BlogPluginOptions extends PluginOptions { + id?: string; + path?: string; + routeBasePath?: string; + [key: string]: any; +} + +interface PluginConfig extends PluginOptions { + OPENAI_API_KEY?: string; + OPENAI_BASE_URL?: string; + OPENAI_SUMMARY_MODEL?: string; + OPENAI_SUMMARY_SYSTEM_PROMPT?: string; +} + +export default async function AISummary( + context: LoadContext, + options: PluginConfig +): Promise { + // ... + return { + name: "ai-summary", + async loadContent() { + const { siteConfig } = context; + const blogPlugins = siteConfig.plugins.filter( + (plugin) => + Array.isArray(plugin) && + plugin[0] === "@docusaurus/plugin-content-blog" + ); + + const summaries: { [key: string]: { [key: string]: string } } = {}; + let skipFlag = false; + + if (!options || !options.OPENAI_API_KEY) { + console.warn( + "OPENAI_API key is not set in siteConfig.customFields, skipping AI summary generation" + ); + skipFlag = true; + } + + const openaiClient = skipFlag + ? new openai({ apiKey: "dummy_api" }) + : new openai({ + apiKey: options.OPENAI_API_KEY, + baseURL: options.OPENAI_BASE_URL, + }); + const model = (options.OPENAI_SUMMARY_MODEL as string) || "gpt-4o"; + const systemPrompt = + (options.OPENAI_SUMMARY_SYSTEM_PROMPT as string) || + `你是一位专业的内容总结助手,你的任务是根据用户提供的文本生成简洁的总结。 + 请确保总结清晰、简明,抓住文章的主要内容和作者的主要经历。 + 注意,你需要使用和文章主要语言相同的语种,更推荐你不使用 markdown。 + 在数个自然段内完成总结,注意 nova 即为博客作者,且为男性。`; + const generateSummary = async (content: string) => { + const response = await openaiClient.chat.completions.create({ + model: model, + messages: [ + { + role: "system", + content: systemPrompt, + }, + { + role: "user", + content, + }, + ], + }); + return response.choices[0]?.message?.content; + }; + + for (const blogPlugin of blogPlugins) { + if (!blogPlugin) { + console.warn("No blog plugin found, skipping AI summary generation"); + skipFlag = true; + } + const pluginOptions = blogPlugin[1] as BlogPluginOptions; + const blogPath = pluginOptions.path; + const blogRoute = pluginOptions.routeBasePath || "blog"; + + const blogDir = path.join(context.siteDir, blogPath); + const files = fs.readdirSync(blogDir); + + for (const file of files) { + // 判断是否是 md 或者 mdx 文件 + if ( + (!file.endsWith(".md") && !file.endsWith(".mdx")) || + file.startsWith("__") + ) { + continue; + } + const filePath = path.join(blogDir, file); + const fileName = file.replace(/\.(md|mdx)$/, "").replace(" ", "-"); + // 判断是不是文件夹 + if (fs.statSync(filePath).isDirectory()) { + continue; + } + let content = fs.readFileSync(filePath, "utf-8"); + // 使用正则表达式全局替换代码块和引用块 + const codeBlockRegex = /```[^]+?```/g; + content = content.replace(codeBlockRegex, ""); + + // 替换多行引用块 + const quoteRegex = />>[^]+/g; + content = content.replace(quoteRegex, ""); + + // 检查文件是否需要更新摘要(可以根据文件的时间戳或其他标志) + const summaryFilePath = filePath.replace(/\.(md|mdx)$/, ".summary"); + const summaryExists = fs.existsSync(summaryFilePath); + if (summaryExists) { + const summaryStats = fs.statSync(summaryFilePath); + const blogStats = fs.statSync(filePath); + if (summaryStats.mtime >= blogStats.mtime) { + summaries[blogRoute] = summaries[blogRoute] || {}; + summaries[blogRoute][fileName] = fs.readFileSync( + summaryFilePath, + "utf-8" + ); + continue; + } + } + + // 生成摘要 + if (skipFlag) continue; + console.log("Generating summary for", file); + const response = await generateSummary(content); + if (!response) { + console.warn(`Failed to generate summary for ${file}`); + continue; + } + summaries[blogRoute] = summaries[blogRoute] || {}; + summaries[blogRoute][file] = response; + fs.writeFileSync(summaryFilePath, response); + } + } + return { aisummary: summaries }; + }, + + async contentLoaded({ + content, + actions, + }: { + content: any; + actions: PluginContentLoadedActions; + }) { + const { createData } = actions; + createData("aisummary.json", JSON.stringify(content.aisummary, null, 2)); + }, + /* other lifecycle API */ + }; +} diff --git a/src/plugins/ai-translate/index.ts b/src/plugins/ai-translate/index.ts new file mode 100644 index 0000000..a3ccfe9 --- /dev/null +++ b/src/plugins/ai-translate/index.ts @@ -0,0 +1,157 @@ +import { Plugin, LoadContext, PluginOptions } from "@docusaurus/types"; +import openai from "openai"; + +import path from "path"; +import fs from "fs"; + +interface BlogPluginOptions extends PluginOptions { + id?: string; + path: string; + routeBasePath?: string; + [key: string]: any; +} + +interface PluginConfig extends PluginOptions { + OPENAI_API_KEY?: string; + OPENAI_BASE_URL?: string; + OPENAI_TRANSLATE_MODEL?: string; + OPENAI_TRANSLATE_SYSTEM_PROMPT?: string; + OPENAI_TOKEN_SIZE?: string; +} + +export default async function AITranslate( + context: LoadContext, + options: PluginConfig +) { + return { + name: "ai-translate", + async loadContent() { + // 获取 docusaurus 配置 + const { siteConfig } = context; + const blogPlugins = siteConfig.plugins.filter( + (plugin) => + Array.isArray(plugin) && + plugin[0] === "@docusaurus/plugin-content-blog" + ); + + if (!options || !options.OPENAI_API_KEY) { + console.warn( + "OPENAI_API key is not set in Plugin Options, skipping AI Translate generation" + ); + return; + } + + const openaiClient = new openai({ + apiKey: options.OPENAI_API_KEY, + baseURL: options.OPENAI_BASE_URL, + }); + const model = (options.OPENAI_TRANSLATE_MODEL as string) || "gpt-4o"; + const systemPrompt = + (options.OPENAI_TRANSLATE_SYSTEM_PROMPT as string) || + `你是一位专业的内容翻译助手,任务是将用户文本翻译为英文,同时翻译代码块注释。 + 注意你不应该修改任何文章结构,不要对标题的括号进行修改。 + 你的回答应该只包含翻译部分,不包含任何说明。`; + const generateTranslate = async (content: string) => { + const response = await openaiClient.chat.completions.create({ + model: model, + messages: [ + { + role: "system", + content: systemPrompt, + }, + { + role: "user", + content, + }, + ], + }); + console.debug(response); + return response.choices[0]?.message?.content; + }; + + const translatedPath = siteConfig.i18n.path; + if (!translatedPath) { + console.warn( + "i18n.path is not set in siteConfig, skipping AI Translate generation" + ); + return; + } + + for (const blogPlugin of blogPlugins) { + if (!blogPlugin) { + console.warn( + "No blog plugin found, skipping AI Translate generation" + ); + return; + } + const pluginOptions = blogPlugin[1] as BlogPluginOptions; + const blogPath = pluginOptions.path; + const blogDir = path.join(context.siteDir, blogPath); + const translatedBlogPath = path.join( + context.siteDir, + translatedPath, + "en", + "docusaurus-plugin-content-blog" + + (pluginOptions.id == "default" ? "" : "-" + pluginOptions.id) + ); + const files = fs.readdirSync(blogDir); + + for (const file of files) { + // 判断是否是 md 或者 mdx 文件 + if ( + (!file.endsWith(".md") && !file.endsWith(".mdx")) || + file.startsWith("__") + ) { + continue; + } + const filePath = path.join(blogDir, file); + // 判断是不是文件夹 + if (fs.statSync(filePath).isDirectory()) { + continue; + } + + const translatedFilePath = path.join(translatedBlogPath, file); + + if (fs.existsSync(translatedFilePath)) { + const translateStats = fs.statSync(translatedFilePath); + const blogStats = fs.statSync(filePath); + if (translateStats.mtime >= blogStats.mtime) { + continue; + } + + const content = fs.readFileSync(translatedFilePath, "utf-8"); + if (!content.includes("")) { + console.info( + `Skipping ${translatedFilePath} as it has been translated by yourself at ${translateStats.mtime}` + ); + continue; + } + } + + const content = fs.readFileSync(filePath, "utf-8"); + console.info("Translating", file); + let translatedContent = ""; + // split content, translate each part, and join them back + let currentIdx = 0; + // only 8k for deepseek + console.log(options); + + const TRANS_SIZE = Number(options.OPENAI_TOKEN_SIZE) || 8192; + while (currentIdx < content.length) { + const chunk = content.slice(currentIdx, currentIdx + TRANS_SIZE); + console.log("Translating chunk", currentIdx, chunk.length); + const translatedChunk = await generateTranslate(chunk); + translatedContent += translatedChunk; + currentIdx += TRANS_SIZE; + } + + translatedContent += + "\n\n:::info\nThis Content is generated by ChatGPT and might be wrong / incomplete, refer to Chinese version if you find something wrong.\n:::\n\n\n"; + + // write translated content to file + fs.writeFileSync(translatedFilePath, translatedContent); + } + } + }, + }; +} diff --git a/src/theme/BlogPostPage/index.tsx b/src/theme/BlogPostPage/index.tsx index 133af48..94db5a7 100644 --- a/src/theme/BlogPostPage/index.tsx +++ b/src/theme/BlogPostPage/index.tsx @@ -28,6 +28,12 @@ function BlogSummary({ }): JSX.Element { try { const Data = require("@site/.docusaurus/ai-summary/default/aisummary.json"); + if (!content.metadata.editUrl) { + console.warn( + "No editUrl found in metadata, skipping AI summary generation" + ); + return <>; + } const link = content.metadata.editUrl.split("/"); const blog = link[link.length - 2], post = link[link.length - 1].replace(/\.(md|mdx)$/, ""); @@ -45,8 +51,13 @@ function BlogSummary({ ); } catch (e) { - console.warn(e); - console.warn("No ai-summary plugin found, skipping AI summary generation"); + if (e.code === "MODULE_NOT_FOUND") { + console.debug( + "No ai-summary plugin found, skipping AI summary generation" + ); + } else { + console.warn(e); + } return <>; } } From 49d71c344d5066649c38492d9a8e065cf4362a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=CE=BCElnova?= Date: Sun, 29 Sep 2024 00:11:41 +0800 Subject: [PATCH 07/10] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f43ec88..c03c628 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,6 +12,7 @@ jobs: build: name: Build Docusaurus runs-on: ubuntu-latest + environment: gh-pages steps: - uses: actions/checkout@v4 with: From 5a4a4fc3bd7e2340060306d195ac75d5e2bcac1e Mon Sep 17 00:00:00 2001 From: MuelNova Date: Mon, 30 Sep 2024 02:49:49 +0800 Subject: [PATCH 08/10] :children_crossing: FriendLinks now added into index nav --- src/contents/pages/index.module.scss | 6 ++++++ src/contents/pages/index.tsx | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/contents/pages/index.module.scss b/src/contents/pages/index.module.scss index 5f2c4fa..ab81fbd 100755 --- a/src/contents/pages/index.module.scss +++ b/src/contents/pages/index.module.scss @@ -980,6 +980,9 @@ $last-chapter__theme-red: #c45c66; a:nth-child(4) { animation: fadein 0.7s ease 1s forwards; } + a:nth-child(5) { + animation: fadein 0.7s ease 1.1s forwards; + } } .colors { div:nth-child(1) { @@ -994,6 +997,9 @@ $last-chapter__theme-red: #c45c66; div:nth-child(4) { animation: scale0-1 0.4s ease 1s forwards; } + div:nth-child(4) { + animation: scale0-1 0.4s ease 1.1s forwards; + } } } diff --git a/src/contents/pages/index.tsx b/src/contents/pages/index.tsx index 59535d9..72cc2b7 100755 --- a/src/contents/pages/index.tsx +++ b/src/contents/pages/index.tsx @@ -105,6 +105,15 @@ const DropMenu = ({ dropMenu, setDropMenu }) => ( {/* */} + +
+
+ +
+

友链

+ {/* */} +
+
From 9d29b0a489727cc640f0a9dbb28eacc7da361f6e Mon Sep 17 00:00:00 2001 From: MuelNova Date: Mon, 30 Sep 2024 22:46:18 +0800 Subject: [PATCH 09/10] :children_crossing: Improve usability for index page Now index page animation will only be triggered once tor each tab, while animation of menu will be shorten as well. --- src/contents/pages/index.module.scss | 357 ++++++++++++++++++--------- src/contents/pages/index.tsx | 185 ++++++++------ 2 files changed, 341 insertions(+), 201 deletions(-) diff --git a/src/contents/pages/index.module.scss b/src/contents/pages/index.module.scss index ab81fbd..c04693f 100755 --- a/src/contents/pages/index.module.scss +++ b/src/contents/pages/index.module.scss @@ -382,7 +382,7 @@ $last-chapter__theme-red: #c45c66; position: absolute; background-color: $last-chapter__theme-white; border-radius: 5px; - transform: scale(0); + transform: scale(0.01); cursor: pointer; overflow: hidden; z-index: 2; @@ -514,76 +514,262 @@ $last-chapter__theme-red: #c45c66; } // Animation -.last-chapter__frame { - animation: last-chapter__show-frame 1s cubic-bezier(0.18, 0.66, 0.05, 0.96) - 0.4s forwards; +.last-chapter__decoration { + .star::after { + animation: page__rotate-decoration 6s linear 0s infinite; + } + .moon::after { + animation: page__rotate-decoration 6s linear 0s infinite; + } } -.last-chapter__ball { - animation: scale0-1 0.6s cubic-bezier(0.18, 0.66, 0.05, 0.96) 0.2s forwards; - &::after { - animation: fadein 1s ease 0.8s forwards; +.animation { + .show { + animation: slide-bottom 0.05s ease 0s forwards; + + .menu__space { + div:nth-child(1) { + animation: menu__show-space-bg 0.6s ease 0.1s forwards; + } + div:nth-child(2) { + animation: menu__show-space-bg 0.6s ease 0.2s forwards; + } + div:nth-child(3) { + animation: menu__show-space-bg 0.6s ease 0.3s forwards; + } + div:nth-child(4) { + animation: menu__show-space-bg 0.6s ease 0.4s forwards; + } + &::before { + animation: fadein 1s ease 1s forwards; + } + &::after { + animation: menu__down-word 0.6s ease 1s forwards; + } + } + + .menu__box { + animation: menu__show-nav 0.6s ease 0s forwards; + + .menu-title { + animation: fadein 0.5s ease 0.6s forwards; + } + .nav { + a:nth-child(1) { + animation: fadein 0.7s ease 0.7s forwards; + } + a:nth-child(2) { + animation: fadein 0.7s ease 0.8s forwards; + } + a:nth-child(3) { + animation: fadein 0.7s ease 0.9s forwards; + } + a:nth-child(4) { + animation: fadein 0.7s ease 1s forwards; + } + a:nth-child(5) { + animation: fadein 0.7s ease 1.1s forwards; + } + } + .colors { + div:nth-child(1) { + animation: scale0-1 0.4s ease 0.7s forwards; + } + div:nth-child(2) { + animation: scale0-1 0.4s ease 0.8s forwards; + } + div:nth-child(3) { + animation: scale0-1 0.4s ease 0.9s forwards; + } + div:nth-child(4) { + animation: scale0-1 0.4s ease 1s forwards; + } + } + } + + .menu__close-btn { + animation: slide-left 0.6s cubic-bezier(0.06, 0.51, 0.01, 1.03) 1.4s + forwards; + } } -} -.last-chapter__bg-help { - animation: fadein 0.4s ease 0.4s forwards; -} + .last-chapter__frame { + animation: last-chapter__show-frame 1s cubic-bezier(0.18, 0.66, 0.05, 0.96) + 0.4s forwards; + } -.last-chapter__bg { - &::before, - &::after { - animation: scale0-1 0.5s cubic-bezier(0.18, 0.66, 0.05, 0.96) 0s forwards; + .last-chapter__ball { + animation: scale0-1 0.6s cubic-bezier(0.18, 0.66, 0.05, 0.96) 0.2s forwards; + &::after { + animation: fadein 1s ease 0.8s forwards; + } } -} -.last-chapter__logo { - animation: last-chapter__show-logo 0.6s ease 1s forwards; -} + .last-chapter__bg-help { + animation: fadein 0.4s ease 0.4s forwards; + } -.last-chapter__menu-btn { - animation: last-chapter__show-logo 0.6s ease 1.6s forwards; -} + .last-chapter__bg { + &::before, + &::after { + animation: scale0-1 0.5s cubic-bezier(0.18, 0.66, 0.05, 0.96) 0s forwards; + } + } -.last-chapter__decoration { - .star::after { - animation: page__rotate-decoration 6s linear 0s infinite; + .last-chapter__logo { + animation: last-chapter__show-logo 0.6s ease 1s forwards; } - .moon::after { - animation: page__rotate-decoration 6s linear 0s infinite; + + .last-chapter__menu-btn { + animation: last-chapter__show-logo 0.6s ease 1.6s forwards; } - .star:nth-child(1) { - animation: last-chapter__show-decoration 0.6s ease 1.7s forwards; + + .last-chapter__decoration { + .moon { + animation: last-chapter__show-decoration 0.6s ease 2s forwards; + } + .star:nth-child(1) { + animation: last-chapter__show-decoration 0.6s ease 1.7s forwards; + } + .star:nth-child(4) { + animation: last-chapter__show-decoration 0.6s ease 1.8s forwards; + } + .star:nth-child(2) { + animation: last-chapter__show-decoration 0.6s ease 1.9s forwards; + } + .star:nth-child(3) { + animation: last-chapter__show-decoration 0.6s ease 2.1s forwards; + } } - .star:nth-child(4) { - animation: last-chapter__show-decoration 0.6s ease 1.8s forwards; + + .last-chapter__sns-nav { + a:nth-child(1) { + animation: last-chapter__show-logo 0.6s ease 1.1s forwards; + } + a:nth-child(2) { + animation: last-chapter__show-logo 0.6s ease 1.2s forwards; + } + a:nth-child(3) { + animation: last-chapter__show-logo 0.6s ease 1.3s forwards; + } + a:nth-child(4) { + animation: last-chapter__show-logo 0.6s ease 1.4s forwards; + } + a:nth-child(5) { + animation: last-chapter__show-logo 0.6s ease 1.5s forwards; + } } - .star:nth-child(2) { - animation: last-chapter__show-decoration 0.6s ease 1.9s forwards; +} + +.animation-done { + .show { + animation: slide-bottom 0.05s ease 0s forwards; + + .menu__space { + div:nth-child(1) { + animation: menu__show-space-bg 0.2s ease 0.05s forwards; + } + div:nth-child(2) { + animation: menu__show-space-bg 0.2s ease 0.1s forwards; + } + div:nth-child(3) { + animation: menu__show-space-bg 0.2s ease 0.15s forwards; + } + div:nth-child(4) { + animation: menu__show-space-bg 0.2s ease 0.2s forwards; + } + &::before { + animation: fadein 0.6s ease 0.4s forwards; + } + &::after { + animation: menu__down-word 0.4s ease 0.4s forwards; + } + } + + .menu__box { + animation: menu__show-nav 0.4s ease 0s forwards; + + .menu-title { + animation: fadein 0.2s ease 0.4s forwards; + } + .nav { + a:nth-child(1) { + animation: fadein 0.2s ease 0.4s forwards; + } + a:nth-child(2) { + animation: fadein 0.2s ease 0.4s forwards; + } + a:nth-child(3) { + animation: fadein 0.2s ease 0.4s forwards; + } + a:nth-child(4) { + animation: fadein 0.2s ease 0.4s forwards; + } + a:nth-child(5) { + animation: fadein 0.2s ease 0.4s forwards; + } + } + .colors { + div:nth-child(1) { + animation: scale0-1 0.1s ease 0.4s forwards; + } + div:nth-child(2) { + animation: scale0-1 0.1s ease 0.5s forwards; + } + div:nth-child(3) { + animation: scale0-1 0.1s ease 0.6s forwards; + } + div:nth-child(4) { + animation: scale0-1 0.1s ease 0.7s forwards; + } + } + } + + .menu__close-btn { + animation: slide-left 0.2s cubic-bezier(0.06, 0.51, 0.01, 1.03) 0.4s + forwards; + } } - .moon { - animation: last-chapter__show-decoration 0.6s ease 2s forwards; + + .last-chapter__frame { + opacity: 1; + transform: none; } - .star:nth-child(3) { - animation: last-chapter__show-decoration 0.6s ease 2.1s forwards; + + .last-chapter__ball { + transform: scale(1); } -} -.last-chapter__sns-nav { - a:nth-child(1) { - animation: last-chapter__show-logo 0.6s ease 1.1s forwards; + .last-chapter__ball::after { + opacity: 1; + } + + .last-chapter__bg-help { + opacity: 1; + } + + .last-chapter__bg::before, + .last-chapter__bg::after { + transform: scale(1); } - a:nth-child(2) { - animation: last-chapter__show-logo 0.6s ease 1.2s forwards; + + .last-chapter__logo { + transform: scale(1); } - a:nth-child(3) { - animation: last-chapter__show-logo 0.6s ease 1.3s forwards; + + .last-chapter__menu-btn { + transform: scale(1); } - a:nth-child(4) { - animation: last-chapter__show-logo 0.6s ease 1.4s forwards; + + .last-chapter__sns-nav a { + transform: scale(1); } - a:nth-child(5) { - animation: last-chapter__show-logo 0.6s ease 1.5s forwards; + + .last-chapter__decoration { + .moon, + .star { + transform: translateY(-5%); + } } } @@ -937,77 +1123,6 @@ $last-chapter__theme-red: #c45c66; /**************************************************************** animation *****************************************************************/ -.show { - animation: slide-bottom 0.05s ease 0s forwards; - - .menu__space { - div:nth-child(1) { - animation: menu__show-space-bg 0.6s ease 0.1s forwards; - } - div:nth-child(2) { - animation: menu__show-space-bg 0.6s ease 0.2s forwards; - } - div:nth-child(3) { - animation: menu__show-space-bg 0.6s ease 0.3s forwards; - } - div:nth-child(4) { - animation: menu__show-space-bg 0.6s ease 0.4s forwards; - } - &::before { - animation: fadein 1s ease 1s forwards; - } - &::after { - animation: menu__down-word 0.6s ease 1s forwards; - } - } - - .menu__box { - animation: menu__show-nav 0.6s ease 0s forwards; - - .menu-title { - animation: fadein 0.5s ease 0.6s forwards; - } - .nav { - a:nth-child(1) { - animation: fadein 0.7s ease 0.7s forwards; - } - a:nth-child(2) { - animation: fadein 0.7s ease 0.8s forwards; - } - a:nth-child(3) { - animation: fadein 0.7s ease 0.9s forwards; - } - a:nth-child(4) { - animation: fadein 0.7s ease 1s forwards; - } - a:nth-child(5) { - animation: fadein 0.7s ease 1.1s forwards; - } - } - .colors { - div:nth-child(1) { - animation: scale0-1 0.4s ease 0.7s forwards; - } - div:nth-child(2) { - animation: scale0-1 0.4s ease 0.8s forwards; - } - div:nth-child(3) { - animation: scale0-1 0.4s ease 0.9s forwards; - } - div:nth-child(4) { - animation: scale0-1 0.4s ease 1s forwards; - } - div:nth-child(4) { - animation: scale0-1 0.4s ease 1.1s forwards; - } - } - } - - .menu__close-btn { - animation: slide-left 0.6s cubic-bezier(0.06, 0.51, 0.01, 1.03) 1.4s - forwards; - } -} // @font-face { // font-family: 'ZCOOL KuaiLe'; /* 字体的名称 */ diff --git a/src/contents/pages/index.tsx b/src/contents/pages/index.tsx index 72cc2b7..ede7754 100755 --- a/src/contents/pages/index.tsx +++ b/src/contents/pages/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import { useState } from "react"; import styles from "@site/src/contents/pages/index.module.scss"; import Link from "@docusaurus/Link"; @@ -17,8 +17,108 @@ import Svg from "./about/_Svg"; function AboutComponent() { const [dropMenu, setDropMenu] = useState(false); + const [hasPlayedAnimation, setHasPlayedAnimation] = useState(false); + + useEffect(() => { + const isFirstVisit = !sessionStorage.getItem("hasPlayedAnimation"); + console.log(isFirstVisit); + + if (isFirstVisit) { + setHasPlayedAnimation(false); + sessionStorage.setItem("hasPlayedAnimation", "true"); + } else { + setHasPlayedAnimation(true); + } + }, []); + + const DropMenu = ({ dropMenu, setDropMenu }) => ( +
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+ +
+ ); + return ( -
+
@@ -46,7 +146,9 @@ function AboutComponent() { type="button" className={styles["last-chapter__menu-btn"]} aria-expanded={dropMenu ? "true" : "false"} - onClick={() => setDropMenu((prev) => !prev)} + onClick={() => { + setDropMenu((prev) => !prev); + }} >
@@ -57,83 +159,6 @@ function AboutComponent() { ); } -const DropMenu = ({ dropMenu, setDropMenu }) => ( -
-
-
-
-
-
-
-
-
- - -
-
-
-
-
-
-
- -
-); - export default function Home(): JSX.Element { return (
From 35e91208da6f542d66fa630351cd8370cd560dd3 Mon Sep 17 00:00:00 2001 From: MuelNova Date: Tue, 1 Oct 2024 00:28:37 +0800 Subject: [PATCH 10/10] :children_crossing: Improve usability for index page --- src/contents/pages/index.module.scss | 72 +++++++++++++++++++++++ src/contents/pages/index.tsx | 32 +++++++--- src/static/img/index/menu/ani_disable.svg | 6 ++ src/static/img/index/menu/ani_enable.svg | 5 ++ 4 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 src/static/img/index/menu/ani_disable.svg create mode 100644 src/static/img/index/menu/ani_enable.svg diff --git a/src/contents/pages/index.module.scss b/src/contents/pages/index.module.scss index c04693f..602f3af 100755 --- a/src/contents/pages/index.module.scss +++ b/src/contents/pages/index.module.scss @@ -513,6 +513,67 @@ $last-chapter__theme-red: #c45c66; } } +/*** anibtn ***/ +.anibtn { + position: absolute; + background-color: $last-chapter__theme-white; + border-radius: 5px; + display: flex; + z-index: 2; + justify-content: center; + overflow: hidden; + transform: scale(0.01); + + @include mixin.pc-layout { + bottom: 50px; + right: 50px; + width: 45px; + height: 45px; + } + @include mixin.sp-layout { + bottom: 30px; + right: 20px; + width: 40px; + height: 40px; + } + + &::before { + content: ""; + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + transform: scale(0.001); + background-color: $last-chapter__theme-blue; + transition: all 0.4s cubic-bezier(0.77, 0, 0.17, 1.02) 0s; + } + + &:hover::before { + transform: scale(1); + } + + svg { + position: absolute; + cursor: pointer; + @include mixin.pc-layout { + top: 5px; + left: 5px; + width: calc(100% - 10px); + height: calc(100% - 10px); + } + @include mixin.sp-layout { + top: 2.5px; + left: 2.5px; + width: calc(100% - 5px); + height: calc(100% - 5px); + } + stroke: $last-chapter__theme-black; + stroke-width: 3; + } +} + // Animation .last-chapter__decoration { .star::after { @@ -624,6 +685,10 @@ $last-chapter__theme-red: #c45c66; animation: last-chapter__show-logo 0.6s ease 1.6s forwards; } + .anibtn { + animation: last-chapter__show-logo 0.6s ease 1.6s forwards; + } + .last-chapter__decoration { .moon { animation: last-chapter__show-decoration 0.6s ease 2s forwards; @@ -658,6 +723,9 @@ $last-chapter__theme-red: #c45c66; a:nth-child(5) { animation: last-chapter__show-logo 0.6s ease 1.5s forwards; } + a:nth-child(6) { + animation: last-chapter__show-logo 0.6s ease 1.6s forwards; + } } } @@ -761,6 +829,10 @@ $last-chapter__theme-red: #c45c66; transform: scale(1); } + .anibtn { + transform: scale(1); + } + .last-chapter__sns-nav a { transform: scale(1); } diff --git a/src/contents/pages/index.tsx b/src/contents/pages/index.tsx index ede7754..c55d4ee 100755 --- a/src/contents/pages/index.tsx +++ b/src/contents/pages/index.tsx @@ -8,22 +8,24 @@ import StarIcon from "@site/src/static/img/index/menu/star.svg"; import MoonIcon from "@site/src/static/img/index/menu/moon.svg"; import DogIcon from "@site/src/static/img/index/menu/dog.svg"; import MountainIcon from "@site/src/static/img/index/menu/mountain.svg"; -import ProfileImg from "@site/src/static/img/index/menu/menu-1.svg"; -import SiteImg from "@site/src/static/img/index/menu/menu-2.svg"; -import ProductImg from "@site/src/static/img/index/menu/menu-3.svg"; -import MemoriesImg from "@site/src/static/img/index/menu/menu-4.svg"; +import AniEnabledIcon from "@site/src/static/img/index/menu/ani_enable.svg"; +import AniDisabledIcon from "@site/src/static/img/index/menu/ani_disable.svg"; import svgList from "@site/src/theme/utils/_SocialMediaList"; import Svg from "./about/_Svg"; function AboutComponent() { const [dropMenu, setDropMenu] = useState(false); const [hasPlayedAnimation, setHasPlayedAnimation] = useState(false); + const [disableAnimation, setDisableAnimation] = useState(false); useEffect(() => { - const isFirstVisit = !sessionStorage.getItem("hasPlayedAnimation"); - console.log(isFirstVisit); + const savedDisableAnimation = + localStorage.getItem("disableAnimation") === "true"; + setDisableAnimation(savedDisableAnimation); - if (isFirstVisit) { + const showFirstAnimation = !sessionStorage.getItem("hasPlayedAnimation"); + + if (!savedDisableAnimation && showFirstAnimation) { setHasPlayedAnimation(false); sessionStorage.setItem("hasPlayedAnimation", "true"); } else { @@ -31,7 +33,7 @@ function AboutComponent() { } }, []); - const DropMenu = ({ dropMenu, setDropMenu }) => ( + const DropMenu = () => (
@@ -142,6 +144,18 @@ function AboutComponent() { })} + + - +
); } diff --git a/src/static/img/index/menu/ani_disable.svg b/src/static/img/index/menu/ani_disable.svg new file mode 100644 index 0000000..e3bdcff --- /dev/null +++ b/src/static/img/index/menu/ani_disable.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/static/img/index/menu/ani_enable.svg b/src/static/img/index/menu/ani_enable.svg new file mode 100644 index 0000000..84c6f35 --- /dev/null +++ b/src/static/img/index/menu/ani_enable.svg @@ -0,0 +1,5 @@ + + + + +