babel index.js, fix beta10 bug

This commit is contained in:
afc163 2015-11-03 15:46:56 +08:00
parent 1b8a30ca1f
commit cef93e2148
3 changed files with 9 additions and 13 deletions

View File

@ -70,12 +70,4 @@ if (process.env.NODE_ENV !== 'production') {
`antd@${antd.version} need react@${reactVersionInDeps} or higher.`);
}
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) || semver.gtr(React.version, reactVersionInDeps),
`antd@${antd.version} need react@${reactVersionInDeps} or higher.`);
}
module.exports = antd;

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "0.10.0-beta10",
"version": "0.10.0-beta14",
"stableVersion": "0.9.3",
"title": "Ant Design",
"description": "一个 UI 设计语言",
@ -100,7 +100,7 @@
"webpack-dev-middleware": "^1.2.0"
},
"scripts": {
"babel": "babel components --out-dir lib",
"babel": "babel components index.js --out-dir lib",
"start": "npm run clean && nico server --watch",
"clean": "rm -rf _site dist",
"deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy",

View File

@ -3,13 +3,17 @@ var cwd = process.cwd();
var path = require('path');
var pkg = require('../package');
var originalIndex = fs.readFileSync(path.join(cwd, 'index.js'), 'utf-8');
var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8');
var newIndex = originalIndex
.replace(/\/components\//g, '/')
.replace("require('./package.json').version", "require('./version')")
.replace(/require\(\'\.\/package.json\'\)/g, "require('./package')")
.replace("require('./style/index.less')", "require('../style/index.less')");
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8');
fs.writeFileSync(path.join(cwd, 'lib/version.js'), "module.exports = '" + require('../package.json').version + "';", 'utf-8');
fs.writeFileSync(
path.join(cwd, 'lib/package.js'),
"module.exports = " + JSON.stringify(require('../package.json')) + ";",
'utf-8'
);
var antdCss = path.join(cwd, 'dist/index.css');
fs.createReadStream(antdCss)
.pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css')));