Browse Source

add version

pull/165/head
tjz 7 years ago
parent
commit
464582ded6
  1. 4
      antd-tools/getWebpackConfig.js
  2. 17
      components/index.js
  3. 3
      components/version/index.js
  4. 2
      components/version/style/index.js
  5. 28
      index.js
  6. 2
      package.json

4
antd-tools/getWebpackConfig.js

@ -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) => {
@ -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,
}

17
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 }
@ -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
components/version/index.js

@ -0,0 +1,3 @@
import { version } from '../../package.json'
export default version

2
components/version/style/index.js

@ -0,0 +1,2 @@
// empty file prevent babel-plugin-import error
import '../../style/index.less'

28
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
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": [

Loading…
Cancel
Save