Skip to content

Commit b8e5e8a

Browse files
committed
update to v1.1
1 parent 991bcc2 commit b8e5e8a

File tree

108 files changed

+8083
-3025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+8083
-3025
lines changed

.babelrc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
2-
"presets": ["es2015", "stage-2"],
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
9+
"stage-2"
10+
],
311
"plugins": ["transform-runtime"],
4-
"comments": false
12+
"env": {
13+
"test": {
14+
"presets": ["env", "stage-2"],
15+
"plugins": ["istanbul"]
16+
}
17+
}
518
}

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
**/libs/*.js
1+
build/*.js
2+
config/*.js
3+
src/assets/js/**/*.js

.eslintrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
// http://eslint.org/docs/user-guide/configuring
2+
13
module.exports = {
24
root: true,
35
parser: 'babel-eslint',
46
parserOptions: {
57
sourceType: 'module'
68
},
9+
env: {
10+
browser: true,
11+
},
712
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
813
extends: 'standard',
914
// required to lint *.vue files

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
.DS_Store
22
node_modules/
33
dist/
4-
npm-debug.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
57
test/unit/coverage
68
test/e2e/reports
79
selenium-debug.log
10+
11+
# Editor directories and files
12+
.idea
13+
*.suo
14+
*.ntvs*
15+
*.njsproj
16+
*.sln

.postcssrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// https://github.com/michael-ciniawsky/postcss-load-config
2+
3+
module.exports = {
4+
"plugins": {
5+
// to edit target browsers: use "browserslist" field in package.json
6+
"autoprefixer": {}
7+
}
8+
}

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* [Alert 组件](/src/components/Common/vAlert.vue)
1111
* [Modal 组件](/src/components/Common/vModal.vue)
1212
* [Table 组件](/src/components/Common/vTable.vue)
13-
* [easyTable 组件](/src/components/Common/vEasyTable.vue)
1413
* [Carousel 组件](/src/components/Common/vCarousel.vue)
1514
* [Loading 组件](/src/components/Common/vLoading.vue)
1615
* [Login 组件](/src/components/Common/vLogin.vue)
@@ -25,10 +24,10 @@
2524
###The initial access path:
2625
<ul>
2726
<li>OfficialDemo: http://localhost:9091/officialdemo.html</li>
28-
<li>TableHome: http://localhost:9091/tablehome.html</li>
29-
<li>PopupsHome: http://localhost:9091/popupshome.html</li>
30-
<li>CarouselHome: http://localhost:9091/carouselhome.html</li>
31-
<li>FormLogin: http://localhost:9091/formlogin.html</li>
27+
<li>TableDemo: http://localhost:9091/tabledemo.html</li>
28+
<li>PopupsDemo: http://localhost:9091/popupsdemo.html</li>
29+
<li>CarouselDemo: http://localhost:9091/carouseldemo.html</li>
30+
<li>FormLoginDemo: http://localhost:9091/formlogindemo.html</li>
3231
</ul>
3332

3433
you can click the nav '案例:Examples' and choice 'TableHome' to jump to another project 'tablehome.html'.
@@ -128,7 +127,7 @@ for (var pathname in pages) {
128127
module.exports.plugins.push(new HtmlWebpackPlugin(conf));
129128
}
130129
</code></pre>
131-
130+
132131
#### webpack.prod.conf.js 配置:
133132
<pre><code>
134133
function getEntry(globPath) {
@@ -164,6 +163,6 @@ for (var pathname in pages) {
164163
webpackConfig.plugins.push(new HtmlWebpackPlugin(conf));
165164
}
166165
</code></pre>
167-
168-
166+
167+
169168
Welcome guidance !!

build/build.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
// https://github.com/shelljs/shelljs
21
require('./check-versions')()
3-
require('shelljs/global')
4-
env.NODE_ENV = 'production'
52

6-
var path = require('path')
7-
var config = require('../config')
3+
process.env.NODE_ENV = 'production'
4+
85
var ora = require('ora')
6+
var rm = require('rimraf')
7+
var path = require('path')
8+
var chalk = require('chalk')
99
var webpack = require('webpack')
10+
var config = require('../config')
1011
var webpackConfig = require('./webpack.prod.conf')
1112

12-
console.log(
13-
' Tip:\n' +
14-
' Built files are meant to be served over an HTTP server.\n' +
15-
' Opening index.html over file:// won\'t work.\n'
16-
)
17-
1813
var spinner = ora('building for production...')
1914
spinner.start()
2015

21-
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22-
rm('-rf', assetsPath)
23-
mkdir('-p', assetsPath)
24-
cp('-R', 'static/*', assetsPath)
25-
26-
webpack(webpackConfig, function (err, stats) {
27-
spinner.stop()
16+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
2817
if (err) throw err
29-
process.stdout.write(stats.toString({
30-
colors: true,
31-
modules: false,
32-
children: false,
33-
chunks: false,
34-
chunkModules: false
35-
}) + '\n')
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')
28+
29+
console.log(chalk.cyan(' Build complete.\n'))
30+
console.log(chalk.yellow(
31+
' Tip: built files are meant to be served over an HTTP server.\n' +
32+
' Opening index.html over file:// won\'t work.\n'
33+
))
34+
})
3635
})

