diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f6ac4bb..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,11 +0,0 @@ -const base = require('@umijs/fabric/dist/eslint'); -const path = require('path'); - -module.exports = { - ...base, - rules: { - ...base.rules, - 'react/no-string-refs': 0, - 'react/no-deprecated': 0, - }, -}; diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..758659a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: ant-design +open_collective: ant-design diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3a3cce5..5e6c7fa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,27 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: - - package-ecosystem: "npm" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: npm + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + groups: + npm-dependencies: + patterns: + - '*' + + - package-ecosystem: github-actions + directory: '/' schedule: - interval: "weekly" + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + groups: + github-actions: + patterns: + - '*' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f860ff1..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: ✅ test -on: [push, pull_request] -jobs: - test: - uses: react-component/rc-test/.github/workflows/test.yml@main - secrets: inherit diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..54244f7 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,43 @@ +name: 'CodeQL' + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + schedule: + - cron: '36 13 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [javascript-typescript] + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Initialize CodeQL + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + with: + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 0000000..20e282c --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,22 @@ +name: React Doctor + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + pull-requests: write + issues: write + statuses: write + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..18227e7 --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,52 @@ +name: Surge Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + checks: write + +jobs: + preview: + runs-on: ubuntu-latest + concurrency: + group: surge-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Check Surge token + id: surge-token + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + run: | + if [ -n "$SURGE_TOKEN" ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi + - name: Setup utoo + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + uses: utooland/setup-utoo@v1 + + - name: Build preview + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + run: | + ut install + npm run build + - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + with: + surge_token: ${{ env.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: .doc + failOnError: false + setCommitStatus: false + - name: Skip Surge preview + if: ${{ steps.surge-token.outputs.enabled != 'true' }} + run: echo "SURGE_TOKEN is not configured; skip Surge preview." diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ac9a11d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: ✅ test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + test: + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 5184461..de6ac56 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,78 @@ -# @rc-component/dom-align - ---- - -Align source html element with target html element flexibly. - -[![NPM version][npm-image]][npm-url] -[![npm download][download-image]][download-url] -[![build status][github-actions-image]][github-actions-url] -[![Codecov][codecov-image]][codecov-url] -[![bundle size][bundlephobia-image]][bundlephobia-url] -[![dumi][dumi-image]][dumi-url] - -[npm-image]: http://img.shields.io/npm/v/@rc-component/dom-align.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@rc-component/dom-align -[travis-image]: https://img.shields.io/travis/react-component/dom-align/main?style=flat-square -[travis-url]: https://travis-ci.com/react-component/dom-align -[github-actions-image]: https://github.com/react-component/dom-align/actions/workflows/ci.yml/badge.svg -[github-actions-url]: https://github.com/react-component/dom-align/actions/workflows/ci.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dom-align/main.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/dom-align -[david-url]: https://david-dm.org/react-component/dom-align -[david-image]: https://david-dm.org/react-component/dom-align/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/dom-align?type=dev -[david-dev-image]: https://david-dm.org/react-component/dom-align/dev-status.svg?style=flat-square -[download-image]: https://img.shields.io/npm/dm/@rc-component/dom-align.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/dom-align -[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dom-align -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dom-align -[dumi-url]: https://github.com/umijs/dumi -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square - -## Screenshot - - +
+

@rc-component/dom-align

+

Ant Design Part of the Ant Design ecosystem.

+

📐 DOM alignment utility for positioning one element against another.

+ +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

+
+ +

English | 简体中文

