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/.fatherrc.ts b/.fatherrc.ts new file mode 100644 index 0000000..1c70da4 --- /dev/null +++ b/.fatherrc.ts @@ -0,0 +1,46 @@ +import { defineConfig } from 'father'; +import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; + +export default defineConfig({ + esm: { + output: 'dist/esm', + }, + cjs: { + output: 'dist/cjs', + }, + // https://github.com/umijs/father/blob/master/docs/config.md#umd + umd: { + name: 'GPTVis', + output: { + path: './dist/umd', + filename: 'index.js', + }, + platform: 'browser', + externals: { + lodash: '_', + 'lodash-es': '_', + react: 'React', + 'mapbox-gl': { + root: 'mapboxgl', + commonjs: 'mapbox-gl', + commonjs2: 'mapbox-gl', + amd: 'mapbox-gl', + }, + 'maplibre-gl': { + root: 'maplibregl', + commonjs: 'maplibre-gl', + commonjs2: 'maplibre-gl', + amd: 'maplibre-gl', + }, + }, + chainWebpack(memo) { + // 关闭压缩方便调试,默认开启 + // memo.optimization.minimize(false); + + memo + .plugin('webpack-bundle-analyzer') + .use(BundleAnalyzerPlugin, [{ analyzerMode: 'static', openAnalyzer: false }]); + return memo; + }, + }, +}); diff --git a/.github/.gitleaks.toml b/.github/.gitleaks.toml new file mode 100644 index 0000000..8dca9e6 --- /dev/null +++ b/.github/.gitleaks.toml @@ -0,0 +1,124 @@ +title = "gitleaks config" +[[rules]] + description = "AWS Manager ID" + regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}''' + tags = ["key", "AWS"] +[[rules]] + description = "AWS Secret Key" + regex = '''(?i)aws(.{0,20})?(?-i)['\"][0-9a-zA-Z\/+]{40}['\"]''' + tags = ["key", "AWS"] +[[rules]] + description = "AWS MWS key" + regex = '''amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}''' + tags = ["key", "AWS", "MWS"] +[[rules]] + description = "Facebook Secret Key" + regex = '''(?i)(facebook|fb)(.{0,20})?(?-i)['\"][0-9a-f]{32}['\"]''' + tags = ["key", "Facebook"] +[[rules]] + description = "Facebook Client ID" + regex = '''(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}['\"]''' + tags = ["key", "Facebook"] +[[rules]] + description = "Twitter Secret Key" + regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{35,44}['\"]''' + tags = ["key", "Twitter"] +[[rules]] + description = "Twitter Client ID" + regex = '''(?i)twitter(.{0,20})?['\"][0-9a-z]{18,25}['\"]''' + tags = ["client", "Twitter"] +[[rules]] + description = "Github" + regex = '''(?i)github(.{0,20})?(?-i)['\"][0-9a-zA-Z]{35,40}['\"]''' + tags = ["key", "Github"] +[[rules]] + description = "Github Token" + regex = '''[0-9a-zA-Z]{35,40}''' + tags = ["key", "Github Token"] +[[rules]] + description = "Alibaba" + regex = '''(alibaba|antfin)-inc''' + tags = ["key", "Alibaba"] +[[rules]] + description = "antfin" + regex = '''(?i)antfin(.{0,20})?(?-i)['\"][0-9a-zA-Z]{35,40}['\"]''' + tags = ["key", "Antfin"] +[[rules]] + description = "LinkedIn Client ID" + regex = '''(?i)linkedin(.{0,20})?(?-i)['\"][0-9a-z]{12}['\"]''' + tags = ["client", "LinkedIn"] +[[rules]] + description = "LinkedIn Secret Key" + regex = '''(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]''' + tags = ["secret", "LinkedIn"] +[[rules]] + description = "Slack" + regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?''' + tags = ["key", "Slack"] +[[rules]] + description = "Asymmetric Private Key" + regex = '''-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----''' + tags = ["key", "AsymmetricPrivateKey"] +[[rules]] + description = "Public Key" + regex = '''ssh-rsa''' + tags = ["keys", "public key"] +[[rules]] + description = "Gitlab Key" + regex = '''privateToken|private-token''' + tags = ["keys", "Gitlab"] +[[rules]] + description = "Generic Credential" + regex = '''(?i)(api_key|apikey|secret)(.{0,20})?['|"][0-9a-zA-Z]{16,45}['|"]''' + tags = ["key", "API", "generic"] +[[rules]] + description = "Google API key" + regex = '''AIza[0-9A-Za-z\\-_]{35}''' + tags = ["key", "Google"] +[[rules]] + description = "Heroku API key" + regex = '''(?i)heroku(.{0,20})?['"][0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"]''' + tags = ["key", "Heroku"] +[[rules]] + description = "MailChimp API key" + regex = '''(?i)(mailchimp|mc)(.{0,20})?['"][0-9a-f]{32}-us[0-9]{1,2}['"]''' + tags = ["key", "Mailchimp"] +[[rules]] + description = "Mailgun API key" + regex = '''(?i)(mailgun|mg)(.{0,20})?['"][0-9a-z]{32}['"]''' + tags = ["key", "Mailgun"] +[[rules]] + description = "PayPal Braintree access token" + regex = '''access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}''' + tags = ["key", "Paypal"] +[[rules]] + description = "Picatic API key" + regex = '''sk_live_[0-9a-z]{32}''' + tags = ["key", "Picatic"] +[[rules]] + description = "SendGrid API Key" + regex = '''SG\.[\w_]{16,32}\.[\w_]{16,64}''' + tags = ["key", "SendGrid"] +[[rules]] + description = "Slack Webhook" + regex = '''https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}''' + tags = ["key", "slack"] +[[rules]] + description = "Stripe API key" + regex = '''(?i)stripe(.{0,20})?['\"][sk|rk]_live_[0-9a-zA-Z]{24}''' + tags = ["key", "Stripe"] +[[rules]] + description = "Square access token" + regex = '''sq0atp-[0-9A-Za-z\-_]{22}''' + tags = ["key", "square"] +[[rules]] + description = "Square OAuth secret" + regex = '''sq0csp-[0-9A-Za-z\\-_]{43}''' + tags = ["key", "square"] +[[rules]] + description = "Twilio API key" + regex = '''(?i)twilio(.{0,20})?['\"][0-9a-f]{32}['\"]''' + tags = ["key", "twilio"] +[whitelist] + description = "Whitelisted files" + file = '''(^\.?gitleaks.toml$|(.*?)(jpg|gif|doc|pdf|bin)|package-lock\.json$)''' diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..9265590 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +### PR includes + + + +- [ ] fixed #0 +- [ ] add / modify test cases +- [ ] documents, demos + +### Screenshot + +| Before | After | +| ------ | ----- | +| ❌ | ✅ | diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml new file mode 100644 index 0000000..c1796de --- /dev/null +++ b/.github/actions/prepare-install/action.yml @@ -0,0 +1,24 @@ +name: 'Prepare Install' +description: 'Prepare repository and install all dependencies' + +inputs: + node-version: + description: 'The node version to setup' + required: true + +runs: + using: 'composite' + steps: + - uses: pnpm/action-setup@v3 + with: + version: 9 + + - name: Use Node.js ${{ inputs.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + # cache: 'pnpm' # pnpm-lock.yaml caching dependencies to speed up workflows + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 0000000..6caf9dd --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,24 @@ +# for .github/workflows/release-label.yml +# These labels can be used in conjunction GitHub's [automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes) + +changelog: + exclude: + labels: + - ignore-for-release + - pr(chore) + categories: + - title: 🎉 New Features + labels: + - pr(feature) + - title: 📖 Documentation Changes + labels: + - pr(documentation) + - title: 🐛 Bug Fixes + labels: + - pr(bugfix) + - title: 🛠 Breaking Changes + labels: + - pr(breaking) + - title: Other Changes + labels: + - '*' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..475f5c3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: [master] + paths: + - 'src/**' + - '__tests__/**' + pull_request: + branches: + - '**' + paths: + - 'src/**' + - '__tests__/**' + +permissions: + contents: read # to fetch code (actions/checkout) + +concurrency: + group: '${{ github.workflow }} - ${{ github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ matrix.node-version }} + + - name: Check + run: | + pnpm check-deps + pnpm check-format + + - name: Lint + run: pnpm lint:ts + + # todo test + # unit-test: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # node-version: [18.x] + # steps: + # - uses: actions/checkout@v4 + # - name: Install dependencies + # uses: ./.github/actions/prepare-install + # with: + # node-version: ${{ matrix.node-version }} + + # - name: Coverage Test + # run: pnpm unit + + + size-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ matrix.node-version }} + + - name: Szie Test With Build + run: pnpm test:size diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000..5eb150c --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,40 @@ +name: Deploy Site + +on: + workflow_dispatch: + release: + # released: only latest release will trigger + types: [released] + +concurrency: + group: '${{ github.workflow }} - ${{ github.ref }}' + cancel-in-progress: true + +jobs: + publish-site: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ matrix.node-version }} + - run: pnpm docs:build + - run: | + echo "gpt-vis.antv.vision" > docs-dist/CNAME + - run: | + cd docs-dist + git init + git config --local user.name antv + git config --local user.email antv@antfin.com + git add . + git commit -m "update by release action" + - uses: ad-m/github-push-action@master + with: + github_token: ${{secrets.GITHUB_TOKEN}} + directory: docs-dist + branch: gh-pages + force: true diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml new file mode 100644 index 0000000..4cde88c --- /dev/null +++ b/.github/workflows/gitleaks.yml @@ -0,0 +1,15 @@ +name: Gitleaks + +on: push + +jobs: + gitleaks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '1' + - name: gitleaks-action + uses: zricethezav/gitleaks-action@v1.6.0 + with: + config-path: .github/.gitleaks.toml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..7e93ab8 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,22 @@ +name: Surge PR Preview + +on: pull_request + +jobs: + preview: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + uses: ./.github/actions/prepare-install + with: + node-version: ${{ matrix.node-version }} + - uses: afc163/surge-preview@v1 + with: + surge_token: ${{ secrets.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: docs-dist + build: pn docs:build diff --git a/.github/workflows/release-label.yml b/.github/workflows/release-label.yml new file mode 100644 index 0000000..4de49ad --- /dev/null +++ b/.github/workflows/release-label.yml @@ -0,0 +1,15 @@ +name: Conventional Release Labels + +# Warning, do not check out untrusted code with +# the pull_request_target event. +on: + pull_request_target: + types: [opened, edited] +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: bcoe/conventional-release-labels@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + type_labels: '{"feat": "pr(feature)", "fix": "pr(bugfix)", "breaking": "pr(breaking)", "docs": "pr(documentation)", "chore": "pr(chore)"}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e834e74 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,15 @@ +name: release + +on: + workflow_dispatch: + +concurrency: + group: '${{ github.workflow }} - ${{ github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc3ead2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,81 @@ + +# Created by https://www.gitignore.io/api/node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +yarn.lock +package-lock.json +pnpm-lock.yaml + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ + +#history +.history/ + +jspm_packages/ + +# Typescript v1 declaration files +# typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + + +# End of https://www.gitignore.io/api/node + +.DS_Store +.cache +.idea + +# Build +dist +docs-dist +.dumi diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..f0abd67 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,3 @@ +#!/bin/sh + +npx --no -- commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..3b608ae --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh + +npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0c1459a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,18 @@ +*.svg +.DS_Store +.gitignore +.prettierignore +.editorconfig +.eslintignore +node_modules +yarn.lock +yarn-error.log +npm-debug.log +CNAME +LICENSE +.cache +.history + +# output dist +dist/** + diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..772dd4f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "printWidth": 100, + "singleQuote": true, + "trailingComma": "all", + "arrowParens": "always", + "overrides": [ + { "files": ".prettierrc", "options": { "parser": "json" } } + ], + "plugins": ["prettier-plugin-organize-imports"] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..021ac36 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "editorconfig.editorconfig", + "esbenp.prettier-vscode" + ], + "unwantedRecommendations": ["hookyqr.beautify", "dbaeumer.jshint"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d465499 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + // An array of language ids which should be validated by ESLint + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], + // required to make the extension pickup the flat config + "eslint.useFlatConfig": true, + + // typescript auto-format settings + "typescript.tsdk": "node_modules/typescript/lib", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true +} diff --git a/__tests__/version.spec.ts b/__tests__/version.spec.ts new file mode 100644 index 0000000..7a24115 --- /dev/null +++ b/__tests__/version.spec.ts @@ -0,0 +1,9 @@ +import pkg from '../package.json'; +import { version } from '../src'; + +describe('version', () => { + it('should match the `version` field of package.json', () => { + const expected = pkg.version; + expect(version).toBe(expected); + }); +}); diff --git a/commitlint.config.ts b/commitlint.config.ts new file mode 100644 index 0000000..f2886c8 --- /dev/null +++ b/commitlint.config.ts @@ -0,0 +1,25 @@ +export default { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + [ + 'build', + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test', + 'deps', + 'wip', + ], + ], + 'header-max-length': [2, 'always', 100], + }, +}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..d799e44 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,104 @@ +// @ts-check + +import eslint from '@eslint/js'; +import prettierConfig from 'eslint-config-prettier'; +import jestPlugin from 'eslint-plugin-jest'; +import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'; +import reactPlugin from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; + +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +export default tseslint.config( + // config ignores files, equal `.eslintignore` + { + ignores: [ + '**/node_modules/**', + '**/dist/**', + '**/.cache/**', + '**/.history/**', + '**/.idea/**', + './*.?*.ts', + + // Files of the build + 'dist/*', + ], + }, + + // extends configs + eslint.configs.recommended, + + // basic config + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { + ...globals.es2021, + ...globals.browser, + }, + }, + rules: { + 'no-unused-vars': 'warn', + 'no-unsafe-optional-chaining': 'warn', + 'no-constant-condition': 'off', + 'no-prototype-builtins': 'off', + 'no-case-declarations': 'off', + 'no-useless-catch': 'off', + 'prefer-rest-params': 'off', + }, + }, + + // ts files linting + { + files: ['**/*.{ts,tsx}'], + extends: [...tseslint.configs.recommended], + languageOptions: { + parserOptions: { + project: './tsconfig.eslint.json', + tsconfigRootDir: __dirname, + }, + }, + rules: { + '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }], + '@typescript-eslint/no-loss-of-precision': 0, + '@typescript-eslint/no-inferrable-types': 0, + '@typescript-eslint/ban-types': 0, + '@typescript-eslint/ban-ts-comment': 0, + '@typescript-eslint/no-empty-function': 0, + '@typescript-eslint/explicit-module-boundary-types': 0, + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/no-duplicate-enum-values': 0, + '@typescript-eslint/no-use-before-define': 0, + }, + }, + + // react tsx files linting + { + files: ['**/*.{tsx}'], + ...reactPlugin.configs.recommended, + ...reactHooks.configs.recommended, + plugins: { + 'jsx-a11y': jsxA11yPlugin, + }, + rules: {}, + }, + + // + // test jest file linting + // + { + files: ['test/**/*.spec.ts'], + ...jestPlugin.configs['flat/recommended'], + rules: {}, + }, + + // after all eslint plugins configs to override, see https://github.com/prettier/eslint-config-prettier + // @ts-ignore + prettierConfig, +); diff --git a/jest.config.ts b/jest.config.ts new file mode 100644 index 0000000..a7e2103 --- /dev/null +++ b/jest.config.ts @@ -0,0 +1,11 @@ +import type { Config } from 'jest'; + +const config: Config = { + preset: 'ts-jest', + testEnvironment: 'jsdom', + collectCoverage: false, + testRegex: '(/__tests__/.*\\.(test|spec))\\.ts$', + collectCoverageFrom: ['src/**/*.ts'], +}; + +export default config; diff --git a/package.json b/package.json index a12aac2..4a99aa7 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,125 @@ { "name": "@antv/gpt-vis", "version": "0.0.1", - "description": "GPT-Vis", - "repository": "git@github.com:antvis/GPT-Vis.git", + "description": "Components for GPTs, generative AI, and LLM projects. Not only UI Components.", + "keywords": [ + "antv", + "GPTs", + "LLM", + "vis", + "LUI" + ], + "homepage": "https://gpt-vis.antv.com", + "repository": { + "type": "git", + "url": "https://github.com/antvis/LarkMap" + }, "license": "MIT", "author": "antvis", "sideEffects": false, + "type": "module", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", "typings": "dist/esm/index.d.ts", "files": [ "dist", - "README.md" + "README.md", + "!dist/umd/report.html" ], - "scripts": {}, - "dependencies": {}, - "devDependencies": {}, + "scripts": { + "prepare": "husky", + "start": "pnpm dev", + "dev": "dumi dev", + "build": "father build", + "docs:build": "dumi build", + "docs:build-analyze": "ANALYZE=1 dumi build", + "docs:deploy": "gh-pages -d docs-dist", + "deploy": "pnpm docs:build && pnpm docs:deploy", + "check-deps": "father doctor", + "check-format": "prettier './**/*.{ts,tsx,js,jsx,json,md,css,less}' --check", + "format": "prettier './**/*.{ts,tsx,js,jsx,json,md,css,less}' --write", + "lint:ts": "eslint src --ext .ts,.tsx", + "lint:ts-fix": "pnpm lint:ts --fix", + "test:unit": "jest --config ./jest.config.ts", + "test:size": "limit-size", + "ci": "run-s lint:ts doctor build", + "prepublishOnly": "pnpm ci" + }, + "lint-staged": { + "*.{md,json}": [ + "prettier --cache --write --no-error-on-unmatched-pattern" + ], + "*.{css,less}": [ + "prettier --cache --write" + ], + "*.{js,jsx}": [ + "eslint --fix", + "prettier --cache --write" + ], + "*.{ts,tsx}": [ + "eslint --fix", + "prettier --cache --write" + ] + }, + "dependencies": { + "@ant-design/graphs": "^2.0.0-beta.4", + "@ant-design/icons": "^5.4.0", + "@ant-design/plots": "^2.2.5", + "@ant-design/x": "^1.0.0-alpha.12", + "@antv/l7": "^2.22.0", + "@antv/larkmap": "^1.5.1", + "@babel/runtime": "^7.18.0", + "lodash": "^4.17.21", + "react-markdown": "^9.0.1", + "rehype-raw": "^7.0.0", + "styled-components": "^6.0.7" + }, + "devDependencies": { + "@commitlint/cli": "^19.5.0", + "@commitlint/config-conventional": "^19.5.0", + "@types/jest": "^29.5.14", + "@types/react": "^18.0.0", + "antd": "^5.0.0", + "dumi": "^2.4.13", + "eslint": "^9.14.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jest": "^28.9.0", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.2", + "eslint-plugin-react-hooks": "^5.0.0", + "father": "^4.5.1", + "gh-pages": "^6.2.0", + "globals": "^15.12.0", + "husky": "^9.1.6", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "limit-size": "^0.1.4", + "lint-staged": "^15.2.10", + "npm-run-all": "^4.1.5", + "prettier": "^3.3.3", + "prettier-plugin-organize-imports": "^4.1.0", + "react": "^18.0.0", + "ts-jest": "^29.2.5", + "typescript": "^5.6.3", + "typescript-eslint": "^8.13.0", + "webpack-bundle-analyzer": "^4.10.2" + }, "peerDependencies": { + "antd": "^5.0.0", "react": ">=16.9.0" + }, + "engines": { + "node": ">=18", + "pnpm": ">=8" + }, + "limit-size": [ + { + "path": "dist/umd/index.js", + "limit": "3 Mb" + } + ], + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" } } diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..4131afc --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true + }, + // paths intend to lint + "include": [ + "./*.?*.ts", + "src", + // test workspace lint + "__tests__" + ], + "exclude": ["node_modules", "dist"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a579fbc --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "jsx": "react", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "declaration": true, + "resolveJsonModule": true, + "baseUrl": "./", + "paths": { + "@antv/gpt-vis": ["./src/index.ts"] + } + }, + "exclude": ["node_modules", "dist"] +}