mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 13:08:48 +08:00
add publish sh
This commit is contained in:
parent
c953ca07bb
commit
288205c953
3
.gitignore
vendored
3
.gitignore
vendored
@ -58,7 +58,8 @@ typings/
|
||||
.env
|
||||
.idea
|
||||
.DS_Store
|
||||
dist/
|
||||
dist
|
||||
lib
|
||||
|
||||
# 备份文件
|
||||
/components/test/*
|
||||
|
213
LICENSE
213
LICENSE
@ -1,201 +1,22 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
MIT License
|
||||
|
||||
1. Definitions.
|
||||
Copyright (c) 2017-present tangjinzhou
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
46
README-zh_CN.md
Normal file
46
README-zh_CN.md
Normal file
@ -0,0 +1,46 @@
|
||||
<p align="center">
|
||||
<a href="https://vuecomponent.github.io/ant-design/">
|
||||
<img width="230" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Ant Design Vue
|
||||
[![Travis branch](https://img.shields.io/travis/vueComponent/ant-design/master.svg?style=flat-square)](https://travis-ci.org/vueComponent/ant-design)
|
||||
[![Dependency Status](https://beta.gemnasium.com/badges/github.com/vueComponent/ant-design.svg)](https://beta.gemnasium.com/projects/github.com/vueComponent/ant-design)
|
||||
[![npm package](https://img.shields.io/npm/v/vue-ant-design/next.svg?style=flat-square)](https://www.npmjs.org/package/vue-ant-design)
|
||||
[![NPM downloads](http://img.shields.io/npm/dm/vue-ant-design.svg?style=flat-square)](https://npmjs.org/package/ant-design)
|
||||
[![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://www.npmjs.com/package/vue-ant-design)
|
||||
|
||||
|
||||
Ant Design 的 Angular 实现,开发和服务于企业级后台产品。
|
||||
|
||||
|
||||
[README in English](README.md)
|
||||
|
||||
## 特性
|
||||
|
||||
- 提炼自企业级中后台产品的交互语言和视觉风格。
|
||||
- 开箱即用的高质量 React 组件。
|
||||
- 全链路开发和设计工具体系。
|
||||
|
||||
## 安装
|
||||
|
||||
### 使用 npm 或 yarn 安装
|
||||
|
||||
```bash
|
||||
$ npm install vue-ant-design --save
|
||||
```
|
||||
|
||||
```bash
|
||||
$ yarn add vue-ant-design
|
||||
```
|
||||
|
||||
如果你的网络环境不佳,推荐使用 [cnpm](https://github.com/cnpm/cnpm)。
|
||||
|
||||
|
||||
## 链接
|
||||
|
||||
- [首页](https://vuecomponent.github.io/ant-design/)
|
||||
- [Vue官方文档](https://cn.vuejs.org/)
|
||||
- [Antd React](http://ant.design/)
|
||||
|
48
README.md
48
README.md
@ -1,4 +1,46 @@
|
||||
# ant-design
|
||||
ant-design
|
||||
<p align="center">
|
||||
<a href="https://vuecomponent.github.io/ant-design/">
|
||||
<img width="230" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Ant Design Vue
|
||||
[![Travis branch](https://img.shields.io/travis/vueComponent/ant-design/master.svg?style=flat-square)](https://travis-ci.org/vueComponent/ant-design)
|
||||
[![Dependency Status](https://beta.gemnasium.com/badges/github.com/vueComponent/ant-design.svg)](https://beta.gemnasium.com/projects/github.com/vueComponent/ant-design)
|
||||
[![npm package](https://img.shields.io/npm/v/vue-ant-design/next.svg?style=flat-square)](https://www.npmjs.org/package/vue-ant-design)
|
||||
[![NPM downloads](http://img.shields.io/npm/dm/vue-ant-design.svg?style=flat-square)](https://npmjs.org/package/ant-design)
|
||||
[![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://www.npmjs.com/package/vue-ant-design)
|
||||
|
||||
|
||||
An enterprise-class UI components based on Ant Design and Vue.
|
||||
|
||||
[README in English](README.md)
|
||||
|
||||
## 特性
|
||||
|
||||
- An enterprise-class UI design system for desktop applications.
|
||||
- A set of high-quality React components out of the box.
|
||||
- The whole package of development and design resources and tools.
|
||||
|
||||
|
||||
## 安装
|
||||
|
||||
### 使用 npm 或 yarn 安装
|
||||
|
||||
```bash
|
||||
$ npm install vue-ant-design --save
|
||||
```
|
||||
|
||||
```bash
|
||||
$ yarn add vue-ant-design
|
||||
```
|
||||
|
||||
如果你的网络环境不佳,推荐使用 [cnpm](https://github.com/cnpm/cnpm)。
|
||||
|
||||
|
||||
## 链接
|
||||
|
||||
- [首页](https://vuecomponent.github.io/ant-design/)
|
||||
- [Vue官方文档](https://cn.vuejs.org/)
|
||||
- [Ant Design React](http://ant.design/)
|
||||
|
||||
[Vue Ant Design](https://vuecomponent.github.io/ant-design)
|
||||
|
27
antd-tools/cli/index.js
Normal file
27
antd-tools/cli/index.js
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
require('colorful').colorful()
|
||||
|
||||
const program = require('commander')
|
||||
const packageInfo = require('../../package.json')
|
||||
|
||||
program
|
||||
.version(packageInfo.version)
|
||||
.command('run [name]', 'run specified task')
|
||||
.parse(process.argv)
|
||||
|
||||
// https://github.com/tj/commander.js/pull/260
|
||||
const proc = program.runningCommand
|
||||
if (proc) {
|
||||
proc.on('close', process.exit.bind(process))
|
||||
proc.on('error', () => {
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
const subCmd = program.args[0]
|
||||
if (!subCmd || subCmd !== 'run') {
|
||||
program.help()
|
||||
}
|
26
antd-tools/cli/run.js
Normal file
26
antd-tools/cli/run.js
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
require('colorful').colorful()
|
||||
const gulp = require('gulp')
|
||||
const program = require('commander')
|
||||
|
||||
program.on('--help', () => {
|
||||
console.log(' Usage:'.to.bold.blue.color)
|
||||
console.log()
|
||||
})
|
||||
|
||||
program.parse(process.argv)
|
||||
|
||||
const task = program.args[0]
|
||||
|
||||
if (!task) {
|
||||
program.help()
|
||||
} else {
|
||||
console.log('antd-tools run', task)
|
||||
|
||||
require('../gulpfile')
|
||||
|
||||
gulp.start(task)
|
||||
}
|
15
antd-tools/getBabelCommonConfig.js
Normal file
15
antd-tools/getBabelCommonConfig.js
Normal file
@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function (modules) {
|
||||
const plugins = [
|
||||
'babel-plugin-transform-vue-jsx',
|
||||
'babel-plugin-transform-object-rest-spread',
|
||||
'babel-plugin-syntax-dynamic-import',
|
||||
'babel-plugin-transform-decorators-legacy',
|
||||
]
|
||||
|
||||
return {
|
||||
presets: ['babel-preset-env'],
|
||||
plugins,
|
||||
}
|
||||
}
|
210
antd-tools/getWebpackConfig.js
Normal file
210
antd-tools/getWebpackConfig.js
Normal file
@ -0,0 +1,210 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
|
||||
const deepAssign = require('deep-assign')
|
||||
const chalk = require('chalk')
|
||||
const postcssConfig = require('./postcssConfig')
|
||||
const distFileBaseName = 'antd'
|
||||
module.exports = function (modules) {
|
||||
const pkg = require(path.join(process.cwd(), 'package.json'))
|
||||
const babelConfig = require('./getBabelCommonConfig')(modules || false)
|
||||
|
||||
const pluginImportOptions = [
|
||||
{
|
||||
style: true,
|
||||
libraryName: 'antd',
|
||||
libraryDirectory: 'components',
|
||||
},
|
||||
]
|
||||
|
||||
// if (distFileBaseName !== 'antd') {
|
||||
// pluginImportOptions.push({
|
||||
// style: 'css',
|
||||
// libraryDirectory: 'components',
|
||||
// libraryName: 'antd',
|
||||
// })
|
||||
// }
|
||||
|
||||
babelConfig.plugins.push([
|
||||
require.resolve('babel-plugin-import'),
|
||||
pluginImportOptions,
|
||||
])
|
||||
|
||||
const config = {
|
||||
devtool: 'source-map',
|
||||
|
||||
output: {
|
||||
path: path.join(process.cwd(), './dist/'),
|
||||
filename: '[name].js',
|
||||
},
|
||||
|
||||
resolve: {
|
||||
modules: ['node_modules', path.join(__dirname, '../node_modules')],
|
||||
extensions: ['.js', '.vue', '.md', '.json'],
|
||||
alias: {
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'@': process.cwd(),
|
||||
},
|
||||
},
|
||||
|
||||
node: [
|
||||
'child_process',
|
||||
'cluster',
|
||||
'dgram',
|
||||
'dns',
|
||||
'fs',
|
||||
'module',
|
||||
'net',
|
||||
'readline',
|
||||
'repl',
|
||||
'tls',
|
||||
].reduce((acc, name) => Object.assign({}, acc, { [name]: 'empty' }), {}),
|
||||
|
||||
module: {
|
||||
noParse: [/moment.js/],
|
||||
rules: [
|
||||
{
|
||||
test: /\.vue$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: babelConfig,
|
||||
},
|
||||
{
|
||||
loader: 'vue-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader', exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ExtractTextPlugin.extract({
|
||||
use: [
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: Object.assign(
|
||||
{},
|
||||
postcssConfig,
|
||||
{ sourceMap: true }
|
||||
),
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: ExtractTextPlugin.extract({
|
||||
use: [
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: Object.assign(
|
||||
{},
|
||||
postcssConfig,
|
||||
{ sourceMap: true }
|
||||
),
|
||||
},
|
||||
{
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new ExtractTextPlugin({
|
||||
filename: '[name].css',
|
||||
disable: false,
|
||||
allChunks: true,
|
||||
}),
|
||||
new CaseSensitivePathsPlugin(),
|
||||
new webpack.BannerPlugin(`
|
||||
${distFileBaseName} v${pkg.version}
|
||||
|
||||
Copyright 2017-present, tangjinzhou, Inc.
|
||||
All rights reserved.
|
||||
`),
|
||||
new webpack.ProgressPlugin((percentage, msg, addInfo) => {
|
||||
const stream = process.stderr
|
||||
if (stream.isTTY && percentage < 0.71) {
|
||||
stream.cursorTo(0)
|
||||
stream.write(`📦 ${chalk.magenta(msg)} (${chalk.magenta(addInfo)})`)
|
||||
stream.clearLine(1)
|
||||
} else if (percentage === 1) {
|
||||
console.log(chalk.green('\nwebpack: bundle build is now finished.'))
|
||||
}
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
||||
if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||
const entry = ['./components/index']
|
||||
config.entry = {
|
||||
[`${distFileBaseName}.min`]: entry,
|
||||
}
|
||||
config.externals = {
|
||||
vue: {
|
||||
root: 'Vue',
|
||||
commonjs2: 'vue',
|
||||
commonjs: 'vue',
|
||||
amd: 'vue',
|
||||
},
|
||||
}
|
||||
config.output.library = distFileBaseName
|
||||
config.output.libraryTarget = 'umd'
|
||||
|
||||
const uncompressedConfig = deepAssign({}, config)
|
||||
|
||||
config.plugins = config.plugins.concat([
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
sourceMap: true,
|
||||
output: {
|
||||
ascii_only: true,
|
||||
},
|
||||
compress: {
|
||||
warnings: false,
|
||||
},
|
||||
}),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
|
||||
}),
|
||||
])
|
||||
|
||||
uncompressedConfig.entry = {
|
||||
[distFileBaseName]: entry,
|
||||
}
|
||||
|
||||
uncompressedConfig.plugins.push(new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
||||
}))
|
||||
|
||||
return [config, uncompressedConfig]
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
70
antd-tools/gulpfile.js
Normal file
70
antd-tools/gulpfile.js
Normal file
@ -0,0 +1,70 @@
|
||||
'use strict'
|
||||
|
||||
// const install = require('./install')
|
||||
// const runCmd = require('./runCmd')
|
||||
// const getBabelCommonConfig = require('./getBabelCommonConfig')
|
||||
// const merge2 = require('merge2')
|
||||
// const { execSync } = require('child_process')
|
||||
// const through2 = require('through2')
|
||||
// const transformLess = require('./transformLess')
|
||||
const webpack = require('webpack')
|
||||
// const babel = require('gulp-babel')
|
||||
// const argv = require('minimist')(process.argv.slice(2))
|
||||
// const GitHub = require('github')
|
||||
|
||||
// const packageJson = require(`${process.cwd()}/package.json`)
|
||||
// const getNpm = require('./getNpm')
|
||||
// const selfPackage = require('../package.json')
|
||||
// const chalk = require('chalk')
|
||||
// const getNpmArgs = require('./utils/get-npm-args')
|
||||
// const getChangelog = require('./utils/getChangelog')
|
||||
const path = require('path')
|
||||
// const watch = require('gulp-watch')
|
||||
const gulp = require('gulp')
|
||||
// const fs = require('fs')
|
||||
const rimraf = require('rimraf')
|
||||
|
||||
const cwd = process.cwd()
|
||||
// const libDir = path.join(cwd, 'lib')
|
||||
|
||||
function dist (done) {
|
||||
rimraf.sync(path.join(cwd, 'dist'))
|
||||
process.env.RUN_ENV = 'PRODUCTION'
|
||||
const webpackConfig = require(path.join(cwd, 'webpack.build.config.js'))
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
if (err) {
|
||||
console.error(err.stack || err)
|
||||
if (err.details) {
|
||||
console.error(err.details)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const info = stats.toJson()
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.error(info.errors)
|
||||
}
|
||||
|
||||
if (stats.hasWarnings()) {
|
||||
console.warn(info.warnings)
|
||||
}
|
||||
|
||||
const buildInfo = stats.toString({
|
||||
colors: true,
|
||||
children: true,
|
||||
chunks: false,
|
||||
modules: false,
|
||||
chunkModules: false,
|
||||
hash: false,
|
||||
version: false,
|
||||
})
|
||||
console.log(buildInfo)
|
||||
done(0)
|
||||
})
|
||||
}
|
||||
|
||||
gulp.task('dist', (done) => {
|
||||
dist(done)
|
||||
})
|
||||
|
18
antd-tools/postcssConfig.js
Normal file
18
antd-tools/postcssConfig.js
Normal file
@ -0,0 +1,18 @@
|
||||
const rucksack = require('rucksack-css')
|
||||
const autoprefixer = require('autoprefixer')
|
||||
|
||||
module.exports = {
|
||||
plugins: [
|
||||
rucksack(),
|
||||
autoprefixer({
|
||||
browsers: [
|
||||
'last 2 versions',
|
||||
'Firefox ESR',
|
||||
'> 1%',
|
||||
'ie >= 9',
|
||||
'iOS >= 8',
|
||||
'Android >= 4',
|
||||
],
|
||||
}),
|
||||
],
|
||||
}
|
20
antd-tools/runCmd.js
Normal file
20
antd-tools/runCmd.js
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
const getRunCmdEnv = require('./utils/getRunCmdEnv')
|
||||
|
||||
function runCmd (cmd, _args, fn) {
|
||||
const args = _args || []
|
||||
const runner = require('child_process').spawn(cmd, args, {
|
||||
// keep color
|
||||
stdio: 'inherit',
|
||||
env: getRunCmdEnv(),
|
||||
})
|
||||
|
||||
runner.on('close', (code) => {
|
||||
if (fn) {
|
||||
fn(code)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = runCmd
|
33
antd-tools/transformLess.js
Normal file
33
antd-tools/transformLess.js
Normal file
@ -0,0 +1,33 @@
|
||||
const less = require('less')
|
||||
const { readFileSync } = require('fs')
|
||||
const path = require('path')
|
||||
const postcss = require('postcss')
|
||||
const NpmImportPlugin = require('less-plugin-npm-import')
|
||||
const postcssConfig = require('./postcssConfig')
|
||||
|
||||
function transformLess (lessFile, config = {}) {
|
||||
const { cwd = process.cwd() } = config
|
||||
const resolvedLessFile = path.resolve(cwd, lessFile)
|
||||
|
||||
let data = readFileSync(resolvedLessFile, 'utf-8')
|
||||
data = data.replace(/^\uFEFF/, '')
|
||||
|
||||
// Do less compile
|
||||
const lessOpts = {
|
||||
paths: [path.dirname(resolvedLessFile)],
|
||||
filename: resolvedLessFile,
|
||||
plugins: [
|
||||
new NpmImportPlugin({ prefix: '~' }),
|
||||
],
|
||||
}
|
||||
return less.render(data, lessOpts)
|
||||
.then((result) => {
|
||||
const source = result.css
|
||||
return postcss(postcssConfig.plugins).process(source)
|
||||
})
|
||||
.then((r) => {
|
||||
return r.css
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = transformLess
|
18
antd-tools/utils/get-npm-args.js
Normal file
18
antd-tools/utils/get-npm-args.js
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
// NOTE: the following code was partially adopted from https://github.com/iarna/in-publish
|
||||
module.exports = function getNpmArgs () {
|
||||
let npmArgv = null
|
||||
|
||||
try {
|
||||
npmArgv = JSON.parse(process.env.npm_config_argv)
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (typeof npmArgv !== 'object' || !npmArgv.cooked || !Array.isArray(npmArgv.cooked)) {
|
||||
return null
|
||||
}
|
||||
|
||||
return npmArgv.cooked
|
||||
}
|
23
antd-tools/utils/getChangelog.js
Normal file
23
antd-tools/utils/getChangelog.js
Normal file
@ -0,0 +1,23 @@
|
||||
const fs = require('fs')
|
||||
|
||||
module.exports = function getChangelog (file, version) {
|
||||
const lines = fs.readFileSync(file).toString().split('\n')
|
||||
const changeLog = []
|
||||
const startPattern = new RegExp(`^## ${version}`)
|
||||
const stopPattern = /^## / // 前一个版本
|
||||
const skipPattern = /^`/ // 日期
|
||||
let begin = false
|
||||
for (let i = 0; i < lines.length; i += 1) {
|
||||
const line = lines[i]
|
||||
if (begin && stopPattern.test(line)) {
|
||||
break
|
||||
}
|
||||
if (begin && line && !skipPattern.test(line)) {
|
||||
changeLog.push(line)
|
||||
}
|
||||
if (!begin) {
|
||||
begin = startPattern.test(line)
|
||||
}
|
||||
}
|
||||
return changeLog.join('\n')
|
||||
}
|
14
antd-tools/utils/getRunCmdEnv.js
Normal file
14
antd-tools/utils/getRunCmdEnv.js
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
|
||||
module.exports = function getRunCmdEnv () {
|
||||
const env = {}
|
||||
Object.keys(process.env).forEach((key) => {
|
||||
env[key] = process.env[key]
|
||||
})
|
||||
// make sure `antd-tools/node_modules/.bin` in the PATH env
|
||||
const nodeModulesBinDir = path.join(__dirname, '../../node_modules/.bin')
|
||||
env.PATH = env.PATH ? `${nodeModulesBinDir}:${env.PATH}` : nodeModulesBinDir
|
||||
return env
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { Tabs } from 'antd'
|
||||
import Tabs from '../tabs'
|
||||
import PropTypes from '../_util/vue-types'
|
||||
import addEventListener from '../_util/Dom/addEventListener'
|
||||
import { getComponentFromProp, getComponentName } from '../_util/props-util'
|
||||
|
@ -1,3 +1,4 @@
|
||||
import './style.js'
|
||||
import Button from './button'
|
||||
const ButtonGroup = Button.Group
|
||||
export { Button, ButtonGroup }
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'antd/style.js'
|
||||
import './index.less'
|
||||
import 'highlight.js/styles/solarized-light.css'
|
||||
import Vue from 'vue'
|
||||
|
11
index-with-locales.js
Normal file
11
index-with-locales.js
Normal file
@ -0,0 +1,11 @@
|
||||
const antd = require('./components')
|
||||
const req = require.context('./components', true, /^\.\/locale-provider\/.+_.+\.js$/)
|
||||
|
||||
antd.locales = {}
|
||||
|
||||
req.keys().forEach((mod) => {
|
||||
const match = mod.match(/\/([^/]+).js$/)
|
||||
antd.locales[match[1]] = req(mod).default
|
||||
})
|
||||
|
||||
module.exports = antd
|
5840
package-lock.json
generated
5840
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
53
package.json
53
package.json
@ -1,12 +1,30 @@
|
||||
{
|
||||
"name": "vue-ant-design",
|
||||
"version": "1.0.0",
|
||||
"description": "vue component",
|
||||
"main": "index.js",
|
||||
"version": "0.1.0",
|
||||
"title": "Ant Design Vue",
|
||||
"description": "An enterprise-class UI design language and Vue-based implementation",
|
||||
"keywords": [
|
||||
"ant",
|
||||
"design",
|
||||
"antd",
|
||||
"vue",
|
||||
"vueComponent",
|
||||
"component",
|
||||
"components",
|
||||
"ui",
|
||||
"framework",
|
||||
"frontend"
|
||||
],
|
||||
"main": "dist/antd.min.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"components"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=development ./node_modules/.bin/webpack-dev-server --open --hot",
|
||||
"test": "karma start test/karma.conf.js --single-run",
|
||||
"build": "sh build.sh",
|
||||
"dist": "node antd-tools/cli/run.js dist",
|
||||
"lint": "eslint -c ./.eslintrc --fix --ext .js ./components/time-picker/locale",
|
||||
"lint:style": "stylelint \"./examples/**/*.less\" --fix --syntax less"
|
||||
},
|
||||
@ -14,24 +32,27 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vueComponent/ant-design.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vueComponent/ant-design/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vueComponent/ant-design#readme",
|
||||
"homepage": "https://github.com/vueComponent/ant-design",
|
||||
"pre-commit": [
|
||||
"lint",
|
||||
"lint:style"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0-beta.42",
|
||||
"@babel/preset-env": "^7.0.0-beta.42",
|
||||
"autoprefixer": "^8.1.0",
|
||||
"babel": "^6.23.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-eslint": "^8.0.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-import": "^1.6.7",
|
||||
"babel-plugin-istanbul": "^4.1.1",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
@ -41,14 +62,21 @@
|
||||
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"case-sensitive-paths-webpack-plugin": "^2.1.2",
|
||||
"chai": "^4.1.2",
|
||||
"chalk": "^2.3.2",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"colorful": "^2.1.0",
|
||||
"commander": "^2.15.0",
|
||||
"css-loader": "^0.28.7",
|
||||
"deep-assign": "^2.0.0",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-plugin-html": "^3.2.2",
|
||||
"eslint-plugin-vue-libs": "^1.2.1",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^8.0.0-beta.2",
|
||||
"highlight.js": "^9.12.0",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"istanbul-instrumenter-loader": "^3.0.0",
|
||||
@ -65,11 +93,17 @@
|
||||
"karma-webpack": "^2.0.2",
|
||||
"less": "^2.7.2",
|
||||
"less-loader": "^4.0.5",
|
||||
"less-plugin-npm-import": "^2.1.0",
|
||||
"markdown-it": "^8.4.0",
|
||||
"marked": "^0.3.7",
|
||||
"merge2": "^1.2.1",
|
||||
"mocha": "^3.2.0",
|
||||
"postcss": "^6.0.20",
|
||||
"postcss-loader": "^2.1.2",
|
||||
"pre-commit": "^1.2.2",
|
||||
"querystring": "^0.2.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"rucksack-css": "^1.0.2",
|
||||
"selenium-server": "^3.0.1",
|
||||
"semver": "^5.3.0",
|
||||
"sinon": "^4.0.2",
|
||||
@ -77,6 +111,7 @@
|
||||
"style-loader": "^0.18.2",
|
||||
"stylelint": "^8.1.1",
|
||||
"stylelint-config-standard": "^17.0.0",
|
||||
"through2": "^2.0.3",
|
||||
"vue-antd-md-loader": "^1.0.2",
|
||||
"vue-loader": "^13.0.5",
|
||||
"vue-router": "^3.0.1",
|
||||
@ -109,4 +144,4 @@
|
||||
"vue-types": "^1.0.2",
|
||||
"warning": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
5
postcss.config.js
Normal file
5
postcss.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer'),
|
||||
],
|
||||
}
|
40
webpack.build.config.js
Normal file
40
webpack.build.config.js
Normal file
@ -0,0 +1,40 @@
|
||||
// This config is for building dist files
|
||||
const webpack = require('webpack')
|
||||
const getWebpackConfig = require('./antd-tools/getWebpackConfig')
|
||||
|
||||
// noParse still leave `require('./locale' + name)` in dist files
|
||||
// ignore is better
|
||||
// http://stackoverflow.com/q/25384360
|
||||
function ignoreMomentLocale (webpackConfig) {
|
||||
delete webpackConfig.module.noParse
|
||||
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
||||
}
|
||||
|
||||
function addLocales (webpackConfig) {
|
||||
let packageName = 'antd-with-locales'
|
||||
if (webpackConfig.entry['antd.min']) {
|
||||
packageName += '.min'
|
||||
}
|
||||
webpackConfig.entry[packageName] = './index-with-locales.js'
|
||||
webpackConfig.output.filename = '[name].js'
|
||||
}
|
||||
|
||||
function externalMoment (config) {
|
||||
config.externals.moment = {
|
||||
root: 'moment',
|
||||
commonjs2: 'moment',
|
||||
commonjs: 'moment',
|
||||
amd: 'moment',
|
||||
}
|
||||
}
|
||||
|
||||
const webpackConfig = getWebpackConfig(false)
|
||||
if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||
webpackConfig.forEach((config) => {
|
||||
ignoreMomentLocale(config)
|
||||
externalMoment(config)
|
||||
addLocales(config)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
@ -28,6 +28,9 @@ module.exports = merge(baseWebpackConfig, {
|
||||
{
|
||||
loader: 'css-loader',
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
},
|
||||
{ loader: 'less-loader',
|
||||
},
|
||||
],
|
||||
@ -41,6 +44,9 @@ module.exports = merge(baseWebpackConfig, {
|
||||
{
|
||||
loader: 'css-loader',
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user