ytg7vue 1.16.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +17 -0
- package/.editorconfig +14 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +151 -0
- package/.npminstall.done +1 -0
- package/.postcssrc.js +8 -0
- package/LICENSE +21 -0
- package/Listening +28 -0
- package/README.md +146 -0
- package/build/build.js +70 -0
- package/build/check-versions.js +45 -0
- package/build/config.js +81 -0
- package/build/dev-client.js +9 -0
- package/build/dev-server.js +93 -0
- package/build/utils.js +78 -0
- package/build/vue-loader.conf.js +12 -0
- package/build/webpack.common.js +37 -0
- package/build/webpack.component.js +36 -0
- package/build/webpack.prod.conf.js +38 -0
- package/components.json +8 -0
- package/conf.js +42 -0
- package/config/dev.env.js +6 -0
- package/config/index.js +43 -0
- package/config/prod.env.js +6 -0
- package/config/sit.env.js +6 -0
- package/favicon.ico +0 -0
- package/index.html +17 -0
- package/jsdoc-vue.js +12 -0
- package/lib/idev.common.js +1 -0
- package/lib/index.js +46869 -0
- package/lib/js/HdBtn.js +1 -0
- package/lib/js/HdComGrid.js +1 -0
- package/lib/js/HdGrid.js +1 -0
- package/lib/js/HdHotkey.js +1 -0
- package/lib/js/HdTableColumn.js +1 -0
- package/lib/js/HdTreeTable.js +1 -0
- package/package.json +115 -0
package/.babelrc
ADDED
package/.editorconfig
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# http://editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
charset = utf-8
|
6
|
+
indent_style = space
|
7
|
+
indent_size = 2
|
8
|
+
end_of_line = lf
|
9
|
+
insert_final_newline = true
|
10
|
+
trim_trailing_whitespace = true
|
11
|
+
|
12
|
+
[*.md]
|
13
|
+
insert_final_newline = false
|
14
|
+
trim_trailing_whitespace = false
|
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
module.exports = {
|
2
|
+
root: true,
|
3
|
+
parserOptions: {
|
4
|
+
"parser": "babel-eslint",
|
5
|
+
"ecmaVersion": 2017,
|
6
|
+
"sourceType": "module"
|
7
|
+
},
|
8
|
+
parserOptions: {
|
9
|
+
sourceType: 'module'
|
10
|
+
},
|
11
|
+
env: {
|
12
|
+
browser: true,
|
13
|
+
node: true,
|
14
|
+
es6: true,
|
15
|
+
},
|
16
|
+
extends: [
|
17
|
+
// add more generic rulesets here, such as:
|
18
|
+
// 'eslint:recommended',
|
19
|
+
'plugin:vue/base'
|
20
|
+
],
|
21
|
+
// required to lint *.vue files
|
22
|
+
plugins: [
|
23
|
+
"vue"
|
24
|
+
],
|
25
|
+
// check if imports actually resolve
|
26
|
+
'settings': {
|
27
|
+
'import/resolver': {
|
28
|
+
'webpack': {
|
29
|
+
'config': 'build/webpack.base.conf.js'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
},
|
33
|
+
// add your custom rules here
|
34
|
+
//it is base on https://github.com/vuejs/eslint-config-vue
|
35
|
+
'rules': {
|
36
|
+
'accessor-pairs': 2,
|
37
|
+
'arrow-spacing': [2, {'before': true, 'after': true}],
|
38
|
+
'block-spacing': [2, 'always'],
|
39
|
+
'brace-style': [2, '1tbs', {'allowSingleLine': true}],
|
40
|
+
'camelcase': [0, {'properties': 'always'}],
|
41
|
+
'comma-dangle': [2, 'never'],
|
42
|
+
'comma-spacing': [2, {'before': false, 'after': true}],
|
43
|
+
'comma-style': [2, 'last'],
|
44
|
+
'constructor-super': 2,
|
45
|
+
'curly': [2, 'multi-line'],
|
46
|
+
'dot-location': [2, 'property'],
|
47
|
+
'eol-last': 2,
|
48
|
+
'generator-star-spacing': [2, {'before': true, 'after': true}],
|
49
|
+
'handle-callback-err': [2, '^(err|error)$'],
|
50
|
+
'indent': [2, 2, {'SwitchCase': 1}],
|
51
|
+
'jsx-quotes': [2, 'prefer-single'],
|
52
|
+
'key-spacing': [2, {'beforeColon': false, 'afterColon': true}],
|
53
|
+
'keyword-spacing': [2, {'before': true, 'after': true}],
|
54
|
+
'new-cap': [2, {'newIsCap': true, 'capIsNew': false}],
|
55
|
+
'new-parens': 2,
|
56
|
+
'no-array-constructor': 2,
|
57
|
+
'no-caller': 2,
|
58
|
+
'no-console': 'off',
|
59
|
+
'no-class-assign': 2,
|
60
|
+
'no-cond-assign': 2,
|
61
|
+
'no-const-assign': 2,
|
62
|
+
'no-control-regex': 0,
|
63
|
+
'no-delete-var': 2,
|
64
|
+
'no-dupe-args': 2,
|
65
|
+
'no-dupe-class-members': 2,
|
66
|
+
'no-dupe-keys': 2,
|
67
|
+
'no-duplicate-case': 2,
|
68
|
+
'no-empty-character-class': 2,
|
69
|
+
'no-empty-pattern': 2,
|
70
|
+
'no-eval': 2,
|
71
|
+
'no-ex-assign': 2,
|
72
|
+
'no-extend-native': 2,
|
73
|
+
'no-extra-bind': 2,
|
74
|
+
'no-extra-boolean-cast': 2,
|
75
|
+
'no-extra-parens': [2, 'functions'],
|
76
|
+
'no-fallthrough': 2,
|
77
|
+
'no-floating-decimal': 2,
|
78
|
+
'no-func-assign': 2,
|
79
|
+
'no-implied-eval': 2,
|
80
|
+
'no-inner-declarations': [2, 'functions'],
|
81
|
+
'no-invalid-regexp': 2,
|
82
|
+
'no-irregular-whitespace': 2,
|
83
|
+
'no-iterator': 2,
|
84
|
+
'no-label-var': 2,
|
85
|
+
'no-labels': [2, {'allowLoop': false, 'allowSwitch': false}],
|
86
|
+
'no-lone-blocks': 2,
|
87
|
+
'no-mixed-spaces-and-tabs': 2,
|
88
|
+
'no-multi-spaces': 2,
|
89
|
+
'no-multi-str': 2,
|
90
|
+
'no-multiple-empty-lines': [2, {'max': 1}],
|
91
|
+
'no-native-reassign': 2,
|
92
|
+
'no-negated-in-lhs': 2,
|
93
|
+
'no-new-object': 2,
|
94
|
+
'no-new-require': 2,
|
95
|
+
'no-new-symbol': 2,
|
96
|
+
'no-new-wrappers': 2,
|
97
|
+
'no-obj-calls': 2,
|
98
|
+
'no-octal': 2,
|
99
|
+
'no-octal-escape': 2,
|
100
|
+
'no-path-concat': 2,
|
101
|
+
'no-proto': 2,
|
102
|
+
'no-redeclare': 2,
|
103
|
+
'no-regex-spaces': 2,
|
104
|
+
'no-return-assign': [2, 'except-parens'],
|
105
|
+
'no-self-assign': 2,
|
106
|
+
'no-self-compare': 2,
|
107
|
+
'no-sequences': 2,
|
108
|
+
'no-shadow-restricted-names': 2,
|
109
|
+
'no-spaced-func': 2,
|
110
|
+
'no-sparse-arrays': 2,
|
111
|
+
'no-this-before-super': 2,
|
112
|
+
'no-throw-literal': 2,
|
113
|
+
'no-trailing-spaces': 2,
|
114
|
+
'no-undef': 0,
|
115
|
+
'no-undef-init': 2,
|
116
|
+
'no-unexpected-multiline': 2,
|
117
|
+
'no-unmodified-loop-condition': 2,
|
118
|
+
'no-unneeded-ternary': [2, {'defaultAssignment': false}],
|
119
|
+
'no-unreachable': 2,
|
120
|
+
'no-unsafe-finally': 2,
|
121
|
+
'no-unused-vars': [2, {'vars': 'all', 'args': 'none'}],
|
122
|
+
'no-useless-call': 2,
|
123
|
+
'no-useless-computed-key': 2,
|
124
|
+
'no-useless-constructor': 2,
|
125
|
+
'no-useless-escape': 0,
|
126
|
+
'no-whitespace-before-property': 2,
|
127
|
+
'no-with': 2,
|
128
|
+
'one-var': [2, {'initialized': 'never'}],
|
129
|
+
'operator-linebreak': [2, 'after', {'overrides': {'?': 'before', ':': 'before'}}],
|
130
|
+
'padded-blocks': [2, 'never'],
|
131
|
+
'quotes': [2, 'single', {'avoidEscape': true, 'allowTemplateLiterals': true}],
|
132
|
+
'semi': [2, 'never'],
|
133
|
+
'semi-spacing': [2, {'before': false, 'after': true}],
|
134
|
+
'space-before-blocks': [2, 'always'],
|
135
|
+
'space-before-function-paren': [2, 'never'],
|
136
|
+
'space-in-parens': [2, 'never'],
|
137
|
+
'space-infix-ops': 2,
|
138
|
+
'space-unary-ops': [2, {'words': true, 'nonwords': false}],
|
139
|
+
'spaced-comment': [2, 'always', {'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']}],
|
140
|
+
'template-curly-spacing': [2, 'never'],
|
141
|
+
'use-isnan': 2,
|
142
|
+
'valid-typeof': 2,
|
143
|
+
'wrap-iife': [2, 'any'],
|
144
|
+
'yield-star-spacing': [2, 'both'],
|
145
|
+
'yoda': [2, 'never'],
|
146
|
+
'prefer-const': 2,
|
147
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
148
|
+
'object-curly-spacing': [2, 'always', {objectsInObjects: false}],
|
149
|
+
'array-bracket-spacing': [2, 'never']
|
150
|
+
}
|
151
|
+
}
|
package/.npminstall.done
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri Apr 13 2018 19:15:48 GMT+0800 (中国标准时间)
|
package/.postcssrc.js
ADDED
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 PanJiaChen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/Listening
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
�������
|
2
|
+
|
3
|
+
AT ��������ض����ں�ʱ����������ͳ���
|
4
|
+
Ҫʹ�� AT ����ƻ�����������������С�
|
5
|
+
|
6
|
+
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
|
7
|
+
AT [\\computername] time [/INTERACTIVE]
|
8
|
+
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"
|
9
|
+
|
10
|
+
\\computername ָ��Զ�̼���������ʡ�����������
|
11
|
+
��ƻ��ڱ��ؼ�������������
|
12
|
+
id ָ�����Ѽƻ������ʶ��š�
|
13
|
+
/delete ɾ��ij���Ѽƻ���������ʡ�� id��
|
14
|
+
������������Ѽƻ�������ᱻɾ����
|
15
|
+
/yes ����Ҫ��һ��ȷ��ʱ����ɾ��������ҵ
|
16
|
+
������һ��ʹ�á�
|
17
|
+
time ָ�����������ʱ�䡣
|
18
|
+
/interactive ������ҵ������ʱ���뵱ʱ��¼���û�
|
19
|
+
����������
|
20
|
+
/every:date[,...] ָ����ÿ�ܻ�ÿ�µ��ض������������
|
21
|
+
���ʡ�����ڣ���Ĭ��Ϊ��ÿ�µ�
|
22
|
+
��������
|
23
|
+
/next:date[,...] ָ������һ��ָ������(�磬������)��
|
24
|
+
��������ʡ�����ڣ���Ĭ��Ϊ��ÿ
|
25
|
+
�µı������С�
|
26
|
+
"command" �����е� Windows NT �����������
|
27
|
+
����
|
28
|
+
|
package/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
## 基础命令
|
2
|
+
|
3
|
+
npm install --registry=https://registry.npm.taobao.org
|
4
|
+
|
5
|
+
npm run build:prod 打包
|
6
|
+
|
7
|
+
npm publish 发布
|
8
|
+
|
9
|
+
## 版本发布
|
10
|
+
|
11
|
+
1.0.0 初始化项目并测试
|
12
|
+
|
13
|
+
1.0.1 项目搭建完成
|
14
|
+
|
15
|
+
- Grid双击可以直接编辑。
|
16
|
+
- Grid翻页位置增加按钮“增加、删除”,并且可以控制按钮是否可用。
|
17
|
+
|
18
|
+
- Grid默认分页行数改成100。
|
19
|
+
|
20
|
+
1.0.3 双击编辑可控制
|
21
|
+
|
22
|
+
is-not-db-edit 关闭双击编辑功能
|
23
|
+
|
24
|
+
:hd-btn-tool=false 隐藏列表底部按钮工具栏
|
25
|
+
|
26
|
+
1.0.4 添加单证上传 和 单证查看
|
27
|
+
示例代码如下
|
28
|
+
<el-button class="filter-item" @click="billUpload" type="primary">单证上传
|
29
|
+
</el-button>
|
30
|
+
<el-button class="filter-item" @click="billShow" type="primary">单证查看
|
31
|
+
</el-button>
|
32
|
+
|
33
|
+
<bill-upload ref="billUpload"></bill-upload>
|
34
|
+
<bill-show ref="billShow"></bill-show>
|
35
|
+
|
36
|
+
billUpload() {
|
37
|
+
this.$refs.billUpload.show(this.billTyp, this.billId);
|
38
|
+
},
|
39
|
+
billShow() {
|
40
|
+
this.$refs.billShow.show(this.billTyp, this.billId);
|
41
|
+
}
|
42
|
+
1.0.5 修复hd-grid事件不能传到el-table bug
|
43
|
+
|
44
|
+
1.0.6 hdbutton按钮样式自动变化
|
45
|
+
|
46
|
+
1.0.7 hdbutton添加默认样式
|
47
|
+
|
48
|
+
复制,取消选择。
|
49
|
+
|
50
|
+
复制删除bug
|
51
|
+
|
52
|
+
1.0.8 按钮支持自定义样式 custome-class="class"
|
53
|
+
|
54
|
+
上传组件样式修改
|
55
|
+
|
56
|
+
增加HdFilterBox组件,封装查询样式
|
57
|
+
|
58
|
+
按钮展现分成3部分示例用法如下:
|
59
|
+
|
60
|
+
|
61
|
+
<div class="filter-container" slot="query">
|
62
|
+
<hd-filter-box>
|
63
|
+
<template>
|
64
|
+
<el-input @keyup.enter.native="$refs.grid.doQuery()" style="width: 200px;" class="filter-item"
|
65
|
+
placeholder="名称"
|
66
|
+
v-model="hdQuery.query.anyQuery">
|
67
|
+
</el-input>
|
68
|
+
</template>
|
69
|
+
<template slot="searchBtn">
|
70
|
+
<el-button class="filter-item bn-del" @click="$refs.grid.doQuery()" icon="search" type="primary" ref="q"
|
71
|
+
keyType="query">搜索
|
72
|
+
</el-button>
|
73
|
+
</template>
|
74
|
+
<template slot="otherBtn">
|
75
|
+
<el-button class="filter-item" @click="$refs.grid.doRemoveAll()" type="danger" keyType="del">删除
|
76
|
+
</el-button>
|
77
|
+
</template>
|
78
|
+
</hd-filter-box>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
|
82
|
+
1.8.6 优化hd-filter-box,查询宽度智能变化,下拉按钮自动隐藏
|
83
|
+
|
84
|
+
1.9.0 el-table-column 支持展示html 添加参数is-html
|
85
|
+
|
86
|
+
1.10.1 el-table-column 宽度自动撑开
|
87
|
+
|
88
|
+
1.10.2 修复按钮隐藏导致分页不显示bug
|
89
|
+
|
90
|
+
1.10.3 下拉统一去掉双击编辑和底部按钮
|
91
|
+
|
92
|
+
1.12.1 sortable="xxx" 安照xxx进行排序,排序不走后台
|
93
|
+
|
94
|
+
<el-table-column width="120px" align="left" label="船名" prop="shipNam" sortable="shipNam">
|
95
|
+
</el-table-column>
|
96
|
+
<el-table-column width="100px" align="left" label="MMSI号" prop="sdataId"
|
97
|
+
:inputFormat="(result, row)=>row.mmsi" sortable="mmsi">
|
98
|
+
</el-table-column>
|
99
|
+
|
100
|
+
1.12.2 单证上传必选billTyp,参数billTyp变成默认值可不填
|
101
|
+
|
102
|
+
1.13.0 hdcomgrid @row-dblclick 可以直接自定义双击方法
|
103
|
+
|
104
|
+
1.14.0 修复hdform上一页 上一条 下一页 下一条
|
105
|
+
|
106
|
+
1.14.2 hd-form 未绑定grid报错bug修改
|
107
|
+
|
108
|
+
1.14.3 hd-com-grid 统一关闭复制按钮
|
109
|
+
|
110
|
+
1.14.5 支持自定义底部按钮
|
111
|
+
|
112
|
+
<template slot="btnTool">
|
113
|
+
<hd-btn icon="el-icon-plus" hint="增加" @click="$refs.grid.doEdit('')" class="hdBtnTool"
|
114
|
+
keyType="add">
|
115
|
+
</hd-btn>
|
116
|
+
<hd-btn icon="el-icon-minus" hint="删除" @click="$refs.grid.doRemove()" class="hdBtnTool"
|
117
|
+
keyType="del">
|
118
|
+
</hd-btn>
|
119
|
+
<hd-btn icon="el-icon-check" hint="保存" @click="$refs.grid.doSave()" class="hdBtnTool"
|
120
|
+
keyType="save">
|
121
|
+
</hd-btn>
|
122
|
+
</template>
|
123
|
+
|
124
|
+
|
125
|
+
addWay addHide delHide 等后期可能会移除
|
126
|
+
|
127
|
+
新增了hd-form自定义处理表单展现方法
|
128
|
+
|
129
|
+
<hd-form :customeChooseUpdateFn="customeChooseUpdateFn">
|
130
|
+
customeChooseUpdateFn(row) {
|
131
|
+
this.hdform = Object.assign({}, row, {'tempOrgnId': row.orgnId, '_oldRow': row});
|
132
|
+
},
|
133
|
+
|
134
|
+
hd-form添加数据默认添加到grid的的第一条
|
135
|
+
|
136
|
+
1.15.1 修复文件上传组件
|
137
|
+
|
138
|
+
1.15.3 新增滚动到最上面
|
139
|
+
|
140
|
+
没掉框架doEdit方法的用`this.$refs.grid.$refs.hdgrid.$refs.ingrid.$refs.bodyWrapper.scrollTop = 0`实现
|
141
|
+
|
142
|
+
1.15.4 表格中0默认不显示
|
143
|
+
|
144
|
+
`<el-table-column>` 里面添加属性 `noZeroHide` 来取消0不显示
|
145
|
+
1.15.10 高级查询可隐藏
|
146
|
+
noAdQuery
|
package/build/build.js
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require('./check-versions')();
|
2
|
+
var server = require('pushstate-server');
|
3
|
+
var opn = require('opn')
|
4
|
+
var ora = require('ora')
|
5
|
+
var rm = require('rimraf')
|
6
|
+
var path = require('path')
|
7
|
+
var chalk = require('chalk')
|
8
|
+
var webpack = require('webpack');
|
9
|
+
var config = require('../config');
|
10
|
+
var webpackConfig = require('./webpack.prod.conf');
|
11
|
+
var componentConfig = require('./webpack.component');
|
12
|
+
var commonConfig = require('./webpack.common');
|
13
|
+
|
14
|
+
var spinner = ora('building for ' + process.env.NODE_ENV + ' of ' + process.env.env_config+ ' mode...' )
|
15
|
+
spinner.start()
|
16
|
+
|
17
|
+
|
18
|
+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
19
|
+
if (err) throw err
|
20
|
+
webpack(webpackConfig, function (err, stats) {
|
21
|
+
if (err) throw err
|
22
|
+
process.stdout.write(stats.toString({
|
23
|
+
colors: true,
|
24
|
+
modules: false,
|
25
|
+
children: false,
|
26
|
+
chunks: false,
|
27
|
+
chunkModules: false
|
28
|
+
}) + '\n\n')
|
29
|
+
console.log(chalk.cyan(' Build index complete.\n'))
|
30
|
+
if(process.env.npm_config_preview){
|
31
|
+
server.start({
|
32
|
+
port: 9528,
|
33
|
+
directory: './dist',
|
34
|
+
file: '/index.html'
|
35
|
+
});
|
36
|
+
console.log('> Listening at ' + 'http://localhost:9528' + '\n')
|
37
|
+
}
|
38
|
+
})
|
39
|
+
|
40
|
+
|
41
|
+
webpack(commonConfig, function (err, stats) {
|
42
|
+
if (err) throw err
|
43
|
+
process.stdout.write(stats.toString({
|
44
|
+
colors: true,
|
45
|
+
modules: false,
|
46
|
+
children: false,
|
47
|
+
chunks: false,
|
48
|
+
chunkModules: false
|
49
|
+
}) + '\n\n')
|
50
|
+
|
51
|
+
console.log(chalk.cyan(' Build common complete.\n'))
|
52
|
+
|
53
|
+
})
|
54
|
+
|
55
|
+
webpack(componentConfig, function (err, stats) {
|
56
|
+
if (err) throw err
|
57
|
+
process.stdout.write(stats.toString({
|
58
|
+
colors: true,
|
59
|
+
modules: false,
|
60
|
+
children: false,
|
61
|
+
chunks: false,
|
62
|
+
chunkModules: false
|
63
|
+
}) + '\n\n')
|
64
|
+
|
65
|
+
console.log(chalk.cyan(' Build component complete.\n'))
|
66
|
+
|
67
|
+
})
|
68
|
+
|
69
|
+
spinner.stop()
|
70
|
+
})
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var chalk = require('chalk')
|
2
|
+
var semver = require('semver')
|
3
|
+
var packageConfig = require('../package.json')
|
4
|
+
|
5
|
+
function exec(cmd) {
|
6
|
+
return require('child_process').execSync(cmd).toString().trim()
|
7
|
+
}
|
8
|
+
|
9
|
+
var versionRequirements = [
|
10
|
+
{
|
11
|
+
name: 'node',
|
12
|
+
currentVersion: semver.clean(process.version),
|
13
|
+
versionRequirement: packageConfig.engines.node
|
14
|
+
},
|
15
|
+
{
|
16
|
+
name: 'npm',
|
17
|
+
currentVersion: exec('npm --version'),
|
18
|
+
versionRequirement: packageConfig.engines.npm
|
19
|
+
}
|
20
|
+
]
|
21
|
+
|
22
|
+
module.exports = function () {
|
23
|
+
var warnings = []
|
24
|
+
for (var i = 0; i < versionRequirements.length; i++) {
|
25
|
+
var mod = versionRequirements[i]
|
26
|
+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
27
|
+
warnings.push(mod.name + ': ' +
|
28
|
+
chalk.red(mod.currentVersion) + ' should be ' +
|
29
|
+
chalk.green(mod.versionRequirement)
|
30
|
+
)
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
if (warnings.length) {
|
35
|
+
console.log('')
|
36
|
+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
37
|
+
console.log()
|
38
|
+
for (var i = 0; i < warnings.length; i++) {
|
39
|
+
var warning = warnings[i]
|
40
|
+
console.log(' ' + warning)
|
41
|
+
}
|
42
|
+
console.log()
|
43
|
+
process.exit(1)
|
44
|
+
}
|
45
|
+
}
|
package/build/config.js
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
var path = require('path');
|
2
|
+
var fs = require('fs');
|
3
|
+
var nodeExternals = require('webpack-node-externals');
|
4
|
+
var Components = require('../components.json');
|
5
|
+
|
6
|
+
// var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
|
7
|
+
// var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
|
8
|
+
// var transitionList = fs.readdirSync(path.resolve(__dirname, '../src/transitions'));
|
9
|
+
var externals = {};
|
10
|
+
|
11
|
+
Object.keys(Components).forEach(function(key) {
|
12
|
+
externals[`idevvue/${Components[key].substring(2)}`] = `idevvue/lib/${key}`;
|
13
|
+
});
|
14
|
+
|
15
|
+
//externals['element-ui/src/locale'] = 'element-ui/lib/locale';
|
16
|
+
// utilsList.forEach(function(file) {
|
17
|
+
// file = path.basename(file, '.js');
|
18
|
+
// externals[`element-ui/src/utils/${file}`] = `element-ui/lib/utils/${file}`;
|
19
|
+
// });
|
20
|
+
// mixinsList.forEach(function(file) {
|
21
|
+
// file = path.basename(file, '.js');
|
22
|
+
// externals[`element-ui/src/mixins/${file}`] = `element-ui/lib/mixins/${file}`;
|
23
|
+
// });
|
24
|
+
// transitionList.forEach(function(file) {
|
25
|
+
// file = path.basename(file, '.js');
|
26
|
+
// externals[`element-ui/src/transitions/${file}`] = `element-ui/lib/transitions/${file}`;
|
27
|
+
// });
|
28
|
+
|
29
|
+
externals = [Object.assign({
|
30
|
+
vue: 'vue'
|
31
|
+
}, externals), nodeExternals()];
|
32
|
+
console.log(externals);
|
33
|
+
exports.externals = externals;
|
34
|
+
|
35
|
+
exports.alias = {
|
36
|
+
'vue$': 'vue/dist/vue.esm.js',
|
37
|
+
'@': path.join(__dirname, '..', 'src'),
|
38
|
+
'src': path.resolve(__dirname, '../src'),
|
39
|
+
'assets': path.resolve(__dirname, '../src/assets'),
|
40
|
+
'components': path.resolve(__dirname, '../src/components'),
|
41
|
+
'views': path.resolve(__dirname, '../src/views'),
|
42
|
+
'styles': path.resolve(__dirname, '../src/styles'),
|
43
|
+
'api': path.resolve(__dirname, '../src/api'),
|
44
|
+
'utils': path.resolve(__dirname, '../src/utils'),
|
45
|
+
'store': path.resolve(__dirname, '../src/store'),
|
46
|
+
'router': path.resolve(__dirname, '../src/router'),
|
47
|
+
'mock': path.resolve(__dirname, '../src/mock'),
|
48
|
+
'vendor': path.resolve(__dirname, '../src/vendor'),
|
49
|
+
'static': path.resolve(__dirname, '../static')
|
50
|
+
};
|
51
|
+
|
52
|
+
exports.vue = {
|
53
|
+
root: 'Vue',
|
54
|
+
commonjs: 'vue',
|
55
|
+
commonjs2: 'vue',
|
56
|
+
amd: 'vue'
|
57
|
+
};
|
58
|
+
|
59
|
+
exports.loaders = [{
|
60
|
+
test: /\.vue$/,
|
61
|
+
loader: 'vue-loader',
|
62
|
+
}, {
|
63
|
+
test: /\.js$/,
|
64
|
+
loader: 'babel-loader?cacheDirectory',
|
65
|
+
exclude: /node_modules/
|
66
|
+
}, {
|
67
|
+
test: /\.css$/,
|
68
|
+
loader: 'style!css!autoprefixer'
|
69
|
+
}, {
|
70
|
+
test: /\.less$/,
|
71
|
+
loader: 'style!css!less'
|
72
|
+
}, {
|
73
|
+
test: /\.(wav|mp3|mp4)(\?.*)?$/,
|
74
|
+
loader: 'url-loader',
|
75
|
+
}, {
|
76
|
+
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
|
77
|
+
loader: 'url?limit=8192'
|
78
|
+
}, {
|
79
|
+
test: /\.(html|tpl)$/,
|
80
|
+
loader: 'vue-html'
|
81
|
+
}];
|