update index

This commit is contained in:
yiminghe 2016-01-14 19:38:07 +08:00
parent 1afb9b543d
commit 6a6cc8228a
2 changed files with 6 additions and 13 deletions

View File

@ -1,4 +1,6 @@
import React from 'react';
// this file is not used if use https://github.com/ant-design/babel-plugin-antd
const React = require('react');
const antd = {
Affix: require('./components/affix'),
@ -47,10 +49,9 @@ const antd = {
Cascader: require('./components/cascader'),
};
antd.version = require('./package.json').version;
const ReactVersion = React.version;
if (process.env.NODE_ENV !== 'production') {
antd.version = require('./package.json').version;
const ReactVersion = React.version;
const warning = require('warning');
const semver = require('semver');
const reactVersionInDeps = require('./package.json').devDependencies.react;

View File

@ -1,18 +1,10 @@
var fs = require('fs');
var cwd = process.cwd();
var path = require('path');
var pkg = require('../package');
var originalIndex = fs.readFileSync(path.join(cwd, 'lib/index.js'), 'utf-8');
var newIndex = originalIndex
.replace(/\/components\//g, '/')
.replace(/require\(\'\.\/package.json\'\)/g, "require('./package')");
.replace(/\/components\//g, '/');
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, '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/antd.css');
fs.createReadStream(antdCss)
.pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css')));