@bbki.ng/site 1.0.16 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +5 -3
- package/public/pwa-192x192.png +0 -0
- package/public/pwa-512x512.png +0 -0
- package/src/components/reload_prompt/index.tsx +28 -13
- package/src/main.tsx +2 -0
- package/tsconfig.json +1 -1
- package/{vite.config.ts → vite.config.js} +8 -9
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,12 +24,14 @@
|
|
|
24
24
|
"react-dom": "^18.0.0",
|
|
25
25
|
"react-hotkeys-hook": "^3.4.3",
|
|
26
26
|
"react-router-dom": "6",
|
|
27
|
+
"sonner": "1.4.0",
|
|
27
28
|
"swr": "^1.2.1"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@bbki.ng/stylebase": "workspace:0.0.19",
|
|
31
32
|
"@mdx-js/mdx": "2.0.0-next.9",
|
|
32
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
|
+
"@mdx-js/rollup": "3.0.0",
|
|
33
35
|
"@tailwindcss/typography": "^0.5.0",
|
|
34
36
|
"@types/jest": "^27.0.3",
|
|
35
37
|
"@types/node": "^16.11.1",
|
|
@@ -46,7 +48,7 @@
|
|
|
46
48
|
"rehype-autolink-headings": "^6.1.1",
|
|
47
49
|
"rehype-highlight": "^5.0.0",
|
|
48
50
|
"rehype-slug": "^5.0.1",
|
|
49
|
-
"remark-frontmatter": "
|
|
51
|
+
"remark-frontmatter": "5.0.0",
|
|
50
52
|
"remark-gfm": "^3.0.0",
|
|
51
53
|
"remark-mdx-frontmatter": "^1.0.1",
|
|
52
54
|
"remark-parse": "^10.0.0",
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
"tailwindcss": "^3.0.7",
|
|
56
58
|
"ts-jest": "^27.1.1",
|
|
57
59
|
"typescript": "^4.5.4",
|
|
58
|
-
"vite": "
|
|
60
|
+
"vite": "5.0.0",
|
|
59
61
|
"vite-plugin-mdx": "^3.5.8",
|
|
60
62
|
"vite-plugin-pwa": "^0.11.3",
|
|
61
63
|
"workbox-window": "^6.3.0"
|
package/public/pwa-192x192.png
CHANGED
|
Binary file
|
package/public/pwa-512x512.png
CHANGED
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { toast } from "sonner";
|
|
2
3
|
|
|
3
4
|
// @ts-ignore
|
|
4
5
|
import { useRegisterSW } from "virtual:pwa-register/react";
|
|
5
|
-
import { CornerPromptBox } from "@/components";
|
|
6
6
|
|
|
7
7
|
export const ReloadPrompt = () => {
|
|
8
8
|
const {
|
|
@@ -21,16 +21,31 @@ export const ReloadPrompt = () => {
|
|
|
21
21
|
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
const appVer = GLOBAL_BBKING_VERSION;
|
|
24
|
-
console.log("appVer: ", appVer);
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!needRefresh) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
toast("", {
|
|
31
|
+
description: "检测到更新,当前 v" + appVer + "。是否更新?",
|
|
32
|
+
position: "bottom-center",
|
|
33
|
+
actionButtonStyle: {
|
|
34
|
+
backgroundColor: "#fff",
|
|
35
|
+
color: "rgb(37,99,235)",
|
|
36
|
+
},
|
|
37
|
+
action: {
|
|
38
|
+
label: "是",
|
|
39
|
+
onClick: () => {
|
|
40
|
+
if (!needRefresh) {
|
|
41
|
+
setNeedRefresh(false);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
updateServiceWorker(true);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
50
|
+
return null;
|
|
36
51
|
};
|
package/src/main.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { Toaster } from "sonner";
|
|
3
4
|
import { BrowserRouter as Router } from "react-router-dom";
|
|
4
5
|
import { ReloadPrompt } from "@/components";
|
|
5
6
|
import "@bbki.ng/components/style";
|
|
@@ -14,6 +15,7 @@ root.render(
|
|
|
14
15
|
<Router>
|
|
15
16
|
<ReloadPrompt />
|
|
16
17
|
<App />
|
|
18
|
+
<Toaster />
|
|
17
19
|
</Router>
|
|
18
20
|
</React.StrictMode>
|
|
19
21
|
);
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { defineConfig } from "vite";
|
|
3
3
|
import { VitePWA } from "vite-plugin-pwa";
|
|
4
|
-
import mdx from "
|
|
4
|
+
import mdx from "@mdx-js/rollup";
|
|
5
5
|
import remarkGfm from "remark-gfm";
|
|
6
6
|
import remarkParse from "remark-parse";
|
|
7
7
|
import remarkToc from "remark-toc";
|
|
8
|
-
import
|
|
8
|
+
import remarkFrontMatter from "remark-frontmatter";
|
|
9
9
|
import { remarkMdxFrontmatter } from "remark-mdx-frontmatter";
|
|
10
10
|
import rehypeSlug from "rehype-slug";
|
|
11
11
|
import rehypeHighlight from "rehype-highlight";
|
|
@@ -13,11 +13,10 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
|
|
13
13
|
import react from "@vitejs/plugin-react";
|
|
14
14
|
|
|
15
15
|
const options = {
|
|
16
|
-
// See https://mdxjs.com/advanced/plugins
|
|
17
16
|
remarkPlugins: [
|
|
18
17
|
remarkParse,
|
|
19
18
|
[remarkToc, { maxDepth: 3, heading: "目录", tight: true }],
|
|
20
|
-
[
|
|
19
|
+
[remarkFrontMatter, { type: "yaml", marker: "-" }],
|
|
21
20
|
[remarkMdxFrontmatter, { name: "meta" }],
|
|
22
21
|
remarkGfm,
|
|
23
22
|
],
|
|
@@ -47,11 +46,11 @@ export default defineConfig({
|
|
|
47
46
|
GLOBAL_BBKING_VERSION: JSON.stringify(process.env.npm_package_version),
|
|
48
47
|
},
|
|
49
48
|
esbuild: {
|
|
50
|
-
logOverride: {
|
|
49
|
+
logOverride: { "this-is-undefined-in-esm": "silent" },
|
|
51
50
|
},
|
|
52
51
|
plugins: [
|
|
53
52
|
react(),
|
|
54
|
-
|
|
53
|
+
mdx(options),
|
|
55
54
|
VitePWA({
|
|
56
55
|
includeAssets: [
|
|
57
56
|
"favicon.svg",
|
|
@@ -80,9 +79,9 @@ export default defineConfig({
|
|
|
80
79
|
],
|
|
81
80
|
},
|
|
82
81
|
manifest: {
|
|
83
|
-
name: "
|
|
84
|
-
short_name: "
|
|
85
|
-
description: "
|
|
82
|
+
name: "bbki.ng",
|
|
83
|
+
short_name: "bbki.ng",
|
|
84
|
+
description: "words, pictures",
|
|
86
85
|
theme_color: "#ffffff",
|
|
87
86
|
icons: [
|
|
88
87
|
{
|