diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 34f224fa9f..0000000000 --- a/.npmignore +++ /dev/null @@ -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 diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/index.js b/index.js index 8e7fc3526a..dde40d1133 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,8 @@ var antd = { module.exports = antd; +antd.version = require('./package.json').version; + if (typeof window !== undefined) { window.antd = antd; } diff --git a/package.json b/package.json index d0a6c5b6ed..9a12baa95d 100644 --- a/package.json +++ b/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" diff --git a/scripts/prenpm.js b/scripts/prenpm.js new file mode 100644 index 0000000000..7f67818879 --- /dev/null +++ b/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'); \ No newline at end of file