From fc415d188b39f026cee09a90c5f34eaaa954de83 Mon Sep 17 00:00:00 2001 From: yunji Date: Mon, 11 Nov 2024 22:06:11 +0800 Subject: [PATCH] chore: clean old workspace --- .editorconfig | 13 ------ .eslintrc.js | 3 -- .gitignore | 30 ------------ .husky/pre-commit | 4 -- .prettierignore | 2 - .prettierrc.js | 19 -------- README.md | 10 ++-- dev/demo/basic.ts | 21 --------- dev/demo/index.ts | 1 - dev/index.html | 7 --- dev/main.tsx | 45 ------------------ package.json | 83 ++++++--------------------------- src/components/A/index.tsx | 25 ---------- src/components/Code/index.tsx | 12 ----- src/components/index.ts | 6 --- src/core/Conversation/index.tsx | 30 ------------ src/core/index.ts | 1 - src/global.d.ts | 22 --------- src/index.css | 7 --- src/index.ts | 4 -- tailwind.config.js | 12 ----- tailwind.css | 7 --- tsconfig.json | 22 --------- vite.config.js | 7 --- 24 files changed, 18 insertions(+), 375 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitignore delete mode 100755 .husky/pre-commit delete mode 100644 .prettierignore delete mode 100644 .prettierrc.js delete mode 100644 dev/demo/basic.ts delete mode 100644 dev/demo/index.ts delete mode 100644 dev/index.html delete mode 100644 dev/main.tsx delete mode 100644 src/components/A/index.tsx delete mode 100644 src/components/Code/index.tsx delete mode 100644 src/components/index.ts delete mode 100644 src/core/Conversation/index.tsx delete mode 100644 src/core/index.ts delete mode 100644 src/global.d.ts delete mode 100644 src/index.css delete mode 100644 src/index.ts delete mode 100644 tailwind.config.js delete mode 100644 tailwind.css delete mode 100644 tsconfig.json delete mode 100644 vite.config.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index e717f5e..0000000 --- a/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2898340..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: require.resolve('@umijs/lint/dist/config/eslint'), -}; diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 64f1da6..0000000 --- a/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -yarn.lock -package-lock.json -pnpm-lock.yaml - -# Sys -.DS_Store -.idea - -# Node -node_modules/ -.npmrc - -# Build -dist -lib -esm -es - -# Test -coverage - -# Bundle visualizer -stats.html diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index d24fdfc..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npx lint-staged diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 6a50e20..0000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -/dist -*.yaml diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index e6df093..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - pluginSearchDirs: false, - plugins: [ - require.resolve('prettier-plugin-organize-imports'), - require.resolve('prettier-plugin-packagejson'), - ], - printWidth: 80, - proseWrap: 'never', - singleQuote: true, - trailingComma: 'all', - overrides: [ - { - files: '*.md', - options: { - proseWrap: 'preserve', - }, - }, - ], -}; diff --git a/README.md b/README.md index 426cd63..bf84562 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,15 @@ $npm i --save gpt-vis ## 快速使用 -快速使用 gpt-vis渲染出对话卡片的 UI。 +快速使用 gpt-vis 渲染出对话卡片的 UI。 ```tsx -import { Conversation, Components } from 'gpt-vis'; +import { Conversation, Components } from "gpt-vis"; function Demo() { // 服务端返回的协议内容 const content = - '# GPT-VIS \n\nComponents for GPTs, generative AI, and LLM projects. Not only UI Components.'; + "# GPT-VIS \n\nComponents for GPTs, generative AI, and LLM projects. Not only UI Components."; return {content}; } @@ -42,10 +42,10 @@ function Demo() { 使用自定义的 UI 组件。UI 渲染最终使用 markdown 格式,所以自定义的方式有两种,一种是基于 markdown code 标签去扩展语言,一种是扩展标签。 ````tsx -import { Conversation, Components } from 'gpt-vis'; +import { Conversation, Components } from "gpt-vis"; const custom = { - 'my-ui': () => {}, + "my-ui": () => {}, }; function Demo() { diff --git a/dev/demo/basic.ts b/dev/demo/basic.ts deleted file mode 100644 index cb9a297..0000000 --- a/dev/demo/basic.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const Basic = ` -# [GPT-VIS](https://github.com/eosphoros-ai/GPT-VIS) - -Components for GPTs, generative AI, and LLM projects. Not only UI Components.; - -
- -Some *emphasis* and strong! - -
- -Here is some JavaScript code: - -~~~js -const greeting = 'hello, world'; - -const sayHello = (greeting) => {} - -sayHello(greeting); -~~~ -`; diff --git a/dev/demo/index.ts b/dev/demo/index.ts deleted file mode 100644 index d0b140f..0000000 --- a/dev/demo/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Basic } from './basic'; diff --git a/dev/index.html b/dev/index.html deleted file mode 100644 index 1496fd8..0000000 --- a/dev/index.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - -
-
- \ No newline at end of file diff --git a/dev/main.tsx b/dev/main.tsx deleted file mode 100644 index db92fe4..0000000 --- a/dev/main.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React, { StrictMode } from 'react'; -import { createRoot } from 'react-dom/client'; -import { Components, Conversation } from '../src'; -import * as markdowns from './demo'; - -const select = document.getElementById('selector') as HTMLSelectElement; -select.onchange = () => { - const { value } = select; - history.pushState({ value }, '', `?name=${value}`); - // eslint-disable-next-line @typescript-eslint/no-use-before-define - render(); -}; -select.style.display = 'block'; -select.style.minWidth = '120px'; - -Object.keys(markdowns).forEach((d) => { - const option = document.createElement('option'); - option.textContent = d; - option.value = d; - select.append(option); -}); - -let root; -/** - * 渲染 markdown 组件 - */ -function render() { - if (root) root.unmount(); - const markdown = markdowns[select.value]; - - root = createRoot(document.getElementById('root')!); - - root.render( - - {markdown} - , - ); -} - -const initialValue = new URL(location as any).searchParams.get( - 'name', -) as string; -if (markdowns[initialValue]) select.value = initialValue; - -render(); diff --git a/package.json b/package.json index c709f5f..a12aac2 100644 --- a/package.json +++ b/package.json @@ -1,79 +1,22 @@ { - "name": "GPT-Vis", + "name": "@antv/gpt-vis", "version": "0.0.1", "description": "GPT-Vis", - "repository": "git@github.com:eosphoros-ai/GPT-Vis.git", + "repository": "git@github.com:antvis/GPT-Vis.git", "license": "MIT", + "author": "antvis", "sideEffects": false, - "module": "es/index.js", - "types": "es/index.d.ts", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "typings": "dist/esm/index.d.ts", "files": [ - "src", - "lib", - "es" + "dist", + "README.md" ], - "scripts": { - "build": "npm run build:lib && npm run build:es", - "build:es": "rm -rf es && tsc --module esnext --outDir es", - "build:lib": "rm -rf lib && tsc --module commonjs --outDir lib", - "dev": "vite dev", - "prepublishOnly": "npm run build" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{md,json}": [ - "prettier --write --no-error-on-unmatched-pattern" - ], - "*.{css,less}": [ - "prettier --write" - ], - "*.{js,jsx}": [ - "eslint --fix", - "prettier --write" - ], - "*.{ts,tsx}": [ - "eslint --fix", - "prettier --parser=typescript --write" - ] - }, - "dependencies": { - "@ant-design/icons": "^5.2.6", - "@antv/ava": "^3.3.1", - "@berryv/g2-react": "^0.1.0", - "antd": "^5.12.2", - "copy-to-clipboard": "^3.3.3", - "lodash": "^4.17.21", - "react-markdown": "^8.0.7", - "react-syntax-highlighter": "^15.5.0", - "rehype-raw": "6.1.1", - "sql-formatter": "^14.0.0" - }, - "devDependencies": { - "@types/lodash": "^4.14.202", - "@types/react": "^18.2.45", - "@types/react-dom": "^18.2.18", - "@types/react-syntax-highlighter": "^15.5.11", - "@umijs/lint": "^4.0.89", - "@umijs/plugins": "^4.0.89", - "eslint": "^8.56.0", - "husky": "^8.0.3", - "lint-staged": "^15.2.0", - "prettier": "^3.1.1", - "prettier-plugin-organize-imports": "^3.2.4", - "prettier-plugin-packagejson": "^2.4.7", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "tailwindcss": "^3.3.6", - "typescript": "^5.4.5", - "vite": "^5.2.13" - }, + "scripts": {}, + "dependencies": {}, + "devDependencies": {}, "peerDependencies": { - "react": ">=16.9.0", - "react-dom": ">=16.9.0" - }, - "authors": [] + "react": ">=16.9.0" + } } diff --git a/src/components/A/index.tsx b/src/components/A/index.tsx deleted file mode 100644 index e3d1667..0000000 --- a/src/components/A/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { LinkOutlined } from '@ant-design/icons'; -import React from 'react'; - -export type AProps = { - /** - * 链接地址 - */ - href: string; - /** - * - */ - children: string; -}; - -export const A: React.FC = ({ href, children }) => { - console.log(222, children, href); - return ( -
- - - {children} - -
- ); -}; diff --git a/src/components/Code/index.tsx b/src/components/Code/index.tsx deleted file mode 100644 index 3bbfb3d..0000000 --- a/src/components/Code/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; - -export type CodeProps = { - className: string; - inline: boolean; - style: CSSStyleDeclaration; - children: JSX.Element; -}; - -export const Reference: React.FC = () => { - return
; -}; diff --git a/src/components/index.ts b/src/components/index.ts deleted file mode 100644 index 2c77bbd..0000000 --- a/src/components/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Components as ComponentsType } from 'react-markdown'; -import { A } from './A'; - -export const Components: ComponentsType = { - a: A, -}; diff --git a/src/core/Conversation/index.tsx b/src/core/Conversation/index.tsx deleted file mode 100644 index 24db827..0000000 --- a/src/core/Conversation/index.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import Markdown, { Options } from 'react-markdown'; -import rehypeRaw from 'rehype-raw'; - -export type ConversationProps = { - /** - * 需要被渲染的 markdown 字符串 - */ - children: string; - /** - * 注册的组件 - */ - components?: Options['components']; - /** - * 注册的 rehype 插件 - */ - // rehypePlugins: Options['rehypePlugins']; -}; - -export const Conversation: React.FC = ({ - children, - components, -}) => { - console.log('components', components, children); - return ( - - {children} - - ); -}; diff --git a/src/core/index.ts b/src/core/index.ts deleted file mode 100644 index cfb9ea9..0000000 --- a/src/core/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Conversation } from './Conversation'; diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index 22f0fe6..0000000 --- a/src/global.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare namespace JSX { - interface IntrinsicElements { - 'chart-view': React.DetailedHTMLProps< - React.HTMLAttributes, - HTMLElement - >; - 'custom-view': React.DetailedHTMLProps< - React.HTMLAttributes, - HTMLElement - >; - 'references-view': React.DetailedHTMLProps< - React.HTMLAttributes & { - references: any; - }, - HTMLElement - >; - 'summary-view': React.DetailedHTMLProps< - React.HTMLAttributes, - HTMLElement - >; - } -} diff --git a/src/index.css b/src/index.css deleted file mode 100644 index 0ca23c5..0000000 --- a/src/index.css +++ /dev/null @@ -1,7 +0,0 @@ -.markdown p { - margin-block-end: 12px; -} - -.markdown blockquote { - margin-block-end: 12px; -} diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 192078f..0000000 --- a/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { Components } from './components'; -export { Conversation } from './core/Conversation'; - -import './index.css'; diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 1db67d1..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,12 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'], - darkMode: 'class', - theme: { - fontFamily: { - sans: ['"Josefin Sans"'], - }, - extend: {}, - }, - plugins: [], -}; diff --git a/tailwind.css b/tailwind.css deleted file mode 100644 index cc826d3..0000000 --- a/tailwind.css +++ /dev/null @@ -1,7 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -svg { - display: inline-block; -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index c3185b8..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "strictNullChecks": true, - "module": "esnext", - "moduleResolution": "node", - "esModuleInterop": true, - "experimentalDecorators": true, - "jsx": "react", - "jsxFactory": "React.createElement", - "jsxFragmentFactory": "React.Fragment", - "noUnusedParameters": true, - "noUnusedLocals": true, - "noImplicitAny": true, - "target": "es6", - "lib": ["dom", "es2017"], - "skipLibCheck": true, - "stripInternal": true, - "declaration": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "lib", "es"] -} diff --git a/vite.config.js b/vite.config.js deleted file mode 100644 index 5d00302..0000000 --- a/vite.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import path from 'path'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - root: path.resolve('./dev'), - server: { port: 8080, open: '/' }, -});