+ +## Highlights + +| Area | Support | +| ------- | ------------------------------------------------------------------ | +| Purpose | DOM alignment utility for positioning one element against another. | +| Package | `@rc-component/dom-align` | +| Release | `@rc-component/np` / `rc-np` | ## Install -[![@rc-component/dom-align](https://nodei.co/npm/@rc-component/dom-align.png)](https://npmjs.org/package/@rc-component/dom-align) - -## Feature - -- support Edge Chrome Firefox -- support align points and offset -- support auto adjust according to visible area +```bash +npm install @rc-component/dom-align +``` ## Usage -```js +```tsx | pure import domAlign from '@rc-component/dom-align'; -// use domAlign -// sourceNode's initial style should be position:absolute;left:-9999px;top:-9999px; +domAlign(sourceNode, targetNode, { + points: ['tl', 'tr'], + offset: [10, 20], + overflow: { adjustX: true, adjustY: true }, +}); +``` + +## API + +| Option | Description | +| --- | --- | +| `points` | Source and target alignment points. | +| `offset` | Source node offset. | +| `targetOffset` | Target node offset. | +| `overflow` | Auto-adjust behavior when the source overflows viewport. | +| `useCssRight` / `useCssBottom` / `useCssTransform` | Choose CSS positioning strategy. | -const alignConfig = { - points: ['tl', 'tr'], // align top left point of sourceNode with top right point of targetNode - offset: [10, 20], // the offset sourceNode by 10px in x and 20px in y, - targetOffset: ['30%', '40%'], // the offset targetNode by 30% of targetNode width in x and 40% of targetNode height in y, - overflow: { adjustX: true, adjustY: true }, // auto adjust position when sourceNode is overflowed -}; +## Development -domAlign(sourceNode, targetNode, alignConfig); +```bash +npm install +npm start +npm test +npm run lint +npm run tsc +npm run compile ``` -## API +The dumi site runs at `http://localhost:8000`. + +## Release + +```bash +npm run prepublishOnly +``` + +The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow. + +## Detailed API ### void domAlign(source: HTMLElement, target: HTMLElement, alignConfig: Object):Function @@ -125,17 +135,10 @@ domAlign(sourceNode, targetNode, alignConfig); -## Development - -``` -pnpm install -pnpm start -``` - ## Example http://localhost:8000/ ## License -@rc-component/dom-align is released under the MIT license. +@rc-component/dom-align is released under the [MIT](./LICENSE.md) license. diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..c82f009 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,77 @@ +
+

@rc-component/dom-align

+

Ant Design Ant Design 生态的一部分。

+

📐 用于将一个 DOM 元素相对另一个元素定位的对齐工具。

+ +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

+
+ +

English | 简体中文

