diff --git a/.changelogrc.js b/.changelogrc.js new file mode 100644 index 0000000..9a2f5f9 --- /dev/null +++ b/.changelogrc.js @@ -0,0 +1 @@ +module.exports = require('@lobehub/lint').changelog; diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..9b8c6ac --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1 @@ +module.exports = require('@lobehub/lint').commitlint; diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7e3649a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# 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 + +[Makefile] +indent_style = tab diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..305d1ef --- /dev/null +++ b/.eslintignore @@ -0,0 +1,30 @@ +# Eslintignore for LobeHub +################################################################ + +# dependencies +node_modules + +# ci +coverage +.coverage + +# test +jest* +_test_ +__test__ + +# umi +.umi +.umi-production +.umi-test +.dumi/tmp* +!.dumirc.ts + +# production +dist +es +lib +logs + +# misc +# add other ignore file below diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..12aca84 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,9 @@ +const config = require('@lobehub/lint').eslint; + +module.exports = { + ...config, + rules: { + ...config.rules, + 'unicorn/prefer-string-replace-all': 0, + }, +}; diff --git a/.fatherrc.ts b/.fatherrc.ts new file mode 100644 index 0000000..0fe7b22 --- /dev/null +++ b/.fatherrc.ts @@ -0,0 +1,5 @@ +import { defineConfig } from 'father'; + +export default defineConfig({ + esm: { output: 'dist' }, +}); diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yml b/.github/ISSUE_TEMPLATE/1_bug_report.yml new file mode 100644 index 0000000..d181c38 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.yml @@ -0,0 +1,45 @@ +name: '🐛 反馈缺陷 Bug Report' +description: '反馈一个问题缺陷 | Report an bug' +title: '[Bug] ' +labels: '🐛 Bug' +body: + - type: dropdown + attributes: + label: '💻 系统环境 | Operating System' + options: + - Windows + - macOS + - Ubuntu + - Other Linux + - Other + validations: + required: true + - type: dropdown + attributes: + label: '🌐 浏览器 | Browser' + options: + - Chrome + - Edge + - Safari + - Firefox + - Other + validations: + required: true + - type: textarea + attributes: + label: '🐛 问题描述 | Bug Description' + description: A clear and concise description of the bug. + validations: + required: true + - type: textarea + attributes: + label: '🚦 期望结果 | Expected Behavior' + description: A clear and concise description of what you expected to happen. + - type: textarea + attributes: + label: '📷 复现步骤 | Recurrence Steps' + description: A clear and concise description of how to recurrence. + - type: textarea + attributes: + label: '📝 补充信息 | Additional Information' + description: If your problem needs further explanation, or if the issue you're seeing cannot be reproduced in a gist, please add more information here. diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.yml b/.github/ISSUE_TEMPLATE/2_feature_request.yml new file mode 100644 index 0000000..edcf7d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.yml @@ -0,0 +1,21 @@ +name: '🌠 功能需求 Feature Request' +description: '需求或建议 | Suggest an idea' +title: '[Request] ' +labels: '🌠 Feature Request' +body: + - type: textarea + attributes: + label: '🥰 需求描述 | Feature Description' + description: Please add a clear and concise description of the problem you are seeking to solve with this feature request. + validations: + required: true + - type: textarea + attributes: + label: '🧐 解决方案 | Proposed Solution' + description: Describe the solution you'd like in a clear and concise manner. + validations: + required: true + - type: textarea + attributes: + label: '📝 补充信息 | Additional Information' + description: Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/3_question.yml b/.github/ISSUE_TEMPLATE/3_question.yml new file mode 100644 index 0000000..f989f7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/3_question.yml @@ -0,0 +1,15 @@ +name: '😇 疑问或帮助 Help Wanted' +description: '疑问或需要帮助 | Need help' +title: '[Question] ' +labels: '😇 Help Wanted' +body: + - type: textarea + attributes: + label: '🧐 问题描述 | Proposed Solution' + description: A clear and concise description of the proplem. + validations: + required: true + - type: textarea + attributes: + label: '📝 补充信息 | Additional Information' + description: Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/4_other.md b/.github/ISSUE_TEMPLATE/4_other.md new file mode 100644 index 0000000..215dd1f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/4_other.md @@ -0,0 +1,7 @@ +--- +name: '📝 其他 Other' +about: '其他问题 | Other issues' +title: '' +labels: '' +assignees: '' +--- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7707b1a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ +#### 💻 变更类型 | Change Type + + + +- [ ] ✨ feat +- [ ] 🐛 fix +- [ ] 💄 style +- [ ] 🔨 chore +- [ ] 📝 docs + +#### 🔀 变更说明 | Description of Change + + + +#### 📝 补充信息 | Additional Information + + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c765809 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: '/' + schedule: + interval: monthly + time: '19:00' + timezone: 'Asia/Shanghai' + open-pull-requests-limit: 10 + versioning-strategy: increase + + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: monthly + time: '19:00' + timezone: 'Asia/Shanghai' diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 0000000..71cf0aa --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,32 @@ +name: Dependabot Auto Merge +on: + pull_request_target: + types: [labeled, edited] + +jobs: + merge: + if: contains(github.event.pull_request.labels.*.name, 'dependencies') + name: Dependabot Auto Merge + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 7 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install deps + run: pnpm install + + - name: Merge + uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + command: merge + target: minor + github-token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/contributor-help.yml b/.github/workflows/contributor-help.yml new file mode 100644 index 0000000..fd68fec --- /dev/null +++ b/.github/workflows/contributor-help.yml @@ -0,0 +1,29 @@ +name: Contributor Helper + +on: + # 🌏 Think about the planet! No need to update stats too frequently + schedule: [{ cron: '0 18 * * *' }] + # 💡 The following line lets you run workflow manually from the action tab! + workflow_dispatch: +jobs: + contributor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - uses: actions-cool/contributor-helper@v1 + with: + token: ${{ secrets.GH_TOKEN }} + style: 'simple' + update-files: 'README.md' + update-places: '/' + + - name: Commit and push if changed + run: |- + git diff + git config --global user.email "actions@github.com" + git config --global user.name "github-actions" + git pull + git add -A + git commit -m "🤖 docs: Auto update contributors" || exit 0 + git push diff --git a/.github/workflows/issue-check-inactive.yml b/.github/workflows/issue-check-inactive.yml new file mode 100644 index 0000000..d37c4c3 --- /dev/null +++ b/.github/workflows/issue-check-inactive.yml @@ -0,0 +1,22 @@ +name: Issue Check Inactive + +on: + schedule: + - cron: '0 0 */15 * *' + +permissions: + contents: read + +jobs: + issue-check-inactive: + permissions: + issues: write # for actions-cool/issues-helper to update issues + pull-requests: write # for actions-cool/issues-helper to update PRs + runs-on: ubuntu-latest + steps: + - name: check-inactive + uses: actions-cool/issues-helper@v3 + with: + actions: 'check-inactive' + inactive-label: 'Inactive' + inactive-day: 30 diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml new file mode 100644 index 0000000..68d6b6c --- /dev/null +++ b/.github/workflows/issue-close-require.yml @@ -0,0 +1,46 @@ +name: Issue Close Require + +on: + schedule: + - cron: '0 0 * * *' + +permissions: + contents: read + +jobs: + issue-close-require: + permissions: + issues: write # for actions-cool/issues-helper to update issues + pull-requests: write # for actions-cool/issues-helper to update PRs + runs-on: ubuntu-latest + steps: + - name: need reproduce + uses: actions-cool/issues-helper@v3 + with: + actions: 'close-issues' + labels: '✅ Fixed' + inactive-day: 3 + body: | + Since the issue was labeled with `✅ Fixed`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply. + + 由于该 issue 被标记为已修复,同时 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。 + - name: need reproduce + uses: actions-cool/issues-helper@v3 + with: + actions: 'close-issues' + labels: '🤔 Need Reproduce' + inactive-day: 3 + body: | + Since the issue was labeled with `🤔 Need Reproduce`, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply. + + 由于该 issue 被标记为需要更多信息,却 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。 + - name: need reproduce + uses: actions-cool/issues-helper@v3 + with: + actions: 'close-issues' + labels: "🙅🏻‍♀️ WON'T DO" + inactive-day: 3 + body: | + Since the issue was labeled with `🙅🏻‍♀️ WON'T DO`, and no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply. + + 由于该 issue 被标记为暂不处理,同时 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。 diff --git a/.github/workflows/issue-remove-inactive.yml b/.github/workflows/issue-remove-inactive.yml new file mode 100644 index 0000000..dbe42dd --- /dev/null +++ b/.github/workflows/issue-remove-inactive.yml @@ -0,0 +1,25 @@ +name: Issue Remove Inactive + +on: + issues: + types: [edited] + issue_comment: + types: [created, edited] + +permissions: + contents: read + +jobs: + issue-remove-inactive: + permissions: + issues: write # for actions-cool/issues-helper to update issues + pull-requests: write # for actions-cool/issues-helper to update PRs + runs-on: ubuntu-latest + steps: + - name: remove inactive + if: github.event.issue.state == 'open' && github.actor == github.event.issue.user.login + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + issue-number: ${{ github.event.issue.number }} + labels: 'Inactive' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..483815b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release CI +on: + push: + branches: + - master + - alpha + - beta + - rc + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install deps + run: pnpm install + + - name: Test + run: pnpm run test + + release: + needs: test + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install deps + run: pnpm install + + - name: build + run: pnpm run build + + - name: release + run: pnpm run release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3edee65 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test CI +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install deps + run: pnpm install + + - name: lint + run: pnpm run ci + + - name: Test and coverage + run: pnpm run test:coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef77bdb --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Gitignore for LobeHub +################################################################ + +# general +.DS_Store +.idea +.vscode +.history +.temp +.env.local +venv +temp +tmp + +# dependencies +node_modules +*.log +*.lock +package-lock.json + +# ci +coverage +.coverage +.eslintcache +.stylelintcache + +# production +dist +es +lib +logs +test-output + +# umi +.umi +.umi-production +.umi-test +.dumi + +# husky +.husky/prepare-commit-msg + +# misc +# add other ignore file below diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..e605228 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,3 @@ +tasks: + - init: pnpm install + command: pnpm run start diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..c160a77 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no -- commitlint --edit ${1} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..8da041a --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run type-check +npx --no-install lint-staged diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..d9ed3d3 --- /dev/null +++ b/.npmrc @@ -0,0 +1,11 @@ +lockfile=false +resolution-mode=highest +public-hoist-pattern[]=*@umijs/lint* +public-hoist-pattern[]=*changelog* +public-hoist-pattern[]=*commitlint* +public-hoist-pattern[]=*eslint* +public-hoist-pattern[]=*postcss* +public-hoist-pattern[]=*prettier* +public-hoist-pattern[]=*remark* +public-hoist-pattern[]=*semantic-release* +public-hoist-pattern[]=*stylelint* diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..51fdf94 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,61 @@ +# Prettierignore for LobeHub +################################################################ + +# general +.DS_Store +.editorconfig +.idea +.vscode +.history +.temp +.env.local +.husky +.npmrc +.gitkeep +venv +temp +tmp +LICENSE + +# dependencies +node_modules +*.log +*.lock +package-lock.json + +# ci +coverage +.coverage +.eslintcache +.stylelintcache +test-output +__snapshots__ +*.snap + +# production +dist +es +lib +logs + +# umi +.umi +.umi-production +.umi-test +.dumi/tmp* + +# ignore files +.*ignore + +# docker +docker +Dockerfile* + +# image +*.webp +*.gif +*.png +*.jpg + +# misc +# add other ignore file below diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..f0355a9 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1 @@ +module.exports = require('@lobehub/lint').prettier; diff --git a/.releaserc.js b/.releaserc.js new file mode 100644 index 0000000..3793001 --- /dev/null +++ b/.releaserc.js @@ -0,0 +1 @@ +module.exports = require('@lobehub/lint').semanticRelease; diff --git a/.remarkrc.js b/.remarkrc.js new file mode 100644 index 0000000..b673c10 --- /dev/null +++ b/.remarkrc.js @@ -0,0 +1 @@ +module.exports = require('@lobehub/lint').remarklint; diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 0000000..bcd7ba8 --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,9 @@ +const config = require('@lobehub/lint').stylelint; + +module.exports = { + ...config, + rules: { + 'custom-property-pattern': null, + 'selector-pseudo-element-no-unknown': null, + }, +}; diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1dd53d2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 LobeHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json new file mode 100644 index 0000000..eb3eff6 --- /dev/null +++ b/package.json @@ -0,0 +1,98 @@ +{ + "name": "@lobehub/chat-plugin-sdk", + "version": "0.0.0", + "description": "Lobe Chat Plugin SDK, help you to build an amazing chat plugin for Lobe Chat", + "keywords": [ + "lobehub", + "dumi", + "dumi theme" + ], + "homepage": "https://github.com/lobehub/chat-plugin-sdk", + "bugs": { + "url": "https://github.com/lobehub/chat-plugin-sdk/issues/new" + }, + "repository": { + "type": "git", + "url": "https://github.com/lobehub/chat-plugin-sdk.git" + }, + "license": "MIT", + "author": "LobeHub ", + "sideEffects": false, + "main": "dist/index.js", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "father build", + "build:docs": "npm run build && npm run build --prefix=example", + "ci": "npm run lint && npm run type-check && npm run test", + "dev": "father dev", + "dev:docs": "npm run start --prefix=example", + "lint": "eslint \"{src,example}/**/*.{js,jsx,ts,tsx}\" --fix", + "lint:md": "remark . --quiet --frail --output", + "lint:style": "stylelint \"{src,example}/**/*.{js,jsx,ts,tsx}\" --fix", + "prepack": "npm run build && clean-pkg-json", + "prepare": "husky install", + "prepublishOnly": "npm run build", + "prettier": "prettier -c --write --no-error-on-unmatched-pattern \"**/**\"", + "release": "semantic-release", + "start": "npm run dev", + "test": "vitest --passWithNoTests", + "test:coverage": "vitest run --coverage --passWithNoTests", + "test:update": "vitest -u", + "type-check": "tsc -p tsconfig-check.json" + }, + "lint-staged": { + "*.md": [ + "remark --quiet --output --", + "prettier --write --no-error-on-unmatched-pattern" + ], + "*.json": [ + "prettier --write --no-error-on-unmatched-pattern" + ], + "*.{js,jsx}": [ + "prettier --write", + "stylelint --fix", + "eslint --fix" + ], + "*.{ts,tsx}": [ + "prettier --parser=typescript --write", + "stylelint --fix", + "eslint --fix" + ] + }, + "devDependencies": { + "@commitlint/cli": "^17", + "@lobehub/lint": "latest", + "@types/lodash-es": "^4", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "@vitest/coverage-v8": "latest", + "clean-pkg-json": "^1", + "commitlint": "^17", + "dumi": "^2", + "dumi-assets-types": "^1", + "eslint": "^8", + "father": "^4", + "husky": "^8", + "jsdom": "^22", + "leva": "^0", + "lint-staged": "^13", + "prettier": "^3", + "react": "^18", + "react-dom": "^18", + "remark": "^14", + "remark-cli": "^11", + "semantic-release": "^21", + "stylelint": "^15", + "typescript": "^5", + "vitest": "latest" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..fcb073f --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +export * from './types'; diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..78bcd75 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,23 @@ +export interface PluginItem { + createAt: string; + homepage: string; + meta: Meta; + name: string; + runtime: Runtime; + schema: any; +} + +export interface Meta { + avatar: string; + tags: string[]; +} + +export interface Runtime { + endpoint: string; + render?: string; +} + +export interface LobeChatPlugins { + version: 1; + plugins: PluginItem[]; +} diff --git a/tests/test-setup.ts b/tests/test-setup.ts new file mode 100644 index 0000000..e69de29 diff --git a/tsconfig-check.json b/tsconfig-check.json new file mode 100644 index 0000000..09029c6 --- /dev/null +++ b/tsconfig-check.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "noEmit": true + }, + "exclude": ["example"], + "extends": "./tsconfig.json" +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6d2bc46 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "strict": true, + "declaration": true, + "skipLibCheck": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "jsx": "react-jsx", + "types": ["vitest/globals"], + "baseUrl": ".", + "paths": { + "@@/*": ["example/.dumi/tmp/*"], + "@/*": ["src/*"], + "dumi/theme/*": ["example/.dumi/tmp/dumi/theme/*"], + "chat-plugin-sdk": ["src"], + "chat-plugin-sdk/*": ["src/*", "*"] + } + }, + "include": ["src", "tests", ".dumi/**/*", "typings", "example/.dumirc.ts", "*.ts"] +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..8c53749 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from 'vitest/config'; + +import { name } from './package.json'; + +export default defineConfig({ + esbuild: { + jsxInject: "import React from 'react'", + }, + test: { + alias: { + '@': './src', + [name]: './src', + }, + coverage: { + reporter: ['text', 'text-summary', 'json', 'lcov'], + }, + environment: 'jsdom', + globals: true, + setupFiles: './tests/test-setup.ts', + }, +});