diff --git a/.github/workflows/compressed-size.yml b/.github/workflows/compressed-size.yml index ce2746f881..33f3c2112a 100644 --- a/.github/workflows/compressed-size.yml +++ b/.github/workflows/compressed-size.yml @@ -1,6 +1,6 @@ name: 📦 Compressed Size -on: [pull_request] +on: [pull_request_target] jobs: build: @@ -11,6 +11,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge - uses: preactjs/compressed-size-action@v2 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lighthouse-ci.yml b/.github/workflows/lighthouse-ci.yml index f66f6d2e0e..60b4604e59 100644 --- a/.github/workflows/lighthouse-ci.yml +++ b/.github/workflows/lighthouse-ci.yml @@ -1,5 +1,7 @@ -name: CI +name: lighthouse ci + on: [push] + jobs: lighthouseci: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0a8c97ff9a..7b27afefa7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ -name: test +name: ✅ test -on: [push, pull_request] +on: push jobs: setup: @@ -18,7 +18,7 @@ jobs: - name: create package-lock.json run: npm i --package-lock-only - - name: hack for singe file + - name: hack for single file run: | if [ ! -d "package-temp-dir" ]; then mkdir package-temp-dir @@ -73,41 +73,6 @@ jobs: run: node ./tests/dekko/lib.test.js needs: setup - dist: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: dist - run: npm run dist - env: - NODE_OPTIONS: --max_old_space_size=4096 - - - name: check - run: node ./tests/dekko/dist.test.js - - - name: bundlesize - run: npm run bundlesize - - - name: test - run: npm test - env: - LIB_DIR: dist - needs: setup - lint: runs-on: ubuntu-latest steps: @@ -130,53 +95,6 @@ jobs: run: npm run lint needs: setup - dom: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: test - run: npm test -- -w 1 --coverage - - - name: coverage - run: bash <(curl -s https://codecov.io/bash) - needs: setup - - node: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: test - run: npm run test-node - needs: setup - check_metadata: runs-on: ubuntu-latest steps: @@ -199,7 +117,57 @@ jobs: run: node ./scripts/check-demo.js needs: setup - lib: + react-17-dom: + name: react@17.x / dom + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: test + run: npm test -- -w 1 --coverage + + - name: coverage + run: bash <(curl -s https://codecov.io/bash) + needs: setup + + react-17-node: + name: react@17.x / node + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: test + run: npm run test-node + needs: setup + + react-17-lib: + name: react@17.x / lib runs-on: ubuntu-latest steps: - name: checkout @@ -229,7 +197,8 @@ jobs: LIB_DIR: lib needs: compile - es: + react-17-es: + name: react@17.x / es runs-on: ubuntu-latest steps: - name: checkout @@ -258,3 +227,207 @@ jobs: env: LIB_DIR: es needs: compile + + react-17-dist: + name: react@17.x / dist + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: dist + run: npm run dist + env: + NODE_OPTIONS: --max_old_space_size=4096 + + - name: check + run: node ./tests/dekko/dist.test.js + + - name: bundlesize + run: npm run bundlesize + env: + BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }} + + - name: test + run: npm test + env: + LIB_DIR: dist + needs: setup + + react-16-dom: + name: react@16.x / dom + runs-on: ubuntu-latest + env: + REACT: 16 + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install react 16 + run: npm run install-react-16 + + - name: test + run: npm test -- -w 1 --coverage + needs: setup + + react-16-node: + name: react@16.x / node + runs-on: ubuntu-latest + env: + REACT: 16 + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install react 16 + run: npm run install-react-16 + + - name: test + run: npm run test-node + needs: setup + + react-16-lib: + name: react@16.x / lib + runs-on: ubuntu-latest + env: + REACT: 16 + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: restore cache from lib + uses: actions/cache@v2 + with: + path: lib + key: lib-${{ github.sha }} + + - name: install react 16 + run: npm run install-react-16 + + - name: test + run: npm test + env: + LIB_DIR: lib + needs: compile + + react-16-es: + name: react@16.x / es + runs-on: ubuntu-latest + env: + REACT: 16 + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: restore cache from es + uses: actions/cache@v2 + with: + path: es + key: es-${{ github.sha }} + + - name: install react 16 + run: npm run install-react-16 + + - name: test + run: npm test + env: + LIB_DIR: es + needs: compile + + react-16-dist: + name: react@16.x / dist + runs-on: ubuntu-latest + env: + REACT: 16 + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install react 16 + run: npm run install-react-16 + + - name: dist + run: npm run dist + env: + NODE_OPTIONS: --max_old_space_size=4096 + + - name: check + run: node ./tests/dekko/dist.test.js + + - name: test + run: npm test + env: + LIB_DIR: dist + needs: setup diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 30d62bdbb2..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: false - -language: node_js - -node_js: - - 11 - -cache: - directories: - - $HOME/.npm - -matrix: - fast_finish: true - include: - - env: TEST_TYPE=lint - - env: TEST_TYPE=test:dist - - env: TEST_TYPE=test:lib - - env: TEST_TYPE=test:es - - env: TEST_TYPE=test:dom - - env: TEST_TYPE=test:node - -script: - - scripts/travis-script.sh diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 3127a17dd7..75ee403c2e 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,13 @@ timeline: true --- +## 4.9.1 + +`2020-12-01` + +- TypeScript + - 🤖 Fix Collapse.Panel `collapsible` property to optional. [#28092](https://github.com/ant-design/ant-design/pull/28092) [@sammarks](https://github.com/sammarks) + ## 4.9.0 `2020-11-30` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 27969b0020..0ee61d66bd 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,13 @@ timeline: true --- +## 4.9.1 + +`2020-12-01` + +- TypeScript + - 🤖 修复 Collapse.Panel 可折叠属性 `collapsible` 为可选。[#28092](https://github.com/ant-design/ant-design/pull/28092) [@sammarks](https://github.com/sammarks) + ## 4.9.0 `2020-11-30` diff --git a/components/alert/__tests__/__snapshots__/index.test.tsx.snap b/components/alert/__tests__/__snapshots__/index.test.tsx.snap index a999ea6a8a..532e95c6b1 100644 --- a/components/alert/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/alert/__tests__/__snapshots__/index.test.tsx.snap @@ -1,32 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Alert ErrorBoundary 1`] = ` - -`; - exports[`Alert action of Alert custom action 1`] = `
{ }); }); - const testIt = process.env.REACT === '15' ? it.skip : it; - testIt('ErrorBoundary', () => { + it('ErrorBoundary', () => { // @ts-expect-error // eslint-disable-next-line react/jsx-no-undef const ThrowError = () => ; @@ -86,7 +85,7 @@ describe('Alert', () => { , ); // eslint-disable-next-line jest/no-standalone-expect - expect(wrapper.render()).toMatchSnapshot(); + expect(wrapper.text()).toContain('ReferenceError: NotExisted is not defined'); }); it('could be used with Tooltip', async () => { diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index 5984f8ced0..59df8e94d0 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -23,7 +23,7 @@ export interface CarouselProps extends Omit { } export interface CarouselRef { - goTo: (slide: number, dontAnimate: boolean) => void; + goTo: (slide: number, dontAnimate?: boolean) => void; next: () => void; prev: () => void; autoPlay: boolean; diff --git a/components/collapse/CollapsePanel.tsx b/components/collapse/CollapsePanel.tsx index 42e40e9150..68f796e424 100644 --- a/components/collapse/CollapsePanel.tsx +++ b/components/collapse/CollapsePanel.tsx @@ -18,7 +18,7 @@ export interface CollapsePanelProps { forceRender?: boolean; id?: string; extra?: React.ReactNode; - collapsible: CollapsibleType; + collapsible?: CollapsibleType; } const CollapsePanel: React.FC = props => { diff --git a/components/config-provider/__tests__/locale.test.js b/components/config-provider/__tests__/locale.test.js index 5ffb49f82c..88fde5250c 100644 --- a/components/config-provider/__tests__/locale.test.js +++ b/components/config-provider/__tests__/locale.test.js @@ -13,10 +13,6 @@ describe('ConfigProvider.Locale', () => { } it('not throw', () => { - if (process.env.REACT === '15') { - return; - } - mount( diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 919283ea34..86a8a5c99e 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -168,7 +168,7 @@ Provides array management for fields. | Property | Description | Type | Default | Version | | --- | --- | --- | --- | --- | -| children | Render function | (fields: Field\[], operation: { add, remove, move }) => React.ReactNode | - | | +| children | Render function | (fields: Field\[], operation: { add, remove, move }, meta: { errors }) => React.ReactNode | - | | | initialValue | Config sub default value. Form `initialValues` get higher priority when conflict | string | - | 4.9.0 | | name | Field name, support array | [NamePath](#NamePath) | - | | | rules | Validate rules, only support customize validator. Should work with [ErrorList](#Form.ErrorList) | { validator, message }\[] | - | 4.7.0 | @@ -201,7 +201,7 @@ Some operator functions in render form of Form.List. ## Form.ErrorList -New in 4.7.0. Show error messages, should only work with `rules` of Form.List. +New in 4.7.0. Show error messages, should only work with `rules` of Form.List. See [example](#components-form-demo-dynamic-form-item). | Property | Description | Type | Default | | --- | --- | --- | --- | diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index e40dfce8f3..396462ce49 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -169,7 +169,7 @@ Form 通过增量更新方式,只更新被修改的字段相关组件以达到 | 参数 | 说明 | 类型 | 默认值 | 版本 | | --- | --- | --- | --- | --- | -| children | 渲染函数 | (fields: Field\[], operation: { add, remove, move }) => React.ReactNode | - | | +| children | 渲染函数 | (fields: Field\[], operation: { add, remove, move }, meta: { errors }) => React.ReactNode | - | | | initialValue | 设置子元素默认值,如果与 Form 的 `initialValues` 冲突则以 Form 为准 | string | - | 4.9.0 | | name | 字段名,支持数组 | [NamePath](#NamePath) | - | | | rules | 校验规则,仅支持自定义规则。需要配合 [ErrorList](#Form.ErrorList) 一同使用。 | { validator, message }\[] | - | 4.7.0 | @@ -203,7 +203,7 @@ Form.List 渲染表单相关操作函数。 ## Form.ErrorList -4.7.0 新增。错误展示组件,仅限配合 Form.List 的 rules 一同使用。 +4.7.0 新增。错误展示组件,仅限配合 Form.List 的 rules 一同使用。参考[示例](#components-form-demo-dynamic-form-item)。 | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | diff --git a/components/grid/__tests__/index.test.js b/components/grid/__tests__/index.test.js index 4e8db8811f..58efb4da5e 100644 --- a/components/grid/__tests__/index.test.js +++ b/components/grid/__tests__/index.test.js @@ -1,5 +1,6 @@ import React from 'react'; import { render, mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; import { Col, Row } from '..'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; @@ -75,10 +76,12 @@ describe('Grid', () => { expect(wrapper).toMatchSnapshot(); }); - it('when component has been unmounted, componentWillUnmount should be called', () => { + it('ResponsiveObserve.unsubscribe should be called when unmounted', () => { const Unmount = jest.spyOn(ResponsiveObserve, 'unsubscribe'); const wrapper = mount(); - wrapper.unmount(); + act(() => { + wrapper.unmount(); + }); expect(Unmount).toHaveBeenCalled(); }); diff --git a/components/switch/__tests__/__snapshots__/index.test.js.snap b/components/switch/__tests__/__snapshots__/index.test.js.snap index ff6873ee61..9810315a02 100644 --- a/components/switch/__tests__/__snapshots__/index.test.js.snap +++ b/components/switch/__tests__/__snapshots__/index.test.js.snap @@ -15,24 +15,3 @@ exports[`Switch rtl render component should be rendered correctly in RTL directi /> `; - -exports[`Switch should has click wave effect 1`] = ` - -`; diff --git a/components/switch/__tests__/index.test.js b/components/switch/__tests__/index.test.js index aebeebe1a6..e96a669f6d 100644 --- a/components/switch/__tests__/index.test.js +++ b/components/switch/__tests__/index.test.js @@ -15,7 +15,7 @@ describe('Switch', () => { const wrapper = mount(); wrapper.find('.ant-switch').getDOMNode().click(); await new Promise(resolve => setTimeout(resolve, 0)); - expect(wrapper.render()).toMatchSnapshot(); + expect(wrapper.find('button').getDOMNode().getAttribute('ant-click-animating')).toBe('true'); }); it('warning if set `value`', () => { diff --git a/components/timeline/Timeline.tsx b/components/timeline/Timeline.tsx index 7d1dbebc55..4cfc617feb 100644 --- a/components/timeline/Timeline.tsx +++ b/components/timeline/Timeline.tsx @@ -29,8 +29,8 @@ const Timeline: TimelineType = props => { pendingDot, children, className, - reverse, - mode, + reverse = false, + mode = '' as TimelineProps['mode'], ...restProps } = props; const prefixCls = getPrefixCls('timeline', customizePrefixCls); @@ -42,9 +42,11 @@ const Timeline: TimelineType = props => { ) : null; - const timeLineItems = reverse - ? [pendingItem, ...React.Children.toArray(children).reverse()] - : [...React.Children.toArray(children), pendingItem]; + const timeLineItems = React.Children.toArray(children); + timeLineItems.push(pendingItem as any); + if (reverse) { + timeLineItems.reverse(); + } const getPositionCls = (ele: React.ReactElement, idx: number) => { if (mode === 'alternate') { @@ -97,9 +99,4 @@ const Timeline: TimelineType = props => { Timeline.Item = TimelineItem; -Timeline.defaultProps = { - reverse: false, - mode: '' as TimelineProps['mode'], -}; - export default Timeline; diff --git a/package.json b/package.json index 6d0ae97a35..63b8115d4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.9.0", + "version": "4.9.1", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ @@ -60,7 +60,7 @@ "compile": "antd-tools run compile", "compile:less": "antd-tools run compile:less", "changelog": "node ./scripts/print-changelog", - "predeploy": "antd-tools run clean && npm run site && cp CNAME _site && cp -r _site && npm run site:test", + "predeploy": "antd-tools run clean && npm run site && cp CNAME _site && npm run site:test", "deploy": "bisheng gh-pages --push-only --dotfiles", "deploy:china-mirror": "git checkout gh-pages && git pull origin gh-pages && git push git@gitee.com:ant-design/ant-design.git gh-pages", "dist": "antd-tools run dist", @@ -83,7 +83,6 @@ "sort": "npx sort-package-json", "sort-api": "antd-tools run sort-api-table", "start": "antd-tools run clean && cross-env NODE_ENV=development concurrently \"npm run color-less\" \"bisheng start -c ./site/bisheng.config.js\"", - "start:preact": "antd-tools run clean && cross-env NODE_ENV=development REACT_ENV=preact concurrently \"npm run color-less\" \"bisheng start -c ./site/bisheng.config.js\"", "test": "jest --config .jest.js --cache=false", "test:update": "jest --config .jest.js --cache=false -u", "test-all": "sh -e ./scripts/test-all.sh", @@ -92,6 +91,7 @@ "site:test": "jest --config .jest.site.js --cache=false --force-exit", "test-image": "npm run compile:less && docker-compose run tests", "version": "node ./scripts/generate-version", + "install-react-16": "npm i --no-save react@16 react-dom@16 react-test-renderer@16 enzyme-adapter-react-16", "argos": "argos upload imageSnapshots" }, "husky": { @@ -164,13 +164,14 @@ "@types/jest-image-snapshot": "^4.1.0", "@types/lodash": "^4.14.139", "@types/puppeteer": "^5.4.0", - "@types/react": "^16.9.21", + "@types/react": "^17.0.0", "@types/react-color": "^3.0.1", "@types/react-copy-to-clipboard": "^4.3.0", - "@types/react-dom": "^16.9.5", + "@types/react-dom": "^17.0.0", "@types/warning": "^3.0.0", "@typescript-eslint/eslint-plugin": "^4.1.1", "@typescript-eslint/parser": "^4.1.1", + "@wojtekmaj/enzyme-adapter-react-17": "^0.3.1", "antd-img-crop": "^3.1.1", "antd-pro-merge-less": "^3.0.11", "antd-theme-generator": "^1.2.3", @@ -178,9 +179,9 @@ "array-move": "^3.0.0", "babel-eslint": "^10.0.1", "babel-plugin-add-react-displayname": "^0.0.5", - "bisheng": "^1.5.3", + "bisheng": "^2.0.0", "bisheng-plugin-description": "^0.1.4", - "bisheng-plugin-react": "^1.1.0", + "bisheng-plugin-react": "^1.1.2", "bisheng-plugin-toc": "^0.4.4", "bundlesize": "^0.18.0", "chalk": "^4.0.0", @@ -193,7 +194,6 @@ "docsearch.js": "^2.6.3", "enquire-js": "^0.2.1", "enzyme": "^3.10.0", - "enzyme-adapter-react-16": "^1.14.0", "enzyme-to-json": "^3.6.0", "esbuild-webpack-plugin": "^1.0.0", "eslint": "^7.9.0", @@ -232,8 +232,6 @@ "mockdate": "^3.0.0", "node-fetch": "^2.6.0", "open": "^7.0.3", - "preact": "^10.0.0", - "preact-compat": "^3.18.5", "prettier": "^2.2.0", "pretty-quick": "^3.0.0", "querystring": "^0.2.0", @@ -243,12 +241,12 @@ "rc-trigger": "^5.1.2", "rc-tween-one": "^2.4.1", "rc-virtual-list": "^3.0.3", - "react": "^16.9.0", + "react": "^17.0.1", "react-color": "^2.17.3", "react-copy-to-clipboard": "^5.0.1", "react-dnd": "^11.1.1", "react-dnd-html5-backend": "^11.1.1", - "react-dom": "^16.9.0", + "react-dom": "^17.0.1", "react-draggable": "^4.4.3", "react-github-button": "^0.1.11", "react-helmet-async": "^1.0.4", @@ -259,7 +257,7 @@ "react-router-dom": "^5.0.1", "react-sortable-hoc": "^1.11.0", "react-sticky": "^6.0.3", - "react-test-renderer": "^16.8.6", + "react-test-renderer": "^17.0.1", "react-text-loop": "^2.3.0", "react-virtualized": "^9.22.0", "react-window": "^1.8.5", diff --git a/scripts/travis-script.sh b/scripts/travis-script.sh deleted file mode 100755 index a749e4338d..0000000000 --- a/scripts/travis-script.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -set -x -set -e - -run_test() { - if [ "$REACT" != 16 ]; then - npm test -- -w 2 -u $* - else - npm test -- -w 2 $* - fi -} - -run_test_node() { - if [ "$REACT" != 16 ]; then - npm run test-node -- -w 2 -u - else - npm run test-node -- -w 2 - fi -} - -if [ "$TEST_TYPE" = lint ]; then - npm run lint -elif [ "$TEST_TYPE" = test:dist ]; then - npm run dist - node ./tests/dekko/dist.test.js - LIB_DIR=dist run_test -elif [ "$TEST_TYPE" = test:lib ]; then - npm run compile - node ./tests/dekko/lib.test.js - LIB_DIR=lib run_test -elif [ "$TEST_TYPE" = test:es ]; then - npm run compile - LIB_DIR=es run_test -elif [ "$TEST_TYPE" = test:dom ]; then - run_test --coverage - if [ "$REACT" = 16 ]; then - bash <(curl -s https://codecov.io/bash) - fi -elif [ "$TEST_TYPE" = test:node ]; then - run_test_node -fi diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 4eab8058fc..3ab016209e 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -9,7 +9,6 @@ const themeConfig = require('./themeConfig'); const { webpack } = getWebpackConfig; const isDev = process.env.NODE_ENV === 'development'; -const usePreact = process.env.REACT_ENV === 'preact'; function alertBabelConfig(rules) { rules.forEach(rule => { @@ -72,16 +71,6 @@ module.exports = { 'react-router-dom': 'ReactRouterDOM', }; - if (usePreact) { - config.resolve.alias = { - ...config.resolve.alias, - react: 'preact-compat', - 'react-dom': 'preact-compat', - 'create-react-class': 'preact-compat/lib/create-react-class', - 'react-router': 'react-router', - }; - } - if (isDev) { config.devtool = 'source-map'; @@ -124,6 +113,5 @@ module.exports = { htmlTemplateExtraData: { isDev, - usePreact, }, }; diff --git a/tests/setup.js b/tests/setup.js index 43dfd5557c..a68518eaf7 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -31,7 +31,10 @@ if (typeof window !== 'undefined') { const Enzyme = require('enzyme'); -const Adapter = require('enzyme-adapter-react-16'); +const Adapter = + process.env.REACT === '16' + ? require('enzyme-adapter-react-16') // eslint-disable-line import/no-extraneous-dependencies,import/no-unresolved + : require('@wojtekmaj/enzyme-adapter-react-17'); Enzyme.configure({ adapter: new Adapter() });