Skip to content

Commit 1268fe7

Browse files
author
leezng
authored
Merge pull request #73 from leezng/dev
release 1.6.5
2 parents 911370e + 8f1e422 commit 1268fe7

27 files changed

+3680
-2436
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
["env", {
44
"modules": false,
55
"targets": {
6-
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
6+
"browsers": ["> 1%", "last 5 versions", "not ie <= 10"]
77
}
88
}],
99
"stage-2"

.eslintrc.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
// http://eslint.org/docs/user-guide/configuring
22

33
module.exports = {
4-
root: true,
5-
parser: 'babel-eslint',
6-
parserOptions: {
7-
sourceType: 'module'
8-
},
9-
env: {
10-
browser: true,
11-
},
12-
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
13-
extends: 'standard',
14-
// required to lint *.vue files
15-
plugins: [
16-
'html'
4+
extends: [
5+
'plugin:vue/recommended'
176
],
187
// add your custom rules here
198
'rules': {
20-
// allow paren-less arrow functions
21-
'arrow-parens': 0,
22-
// allow async-await
23-
'generator-star-spacing': 0,
249
// allow debugger during development
2510
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
2611
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
| showSelectController | higher | whether to show the select controller at left | boolean | false |
6969
| selectOnClickNode | higher | whether to change selected value when click node | boolean | true |
7070
| highlightSelectedNode | higher | highlight current node when selected | boolean | true |
71-
| customValueFormatter | higher | a function that can return different html or strings to display for values in the data. If it returns null or empty, the default formatter is used | Function | false |
71+
| customValueFormatter | higher | a function that can return different html or strings to display for values in the data. | Function(data, key, parent, defaultFormatted) | - |
7272

7373
## Events
7474

README.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default {
6969
| showSelectController | 高级 | 是否展示选择控制器 | boolean | false |
7070
| selectOnClickNode | 高级 | 是否在点击节点的时候触发v-model双向绑定 | boolean | true |
7171
| highlightSelectedNode | 高级 | 是否高亮已选项 | boolean | true |
72+
| customValueFormatter | 高级 | 可以进行值的自定义渲染 | Function(data, key, parent, defaultFormatted) | - |
7273

7374
## Events
7475

build/build.js

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,29 @@ require('./check-versions')()
22

33
process.env.NODE_ENV = 'production'
44

5-
var ora = require('ora')
6-
var rm = require('rimraf')
7-
var path = require('path')
8-
var chalk = require('chalk')
9-
var webpack = require('webpack')
10-
var config = require('../config')
11-
var webpackConfig = require('./webpack.prod.conf')
5+
const path = require('path')
6+
const chalk = require('chalk')
7+
const webpack = require('webpack')
8+
const webpackConfig = require('./webpack.prod.conf')
129

13-
var spinner = ora('building for production...')
14-
spinner.start()
15-
16-
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
10+
webpack(webpackConfig, function (err, stats) {
1711
if (err) throw err
18-
webpack(webpackConfig, function (err, stats) {
19-
spinner.stop()
20-
if (err) throw err
21-
process.stdout.write(stats.toString({
22-
colors: true,
23-
modules: false,
24-
children: false,
25-
chunks: false,
26-
chunkModules: false
27-
}) + '\n\n')
12+
process.stdout.write(stats.toString({
13+
colors: true,
14+
modules: false,
15+
children: false,
16+
chunks: false,
17+
chunkModules: false
18+
}) + '\n\n')
2819

29-
if (stats.hasErrors()) {
30-
console.log(chalk.red(' Build failed with errors.\n'))
31-
process.exit(1)
32-
}
20+
if (stats.hasErrors()) {
21+
console.log(chalk.red(' Build failed with errors.\n'))
22+
process.exit(1)
23+
}
3324

34-
console.log(chalk.cyan(' Build complete.\n'))
35-
console.log(chalk.yellow(
36-
' Tip: built files are meant to be served over an HTTP server.\n' +
37-
' Opening index.html over file:// won\'t work.\n'
38-
))
39-
})
25+
console.log(chalk.cyan(' Build complete.\n'))
26+
console.log(chalk.yellow(
27+
' Tip: built files are meant to be served over an HTTP server.\n' +
28+
' Opening index.html over file:// won\'t work.\n'
29+
))
4030
})

build/check-versions.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
var chalk = require('chalk')
2-
var semver = require('semver')
3-
var packageConfig = require('../package.json')
4-
var shell = require('shelljs')
1+
const chalk = require('chalk')
2+
const semver = require('semver')
3+
const packageConfig = require('../package.json')
4+
const shell = require('shelljs')
55
function exec (cmd) {
66
return require('child_process').execSync(cmd).toString().trim()
77
}
88

9-
var versionRequirements = [
9+
const versionRequirements = [
1010
{
1111
name: 'node',
1212
currentVersion: semver.clean(process.version),
@@ -23,9 +23,9 @@ if (shell.which('npm')) {
2323
}
2424

2525
module.exports = function () {
26-
var warnings = []
27-
for (var i = 0; i < versionRequirements.length; i++) {
28-
var mod = versionRequirements[i]
26+
const warnings = []
27+
for (let i = 0; i < versionRequirements.length; i++) {
28+
const mod = versionRequirements[i]
2929
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
3030
warnings.push(mod.name + ': ' +
3131
chalk.red(mod.currentVersion) + ' should be ' +
@@ -38,8 +38,8 @@ module.exports = function () {
3838
console.log('')
3939
console.log(chalk.yellow('To use this template, you must update following to modules:'))
4040
console.log()
41-
for (var i = 0; i < warnings.length; i++) {
42-
var warning = warnings[i]
41+
for (let i = 0; i < warnings.length; i++) {
42+
const warning = warnings[i]
4343
console.log(' ' + warning)
4444
}
4545
console.log()

build/dev-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
22
require('eventsource-polyfill')
3-
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
3+
const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
44

55
hotClient.subscribe(function (event) {
66
if (event.action === 'reload') {

build/dev-server.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,49 @@
11
require('./check-versions')()
22

3-
var config = require('../config')
3+
const config = require('../config')
44
if (!process.env.NODE_ENV) {
55
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
66
}
77

8-
var opn = require('opn')
9-
var path = require('path')
10-
var express = require('express')
11-
var webpack = require('webpack')
12-
var proxyMiddleware = require('http-proxy-middleware')
13-
var webpackConfig = (process.env.NODE_ENV === 'testing' || process.env.NODE_ENV === 'production')
8+
const opn = require('opn')
9+
const path = require('path')
10+
const express = require('express')
11+
const webpack = require('webpack')
12+
const proxyMiddleware = require('http-proxy-middleware')
13+
const webpackConfig = (process.env.NODE_ENV === 'testing' || process.env.NODE_ENV === 'production')
1414
? require('./webpack.prod.conf')
1515
: require('./webpack.dev.conf')
1616

1717
// default port where dev server listens for incoming traffic
18-
var port = process.env.PORT || config.dev.port
18+
const port = process.env.PORT || config.dev.port
1919
// automatically open browser, if not set will be false
20-
var autoOpenBrowser = !!config.dev.autoOpenBrowser
20+
const autoOpenBrowser = !!config.dev.autoOpenBrowser
2121
// Define HTTP proxies to your custom API backend
2222
// https://github.com/chimurai/http-proxy-middleware
23-
var proxyTable = config.dev.proxyTable
23+
const proxyTable = config.dev.proxyTable
2424

25-
var app = express()
26-
var compiler = webpack(webpackConfig)
25+
const app = express()
26+
const compiler = webpack(webpackConfig)
2727

28-
var devMiddleware = require('webpack-dev-middleware')(compiler, {
28+
const devMiddleware = require('webpack-dev-middleware')(compiler, {
2929
publicPath: webpackConfig.output.publicPath,
3030
quiet: true
3131
})
3232

33-
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
33+
const hotMiddleware = require('webpack-hot-middleware')(compiler, {
3434
log: false,
3535
heartbeat: 2000
3636
})
3737
// force page reload when html-webpack-plugin template changes
38-
compiler.plugin('compilation', function (compilation) {
39-
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
40-
hotMiddleware.publish({ action: 'reload' })
41-
cb()
42-
})
43-
})
38+
compiler.hooks.compilation.tap('html-webpack-plugin-after-emit', () => {
39+
hotMiddleware.publish({
40+
action: 'reload'
41+
});
42+
});
4443

4544
// proxy api requests
4645
Object.keys(proxyTable).forEach(function (context) {
47-
var options = proxyTable[context]
46+
const options = proxyTable[context]
4847
if (typeof options === 'string') {
4948
options = { target: options }
5049
}
@@ -62,13 +61,13 @@ app.use(devMiddleware)
6261
app.use(hotMiddleware)
6362

6463
// serve pure static assets
65-
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
64+
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
6665
app.use(staticPath, express.static('./static'))
6766

68-
var uri = 'http://localhost:' + port
67+
const uri = 'http://localhost:' + port
6968

70-
var _resolve
71-
var readyPromise = new Promise(resolve => {
69+
let _resolve
70+
const readyPromise = new Promise(resolve => {
7271
_resolve = resolve
7372
})
7473

@@ -82,7 +81,7 @@ devMiddleware.waitUntilValid(() => {
8281
_resolve()
8382
})
8483

85-
var server = app.listen(port)
84+
const server = app.listen(port)
8685

8786
module.exports = {
8887
ready: readyPromise,

build/utils.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var path = require('path')
2-
var config = require('../config')
3-
var ExtractTextPlugin = require('extract-text-webpack-plugin')
1+
const path = require('path')
2+
const config = require('../config')
3+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
44

55
exports.assetsPath = function (_path) {
6-
var assetsSubDirectory = process.env.NODE_ENV === 'production'
6+
const assetsSubDirectory = process.env.NODE_ENV === 'production'
77
? config.build.assetsSubDirectory
88
: config.dev.assetsSubDirectory
99
return path.posix.join(assetsSubDirectory, _path)
@@ -12,7 +12,7 @@ exports.assetsPath = function (_path) {
1212
exports.cssLoaders = function (options) {
1313
options = options || {}
1414

15-
var cssLoader = {
15+
const cssLoader = {
1616
loader: 'css-loader',
1717
options: {
1818
minimize: process.env.NODE_ENV === 'production',
@@ -22,7 +22,7 @@ exports.cssLoaders = function (options) {
2222

2323
// generate loader string to be used with extract text plugin
2424
function generateLoaders (loader, loaderOptions) {
25-
var loaders = [cssLoader]
25+
const loaders = [cssLoader]
2626
if (loader) {
2727
loaders.push({
2828
loader: loader + '-loader',
@@ -35,10 +35,7 @@ exports.cssLoaders = function (options) {
3535
// Extract CSS when that option is specified
3636
// (which is the case during production build)
3737
if (options.extract && !!!process.env.DIST_ENV) {
38-
return ExtractTextPlugin.extract({
39-
use: loaders,
40-
fallback: 'vue-style-loader'
41-
})
38+
return ['vue-style-loader'].concat([MiniCssExtractPlugin.loader].concat(loaders))
4239
} else {
4340
return ['vue-style-loader'].concat(loaders)
4441
}
@@ -58,10 +55,10 @@ exports.cssLoaders = function (options) {
5855

5956
// Generate loaders for standalone style files (outside of .vue)
6057
exports.styleLoaders = function (options) {
61-
var output = []
62-
var loaders = exports.cssLoaders(options)
63-
for (var extension in loaders) {
64-
var loader = loaders[extension]
58+
const output = []
59+
const loaders = exports.cssLoaders(options)
60+
for (const extension in loaders) {
61+
const loader = loaders[extension]
6562
output.push({
6663
test: new RegExp('\\.' + extension + '$'),
6764
use: loader

build/vue-loader.conf.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var utils = require('./utils')
2-
var config = require('../config')
3-
var isProduction = process.env.NODE_ENV === 'production'
1+
const utils = require('./utils')
2+
const config = require('../config')
3+
const isProduction = process.env.NODE_ENV === 'production'
44

55
module.exports = {
66
loaders: utils.cssLoaders({

0 commit comments

Comments
 (0)