diff --git a/CHANGELOG.md b/CHANGELOG.md index b1ee540eac..9a22244219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ --- +## 0.9.3 `2015-11-03` + +* 增加对 React 版本的检测机制,0.9.x 序列只能使用 react@0.13.x 。 + ## 0.9.2 `2015-10-26` * Tooltip 的 title 为空时不展示浮层。[9b53117](9b5311791e73270c7c16a602ac74dd59719a5f76) diff --git a/index.js b/index.js index aaded5e42c..677d7bd4eb 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +import React from 'react'; + require('./style/index.less'); // matchMedia polyfill for @@ -49,6 +51,14 @@ const antd = { // deprecate antd.confirm antd.confirm = require('util-deprecate')(antd.confirm, 'antd.confirm() is deprecated, use antd.Modal.confirm() instead'); +if (process.env.NODE_ENV !== 'production') { + const warning = require('warning'); + const semver = require('semver'); + const reactVersionInDeps = require('./package.json').devDependencies.react; + warning(semver.satisfies(React.version, reactVersionInDeps), + `antd@${antd.version} need to satisfies react@${reactVersionInDeps}.`); +} + module.exports = antd; antd.version = require('./package.json').version; diff --git a/package.json b/package.json index 7e58ff9548..a61daecd65 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "antd", - "version": "0.9.2", - "stableVersion": "0.9.2", + "version": "0.9.3", + "stableVersion": "0.9.3", "title": "Ant Design", "description": "一个 UI 设计语言", "homepage": "http://ant.design/", @@ -63,7 +63,9 @@ "react-slick": "~0.8.0", "reqwest-without-xhr2": "~2.0.2", "util-deprecate": "~1.0.1", - "velocity-animate": "~1.2.2" + "velocity-animate": "~1.2.2", + "warning": "~2.1.0", + "semver": "~5.0.3" }, "devDependencies": { "autoprefixer-loader": "^3.1.0", @@ -89,7 +91,6 @@ "precommit-hook": "^1.0.7", "react": "~0.13.0", "react-router": "1.0.0-rc1", - "semver": "~5.0.3", "webpack": "^1.10.1", "webpack-dev-middleware": "^1.2.0" },