prepare npm

This commit is contained in:
yiminghe 2015-07-15 12:07:11 +08:00
parent fced70bd69
commit b5e1ab5e47
5 changed files with 22 additions and 37 deletions

View File

@ -1,36 +0,0 @@
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.log
node_modules/
.buildpath
.settings
npm-debug.log
nohup.out
_site
dist
**/*.md
docs
node_modules
theme
static
site
dist
*.yml
CNAME
nico.js
deploy.js
scripts

0
HISTORY.md Normal file
View File

View File

@ -25,6 +25,8 @@ var antd = {
module.exports = antd;
antd.version = require('./package.json').version;
if (typeof window !== undefined) {
window.antd = antd;
}

View File

@ -4,6 +4,12 @@
"title": "Ant Design",
"description": "一个设计&前端框架",
"homepage": "http://ant-design.github.io/",
"keywords": [
"ant design",
"react-component",
"ui component"
],
"contributors": ["ant"],
"repository": {
"type": "git",
"url": "https://github.com/ant-design/ant-design"
@ -11,6 +17,8 @@
"bugs": {
"url": "https://github.com/ant-design/ant-design/issues"
},
"main": "lib/index",
"files": ["lib"],
"license": "MIT",
"dependencies": {
"gregorian-calendar": "~3.0.0",
@ -62,7 +70,7 @@
"deploy": "rm -rf node_modules && node scripts/install.js && npm run pack && node scripts/deploy.js",
"lint": "eslint components index.js --ext '.js,.jsx'",
"test": "webpack && npm run lint",
"prepublish": "npm run babel"
"prepublish": "npm run babel && rm -rf dist && webpack && node scripts/prenpm.js"
},
"precommit": [
"lint"

11
scripts/prenpm.js Normal file
View File

@ -0,0 +1,11 @@
var fs = require('fs');
var cwd = process.cwd();
var path = require('path');
var originalIndex = fs.readFileSync(path.join(cwd, 'index.js'), 'utf-8');
var newIndex = originalIndex
.replace(/\/components\//g, '/')
.replace("require('./package.json').version", "'" + require('../package.json').version + "'")
.replace("require('./style/index.less')", "require('./index.css')");
fs.writeFileSync(path.join(cwd, 'lib/index.js'), newIndex, 'utf-8');
fs.createReadStream(path.join(cwd, 'dist/antd.css')).pipe(fs.createWriteStream(path.join(cwd, 'lib/index.css')));
console.log('prenpm done');