Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add version
  • Loading branch information
tangjinzhou committed Mar 21, 2018
1 parent b3ed6dd commit af93808
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 3 deletions.
4 changes: 2 additions & 2 deletions antd-tools/getWebpackConfig.js
Expand Up @@ -153,7 +153,7 @@ module.exports = function (modules) {
new webpack.BannerPlugin(`
${distFileBaseName} v${pkg.version}
Copyright 2017-present, vue-antd-ui, Inc.
Copyright 2017-present, vue-antd-ui.
All rights reserved.
`),
new webpack.ProgressPlugin((percentage, msg, addInfo) => {
Expand All @@ -170,7 +170,7 @@ All rights reserved.
}

if (process.env.RUN_ENV === 'PRODUCTION') {
const entry = ['./components/index']
const entry = ['./index']
config.entry = {
[`${distFileBaseName}.min`]: entry,
}
Expand Down
17 changes: 17 additions & 0 deletions components/index.js
@@ -1,3 +1,18 @@
/* @remove-on-es-build-begin */
// this file is not used if use https://github.com/ant-design/babel-plugin-import
const ENV = process.env.NODE_ENV
if (ENV !== 'production' &&
ENV !== 'test' &&
typeof console !== 'undefined' &&
console.warn &&
typeof window !== 'undefined') {
console.warn(
'You are using a whole package of antd, ' +
'please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.',
)
}
/* @remove-on-es-build-end */

import Button from './button'
const ButtonGroup = Button.Group
export { Button, ButtonGroup }
Expand Down Expand Up @@ -105,3 +120,5 @@ export { default as Calendar } from './calendar'
import DatePicker from './date-picker'
const { MonthPicker, RangePicker, WeekPicker } = DatePicker
export { DatePicker, MonthPicker, RangePicker, WeekPicker }

export { default as version } from './version'
3 changes: 3 additions & 0 deletions components/version/index.js
@@ -0,0 +1,3 @@
import { version } from '../../package.json'

export default version
2 changes: 2 additions & 0 deletions components/version/style/index.js
@@ -0,0 +1,2 @@
// empty file prevent babel-plugin-import error
import '../../style/index.less'
28 changes: 28 additions & 0 deletions index.js
@@ -0,0 +1,28 @@
/* eslint no-console:0 */
function camelCase (name) {
return name.charAt(0).toUpperCase() +
name.slice(1).replace(/-(\w)/g, (m, n) => {
return n.toUpperCase()
})
}

// Just import style for https://github.com/ant-design/ant-design/issues/3745
const req = require.context('./components', true, /^\.\/[^_][\w-]+\/style\/index\.js?$/)

req.keys().forEach((mod) => {
let v = req(mod)
if (v && v.default) {
v = v.default
}
const match = mod.match(/^\.\/([^_][\w-]+)\/index\.js?$/)
if (match && match[1]) {
if (match[1] === 'message' || match[1] === 'notification') {
// message & notification should not be capitalized
exports[match[1]] = v
} else {
exports[camelCase(match[1])] = v
}
}
})

module.exports = require('./components')
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "vue-antd-ui",
"version": "0.1.0",
"version": "0.1.1",
"title": "Ant Design Vue",
"description": "An enterprise-class UI design language and Vue-based implementation",
"keywords": [
Expand Down

0 comments on commit af93808

Please sign in to comment.