+ +## 亮点 + +| 方向 | 支持 | +| ---- | ------------------------------------------------- | +| 定位 | 用于将一个 DOM 元素相对另一个元素定位的对齐工具。 | +| 包名 | `@rc-component/dom-align` | +| 发布 | `@rc-component/np` / `rc-np` | + +## 安装 + +```bash +npm install @rc-component/dom-align +``` + +## 用法 + +```tsx | pure +import domAlign from '@rc-component/dom-align'; + +domAlign(sourceNode, targetNode, { + points: ['tl', 'tr'], + offset: [10, 20], + overflow: { adjustX: true, adjustY: true }, +}); +``` + +## API + +| 名称 | 说明 | +| -------------------------------------------------- | -------------------------------- | +| `points` | 源节点和目标节点的对齐点。 | +| `offset` | 源节点偏移。 | +| `targetOffset` | 目标节点偏移。 | +| `overflow` | 源节点超出视口时的自动调整行为。 | +| `useCssRight` / `useCssBottom` / `useCssTransform` | 选择 CSS 定位策略。 | + +## 本地开发 + +```bash +npm install +npm start +npm test +npm run lint +npm run tsc +npm run compile +``` + +本地 dumi 站点默认运行在 `http://localhost:8000`. + +## 发布 + +```bash +npm run prepublishOnly +``` + +发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。 + +## 许可证 + +@rc-component/dom-align 基于 [MIT](./LICENSE.md) 协议发布。 diff --git a/app/body-overflow/page.tsx b/app/body-overflow/page.tsx index 9cb0471..19a95f6 100644 --- a/app/body-overflow/page.tsx +++ b/app/body-overflow/page.tsx @@ -4,11 +4,11 @@ import React, { useRef, useEffect } from 'react'; import domAlign from '../../src'; export default function Overflow() { - const source = useRef(); - const target = useRef(); - const timer = useRef(); + const source = useRef(null); + const target = useRef(null); + const timer = useRef | null>(null); const align = () => { - const ret = domAlign(source.current, target.current, { + const ret = domAlign(source.current!, target.current!, { points: ['tl', 'bl'], overflow: { adjustY: 1, diff --git a/app/fail/page.tsx b/app/fail/page.tsx index 308cdf8..bd2f6fc 100644 --- a/app/fail/page.tsx +++ b/app/fail/page.tsx @@ -4,11 +4,11 @@ import React, { useRef, useEffect } from 'react'; import domAlign from '../../src'; export default function Fail() { - const source = useRef(); - const target = useRef(); + const source = useRef(null); + const target = useRef(null); function align() { - const ret = domAlign(source.current, target.current, { + const ret = domAlign(source.current!, target.current!, { points: ['bl', 'bl'], overflow: { adjustY: 1, diff --git a/app/shadow-dom/page.tsx b/app/shadow-dom/page.tsx index e4f88e4..c1ccea0 100644 --- a/app/shadow-dom/page.tsx +++ b/app/shadow-dom/page.tsx @@ -5,10 +5,10 @@ import ReactDOM from 'react-dom/client'; import domAlign from '../../src'; function Test() { - const source = useRef(); - const target = useRef(); + const source = useRef(null); + const target = useRef(null); function align() { - const ret = domAlign(source.current, target.current, { + const ret = domAlign(source.current!, target.current!, { points: ['bl', 'bl'], overflow: { adjustY: 1, @@ -40,10 +40,10 @@ function Test() { } export default function ShadowDom() { - const source = useRef(); + const source = useRef(null); useEffect(() => { - const shadowRoot = source.current.attachShadow({ mode: 'open' }); + const shadowRoot = source.current!.attachShadow({ mode: 'open' }); ReactDOM.createRoot(shadowRoot).render(); }, []); diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 0000000..99a7e05 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,48 @@ +const { defineConfig } = require('cypress'); +const codeCoverage = require('@cypress/code-coverage/task'); + +module.exports = defineConfig({ + projectId: 'bfy1u3', + component: { + setupNodeEvents(on, config) { + codeCoverage(on, config); + return config; + }, + devServer: { + framework: 'react', + bundler: 'webpack', + webpackConfig: { + module: { + rules: [ + { + test: /\.[jt]sx?$/, + exclude: /node_modules/, + use: { + loader: require.resolve('babel-loader'), + options: { + presets: [ + require.resolve('@babel/preset-env'), + [ + require.resolve('@babel/preset-react'), + { + runtime: 'automatic', + }, + ], + require.resolve('@babel/preset-typescript'), + ], + }, + }, + }, + { + test: /\.css$/, + use: [require.resolve('style-loader'), require.resolve('css-loader')], + }, + ], + }, + resolve: { + extensions: ['.ts', '.tsx', '.js', '.jsx'], + }, + }, + }, + }, +}); diff --git a/cypress.config.ts b/cypress.config.ts deleted file mode 100644 index 2e86987..0000000 --- a/cypress.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'cypress'; -import codeCoverage from '@cypress/code-coverage/task'; -export default defineConfig({ - projectId: 'bfy1u3', - component: { - setupNodeEvents(on, config) { - codeCoverage(on, config) - return config; - }, - devServer: { - framework: 'next', - bundler: 'webpack', - }, - }, -}); diff --git a/docs/shadow-dom.tsx b/docs/shadow-dom.tsx index abfd752..f824eba 100644 --- a/docs/shadow-dom.tsx +++ b/docs/shadow-dom.tsx @@ -1,10 +1,13 @@ -import React, { useEffect } from 'react'; import domAlign from '@rc-component/dom-align'; -import ReactDOM from 'react-dom'; +import React, { useEffect } from 'react'; +import { createRoot } from 'react-dom/client'; class Test extends React.Component { + sourceRef = React.createRef(); + targetRef = React.createRef(); + align() { - const ret = domAlign(this.refs.source, this.refs.target, { + const ret = domAlign(this.sourceRef.current!, this.targetRef.current!, { points: ['bl', 'bl'], overflow: { adjustY: 1, @@ -16,14 +19,18 @@ class Test extends React.Component { render() { return (
- +
- +
{ - const divRef = React.useRef(null); + const divRef = React.useRef(null); useEffect(() => { const div = document.createElement('div'); const shadowRoot = div.attachShadow({ mode: 'open' }); - divRef.current.appendChild(div); - ReactDOM.render(, shadowRoot); + const root = createRoot(shadowRoot); + + divRef.current!.appendChild(div); + root.render(); + + return () => { + root.unmount(); + div.remove(); + }; }, []); return
; }; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..40f08ec --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,115 @@ +import js from '@eslint/js'; +import { defineConfig } from 'eslint/config'; +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import prettier from 'eslint-config-prettier'; +import jest from 'eslint-plugin-jest'; +import react from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; + +const tsconfigRootDir = dirname(fileURLToPath(import.meta.url)); + +export default defineConfig([ + { + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }, + { + linterOptions: { + reportUnusedDisableDirectives: 'warn', + }, + }, + { + ignores: [ + 'node_modules/', + 'coverage/', + 'es/', + 'lib/', + 'dist/', + 'docs-dist/', + '.docs-dist/', + '.dumi/', + '.doc/', + '.vercel/', + ], + }, + { + files: ['**/*.{js,jsx,ts,tsx}'], + extends: [ + js.configs.recommended, + react.configs.flat.recommended, + react.configs.flat['jsx-runtime'], + prettier, + ], + plugins: { + 'react-hooks': reactHooks, + }, + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + settings: { + react: { + version: 'detect', + }, + }, + rules: { + 'no-async-promise-executor': 'off', + 'no-empty-pattern': 'off', + 'no-irregular-whitespace': 'off', + 'no-prototype-builtins': 'off', + 'no-useless-escape': 'off', + 'no-extra-boolean-cast': 'off', + 'no-undef': 'off', + 'no-unused-vars': 'off', + 'react/no-find-dom-node': 'off', + 'react/display-name': 'off', + 'react/no-unknown-property': 'off', + 'react/prop-types': 'off', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/rules-of-hooks': 'error', + }, + }, + { + files: ['**/*.{ts,tsx}'], + extends: [...tseslint.configs.recommended], + rules: { + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', + '@typescript-eslint/no-unnecessary-type-constraint': 'off', + '@typescript-eslint/no-unused-vars': 'off', + }, + }, + { + files: ['src/**/*.{ts,tsx}'], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir, + }, + }, + }, + { + files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'], + extends: [jest.configs['flat/recommended']], + rules: { + 'jest/no-disabled-tests': 'off', + 'jest/no-done-callback': 'off', + 'jest/no-identical-title': 'off', + 'jest/expect-expect': 'off', + 'jest/no-alias-methods': 'off', + 'jest/no-conditional-expect': 'off', + 'jest/no-export': 'off', + 'jest/no-standalone-expect': 'off', + 'jest/valid-expect': 'off', + 'jest/valid-title': 'off', + }, + }, +]); diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 0000000..35306c6 --- /dev/null +++ b/global.d.ts @@ -0,0 +1 @@ +declare module '*.css'; diff --git a/now.json b/now.json deleted file mode 100644 index e257770..0000000 --- a/now.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 2, - "name": "@rc-component/dom-align", - "builds": [ - { - "src": "package.json", - "use": "@now/static-build", - "config": { "distDir": ".doc" } - } - ] -} diff --git a/package.json b/package.json index 10725ea..4938a6e 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,21 @@ { "name": "@rc-component/dom-align", "version": "2.0.1", - "description": "Align DOM Node Flexibly ", - "packageManager": "pnpm@8.9.0", - "engines": { - "node": ">=14.x" - }, + "description": "📐 DOM alignment utility for positioning one element against another.", "keywords": [ "react", "react-component", "dom-align" ], + "homepage": "https://github.com/react-component/dom-align", + "bugs": { + "url": "https://github.com/react-component/dom-align/issues" + }, + "repository": { + "type": "git", + "url": "git@github.com:react-component/dom-align.git" + }, + "license": "MIT", "main": "./lib/index", "module": "./es/index", "types": "./lib/index.d.ts", @@ -18,63 +23,70 @@ "es", "lib" ], - "homepage": "https://github.com/react-component/dom-align", - "repository": { - "type": "git", - "url": "git@github.com:react-component/dom-align.git" - }, - "bugs": { - "url": "https://github.com/react-component/dom-align/issues" - }, - "license": "MIT", "scripts": { - "start": "dumi dev", "build": "dumi build", "compile": "father build", - "prepublishOnly": "npm run compile && np --yolo --no-publish", "lint": "eslint src/ docs/ --ext .tsx,.ts,.jsx,.js", + "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", + "start": "dumi dev", "test": "cypress run --component && echo ''", "test:ci": "cypress run --component --record --key $CYPRESS_RECORD_KEY", - "tsc": "tsc --noEmit", - "now-build": "npm run build" + "tsc": "tsc --noEmit" }, "nyc": { - "excludeAfterRemap": true, "exclude": [ "**/node_modules/**/*", - "**/.pnpm/**/*", "**/cypress/**/*" ], + "excludeAfterRemap": true, "reporter": [ "text", "lcov" ] }, "dependencies": { - "@babel/runtime": "^7.25.4" + "@babel/runtime": "^7.29.7" }, "devDependencies": { + "@babel/core": "^8.0.1", + "@babel/preset-env": "^8.0.2", + "@babel/preset-react": "^8.0.1", + "@babel/preset-typescript": "^8.0.1", "@cypress/code-coverage": "~3.12.45", - "@rc-component/father-plugin": "^1.1.0", - "@types/node": "^20.16.1", - "@types/react": "~18.3.4", - "@types/react-dom": "~18.3.0", - "@umijs/fabric": "^4.0.1", + "@eslint/js": "^9.39.4", + "@rc-component/father-plugin": "^2.2.0", + "@rc-component/np": "^1.0.4", + "@types/node": "^26.0.1", + "@types/react": "^19.2.17", + "@types/react-dom": "^19.2.3", + "ajv": "^8.20.0", + "babel-loader": "^10.1.1", + "css-loader": "^7.1.2", "cypress": "^13.13.3", - "dumi": "^2.4.7", - "eslint": "^8.57.0", - "father": "^4.5.0", + "dumi": "^2.4.38", + "eslint": "^9.39.4", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jest": "^29.15.4", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", + "father": "^4.6.24", + "globals": "^17.7.0", "jsonp": "^0.2.1", "markdown-it": "^14.1.0", - "next": "~14.2.6", + "next": "^16.2.9", "normalize.css": "^8.0.1", - "np": "^7.7.0", - "prettier": "^2.8.8", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "prettier": "^3.9.4", + "react": "^19.2.7", + "react-dom": "^19.2.7", + "style-loader": "^4.0.0", "swc-plugin-coverage-instrument": "0.0.21", - "typescript": "~5.5.4" + "typescript": "^6.0.3", + "typescript-eslint": "^8.62.1", + "webpack": "^5.108.3" + }, + "engines": { + "node": ">=14.x" }, "publishConfig": { "access": "public" diff --git a/tsconfig.json b/tsconfig.json index 86cca09..372a11c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,18 @@ { "compilerOptions": { "target": "esnext", - "moduleResolution": "node", - "baseUrl": "./", + "strict": false, + "types": ["node", "jest"], + "moduleResolution": "bundler", "jsx": "preserve", "declaration": true, "skipLibCheck": true, "esModuleInterop": true, "paths": { - "@/*": ["src/*"], - "@@/*": ["src/.umi/*"], - "@rc-component/dom-align": ["src/index.ts"] + "@/*": ["./src/*"], + "@@/*": ["./src/.umi/*"], + "@rc-component/dom-align": ["./src/index.ts"] } - } + }, + "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"] } diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..fe70e76 --- /dev/null +++ b/vercel.json @@ -0,0 +1,6 @@ +{ + "framework": "umijs", + "installCommand": "npm install", + "buildCommand": "npm run build", + "outputDirectory": ".doc" +}