build/check-versions.js

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

99
var versionRequirements = [
@@ -12,12 +12,15 @@ var versionRequirements = [
1212
currentVersion: semver.clean(process.version),
1313
versionRequirement: packageConfig.engines.node
1414
},
15-
{
15+
]
16+
17+
if (shell.which('npm')) {
18+
versionRequirements.push({
1619
name: 'npm',
1720
currentVersion: exec('npm --version'),
1821
versionRequirement: packageConfig.engines.npm
19-
}
20-
]
22+
})
23+
}
2124

2225
module.exports = function () {
2326
var warnings = []

build/dev-server.js

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,54 @@
11
require('./check-versions')()
2+
23
var config = require('../config')
3-
if (!process.env.NODE_ENV) process.env.NODE_ENV = config.dev.env
4+
if (!process.env.NODE_ENV) {
5+
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6+
}
7+
8+
var opn = require('opn')
49
var path = require('path')
510
var express = require('express')
611
var webpack = require('webpack')
7-
var opn = require('opn')
812
var proxyMiddleware = require('http-proxy-middleware')
9-
var webpackConfig = process.env.NODE_ENV === 'testing'
10-
? require('./webpack.prod.conf')
11-
: require('./webpack.dev.conf')
13+
var webpackConfig = process.env.NODE_ENV === 'testing' ?
14+
require('./webpack.prod.conf') :
15+
require('./webpack.dev.conf')
1216

1317
// default port where dev server listens for incoming traffic
1418
var port = process.env.PORT || config.dev.port
15-
// Define HTTP proxies to your custom API backend
16-
// https://github.com/chimurai/http-proxy-middleware
19+
// automatically open browser, if not set will be false
20+
var autoOpenBrowser = !!config.dev.autoOpenBrowser
21+
// Define HTTP proxies to your custom API backend
22+
// https://github.com/chimurai/http-proxy-middleware
1723
var proxyTable = config.dev.proxyTable
1824

1925
var app = express()
2026
var compiler = webpack(webpackConfig)
2127

2228
var devMiddleware = require('webpack-dev-middleware')(compiler, {
23-
publicPath: webpackConfig.output.publicPath,
24-
stats: {
25-
colors: true,
26-
chunks: false
27-
}
29+
publicPath: webpackConfig.output.publicPath,
30+
quiet: true
2831
})
2932

30-
var hotMiddleware = require('webpack-hot-middleware')(compiler)
31-
// force page reload when html-webpack-plugin template changes
32-
compiler.plugin('compilation', function (compilation) {
33-
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
34-
hotMiddleware.publish({action: 'reload'})
35-
cb()
36-
})
33+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
34+
log: false,
35+
heartbeat: 2000
36+
})
37+
// 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+
})
3743
})
3844

3945
// proxy api requests
40-
Object.keys(proxyTable).forEach(function (context) {
41-
var options = proxyTable[context]
42-
if (typeof options === 'string') {
43-
options = {target: options}
44-
}
45-
app.use(proxyMiddleware(context, options))
46+
Object.keys(proxyTable).forEach(function(context) {
47+
var options = proxyTable[context]
48+
if (typeof options === 'string') {
49+
options = { target: options }
50+
}
51+
app.use(proxyMiddleware(options.filter || context, options))
4652
})
4753

4854
// handle fallback for HTML5 history API
@@ -59,16 +65,28 @@ app.use(hotMiddleware)
5965
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
6066
app.use(staticPath, express.static('./static'))
6167

62-
module.exports = app.listen(port, function (err) {
63-
if (err) {
64-
console.log(err)
65-
return
66-
}
67-
// var uri = 'http://localhost:' + port + '/officialdemo/app.html';
68-
// console.log('Listening at ' + uri + '\n')
69-
//
70-
// // when env is testing, don't need open it
71-
// if (process.env.NODE_ENV !== 'testing') {
72-
// opn(uri)
73-
// }
68+
var uri = 'http://localhost:' + port + '/officialdemo.html'
69+
70+
var _resolve
71+
var readyPromise = new Promise(resolve => {
72+
_resolve = resolve
7473
})
74+
75+
console.log('> Starting dev server...')
76+
devMiddleware.waitUntilValid(() => {
77+
console.log('> Listening at ' + uri + '\n')
78+
// when env is testing, don't need open it
79+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
80+
opn(uri)
81+
}
82+
_resolve()
83+
})
84+
85+
var server = app.listen(port)
86+
87+
module.exports = {
88+
ready: readyPromise,
89+
close: () => {
90+
server.close()
91+
}
92+
}

0 commit comments

Comments
 (0)