Browse Source

update index

pull/911/head
yiminghe 9 years ago
parent
commit
6a6cc8228a
  1. 9
      index.js
  2. 10
      scripts/prenpm.js

9
index.js

@ -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;

10
scripts/prenpm.js

@ -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')));

Loading…
Cancel
Save