From aa3b0d118e4340af9c7805c5666c03931e832298 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sat, 3 Aug 2024 02:22:25 +0800 Subject: [PATCH] chore: add example #269 --- examples/#269/.kktrc.ts | 11 +++++++++ examples/#269/package.json | 34 ++++++++++++++++++++++++++++ examples/#269/public/index.html | 17 ++++++++++++++ examples/#269/src/example.tsx | 34 ++++++++++++++++++++++++++++ examples/#269/src/index.tsx | 7 ++++++ examples/#269/src/react-app-env.d.ts | 1 + examples/#269/tsconfig.json | 7 ++++++ lerna.json | 2 +- package.json | 1 + website/package.json | 1 - 10 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 examples/#269/.kktrc.ts create mode 100644 examples/#269/package.json create mode 100644 examples/#269/public/index.html create mode 100644 examples/#269/src/example.tsx create mode 100644 examples/#269/src/index.tsx create mode 100644 examples/#269/src/react-app-env.d.ts create mode 100644 examples/#269/tsconfig.json diff --git a/examples/#269/.kktrc.ts b/examples/#269/.kktrc.ts new file mode 100644 index 00000000..98627546 --- /dev/null +++ b/examples/#269/.kktrc.ts @@ -0,0 +1,11 @@ +import { LoaderConfOptions, WebpackConfiguration } from 'kkt'; + +export default (conf: WebpackConfiguration, env: 'production' | 'development', options: LoaderConfOptions) => { + conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }]; + // https://github.com/kktjs/kkt/issues/336#issue-1097660932 + conf.module!.exprContextCritical = false; + if (env === 'production') { + conf.output = { ...conf.output, publicPath: './' }; + } + return conf; +}; diff --git a/examples/#269/package.json b/examples/#269/package.json new file mode 100644 index 00000000..8ceaa5a7 --- /dev/null +++ b/examples/#269/package.json @@ -0,0 +1,34 @@ +{ + "name": "@examples/269", + "version": "5.1.1", + "private": true, + "scripts": { + "build": "kkt build", + "start": "kkt start" + }, + "dependencies": { + "react": "~18.2.0", + "react-dom": "~18.2.0", + "rehype-sanitize": "^6.0.0" + }, + "devDependencies": { + "@kkt/less-modules": "^7.4.7", + "@kkt/scope-plugin-options": "^7.4.7", + "kkt": "^7.4.7" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/examples/#269/public/index.html b/examples/#269/public/index.html new file mode 100644 index 00000000..972ba7fd --- /dev/null +++ b/examples/#269/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + React Markdown Preview + + + + + +
+ + + diff --git a/examples/#269/src/example.tsx b/examples/#269/src/example.tsx new file mode 100644 index 00000000..53d7d64d --- /dev/null +++ b/examples/#269/src/example.tsx @@ -0,0 +1,34 @@ +import rehypeSanitize, { defaultSchema } from 'rehype-sanitize'; +import MarkdownPreview from '@uiw/react-markdown-preview'; + +const source = ` +## MarkdownPreview + +\`\`\`bash +$ npm install @uiw/react-markdown-preview --save +\`\`\` +`; + +export default function Demo() { + return ( + + ); +} diff --git a/examples/#269/src/index.tsx b/examples/#269/src/index.tsx new file mode 100644 index 00000000..2046ae39 --- /dev/null +++ b/examples/#269/src/index.tsx @@ -0,0 +1,7 @@ +import { createRoot } from 'react-dom/client'; +import Demo from './example'; + +const container = document.getElementById('root'); +const root = createRoot(container!); + +root.render(); diff --git a/examples/#269/src/react-app-env.d.ts b/examples/#269/src/react-app-env.d.ts new file mode 100644 index 00000000..6431bc5f --- /dev/null +++ b/examples/#269/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/examples/#269/tsconfig.json b/examples/#269/tsconfig.json new file mode 100644 index 00000000..7b8b6e44 --- /dev/null +++ b/examples/#269/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "baseUrl": "./" + }, + "include": ["src"] +} diff --git a/lerna.json b/lerna.json index 91cae239..6db50dc4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "version": "5.1.2", - "packages": ["core", "website"] + "packages": ["core", "examples/**", "website"] } diff --git a/package.json b/package.json index bd3c8f23..0f1c257d 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "node": ">=16.0.0" }, "workspaces": [ + "examples/**", "core", "website" ] diff --git a/website/package.json b/website/package.json index 351ee6a6..8868ca28 100644 --- a/website/package.json +++ b/website/package.json @@ -14,7 +14,6 @@ "mermaid": "^10.6.1", "react": "~18.2.0", "react-dom": "~18.2.0", - "react-router-dom": "^6.8.1", "rehype-sanitize": "^6.0.0" }, "devDependencies": {