Browse Source

prepare npm

pull/44/head
yiminghe 9 years ago
parent
commit
b5e1ab5e47
  1. 36
      .npmignore
  2. 0
      HISTORY.md
  3. 2
      index.js
  4. 10
      package.json
  5. 11
      scripts/prenpm.js

36
.npmignore

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

2
index.js

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

10
package.json

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

@ -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');
Loading…
Cancel
Save