ant-design/scripts/prenpm.js

14 lines
546 B
JavaScript
Raw Normal View History

2015-07-15 12:07:11 +08:00
var fs = require('fs');
var cwd = process.cwd();
var path = require('path');
2015-07-21 18:06:42 +08:00
var pkg = require('../package');
2015-07-15 12:07:11 +08:00
var originalIndex = fs.readFileSync(path.join(cwd, 'index.js'), 'utf-8');
var newIndex = originalIndex
.replace(/\/components\//g, '/')
2015-10-20 16:47:55 +08:00
.replace("require('./package.json').version", "require('./version')")
2015-07-15 12:07:11 +08:00
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8');
2015-10-20 16:47:55 +08:00
fs.writeFileSync(path.join(cwd, 'lib/version.js'), "module.exports = '" + require('../package.json').version + "';", 'utf-8');
2015-10-19 11:43:52 +08:00
2015-07-21 18:06:42 +08:00
console.log('prenpm done');