Skip to content

Commit 2bfaaa4

Browse files
committed
init project
1 parent 6d83abf commit 2bfaaa4

36 files changed

+1060
-39
lines changed

Diff for: .babelrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"presets": [
3+
["latest", {
4+
"es2015": { "modules": false }
5+
}],
6+
"stage-2"
7+
],
8+
"plugins": ["transform-runtime"],
9+
"comments": false,
10+
"env": {
11+
"test": {
12+
"presets": ["latest", "stage-2"],
13+
"plugins": [ "istanbul" ]
14+
}
15+
}
16+
}

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

Diff for: .eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/*.js
2+
config/*.js

Diff for: .eslintrc.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// http://eslint.org/docs/user-guide/configuring
2+
3+
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/feross/standard/blob/master/RULES.md#javascript-standard-style
13+
extends: 'standard',
14+
// required to lint *.vue files
15+
plugins: [
16+
'html'
17+
],
18+
// add your custom rules here
19+
'rules': {
20+
// allow paren-less arrow functions
21+
'arrow-parens': 0,
22+
// allow async-await
23+
'generator-star-spacing': 0,
24+
// allow debugger during development
25+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
26+
}
27+
}

Diff for: .gitignore

+10-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,10 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
6-
# Runtime data
7-
pids
8-
*.pid
9-
*.seed
10-
11-
# Directory for instrumented libs generated by jscoverage/JSCover
12-
lib-cov
13-
14-
# Coverage directory used by tools like istanbul
15-
coverage
16-
17-
# nyc test coverage
18-
.nyc_output
19-
20-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21-
.grunt
22-
23-
# node-waf configuration
24-
.lock-wscript
25-
26-
# Compiled binary addons (http://nodejs.org/api/addons.html)
27-
build/Release
28-
29-
# Dependency directories
30-
node_modules
31-
jspm_packages
32-
33-
# Optional npm cache directory
34-
.npm
35-
36-
# Optional REPL history
37-
.node_repl_history
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log
5+
yarn-error.log
6+
test/unit/coverage
7+
test/e2e/reports
8+
selenium-debug.log
9+
*.iml
10+
.idea/

Diff for: .postcssrc.js

+8
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 "browserlist" field in package.json
6+
"autoprefixer": {}
7+
}
8+
}

Diff for: README.md

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# vui
2-
Bootstrap components implemented by Vue
1+
# uiv
2+
3+
> Bootstrap components implemented by Vue
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
npm install
10+
11+
# serve with hot reload at localhost:8080
12+
npm run dev
13+
14+
# build for production with minification
15+
npm run build
16+
17+
# build for production and view the bundle analyzer report
18+
npm run build --report
19+
20+
# run unit tests
21+
npm run unit
22+
23+
# run e2e tests
24+
npm run e2e
25+
26+
# run all tests
27+
npm test
28+
```
29+
30+
For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

Diff for: build/build.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require('./check-versions')()
2+
3+
process.env.NODE_ENV = 'production'
4+
5+
const ora = require('ora')
6+
const rm = require('rimraf')
7+
const path = require('path')
8+
const chalk = require('chalk')
9+
const webpack = require('webpack')
10+
const config = require('../config')
11+
const webpackConfig = require('./webpack.prod.conf')
12+
13+
const spinner = ora('building for production...')
14+
spinner.start()
15+
16+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17+
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')
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+
})
35+
})

Diff for: build/check-versions.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const chalk = require('chalk')
2+
const semver = require('semver')
3+
const 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+
}

Diff for: build/dev-client.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
require('eventsource-polyfill')
3+
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4+
5+
hotClient.subscribe(function (event) {
6+
if (event.action === 'reload') {
7+
window.location.reload()
8+
}
9+
})

Diff for: build/dev-server.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
require('./check-versions')()
2+
3+
var config = require('../config')
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')
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'
14+
? require('./webpack.prod.conf')
15+
: require('./webpack.dev.conf')
16+
17+
// default port where dev server listens for incoming traffic
18+
var port = process.env.PORT || config.dev.port
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
23+
var proxyTable = config.dev.proxyTable
24+
25+
var app = express()
26+
var compiler = webpack(webpackConfig)
27+
28+
var devMiddleware = require('webpack-dev-middleware')(compiler, {
29+
publicPath: webpackConfig.output.publicPath,
30+
quiet: true
31+
})
32+
33+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
34+
log: () => {}
35+
})
36+
// force page reload when html-webpack-plugin template changes
37+
compiler.plugin('compilation', function (compilation) {
38+
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
39+
hotMiddleware.publish({ action: 'reload' })
40+
cb()
41+
})
42+
})
43+
44+
// proxy api requests
45+
Object.keys(proxyTable).forEach(function (context) {
46+
var options = proxyTable[context]
47+
if (typeof options === 'string') {
48+
options = { target: options }
49+
}
50+
app.use(proxyMiddleware(options.filter || context, options))
51+
})
52+
53+
// handle fallback for HTML5 history API
54+
app.use(require('connect-history-api-fallback')())
55+
56+
// serve webpack bundle output
57+
app.use(devMiddleware)
58+
59+
// enable hot-reload and state-preserving
60+
// compilation error display
61+
app.use(hotMiddleware)
62+
63+
// serve pure static assets
64+
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
65+
app.use(staticPath, express.static('./static'))
66+
67+
var uri = 'http://localhost:' + port
68+
69+
devMiddleware.waitUntilValid(function () {
70+
console.log('> Listening at ' + uri + '\n')
71+
})
72+
73+
module.exports = app.listen(port, function (err) {
74+
if (err) {
75+
console.log(err)
76+
return
77+
}
78+
79+
// when env is testing, don't need open it
80+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
81+
opn(uri)
82+
}
83+
})

Diff for: build/utils.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
var path = require('path')
2+
var config = require('../config')
3+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
4+
5+
exports.assetsPath = function (_path) {
6+
var assetsSubDirectory = process.env.NODE_ENV === 'production'
7+
? config.build.assetsSubDirectory
8+
: config.dev.assetsSubDirectory
9+
return path.posix.join(assetsSubDirectory, _path)
10+
}
11+
12+
exports.cssLoaders = function (options) {
13+
options = options || {}
14+
15+
var cssLoader = {
16+
loader: 'css-loader',
17+
options: {
18+
minimize: process.env.NODE_ENV === 'production',
19+
sourceMap: options.sourceMap
20+
}
21+
}
22+
23+
// generate loader string to be used with extract text plugin
24+
function generateLoaders (loader, loaderOptions) {
25+
var loaders = [cssLoader]
26+
if (loader) {
27+
loaders.push({
28+
loader: loader + '-loader',
29+
options: Object.assign({}, loaderOptions, {
30+
sourceMap: options.sourceMap
31+
})
32+
})
33+
}
34+
35+
// Extract CSS when that option is specified
36+
// (which is the case during production build)
37+
if (options.extract) {
38+
return ExtractTextPlugin.extract({
39+
use: loaders,
40+
fallback: 'vue-style-loader'
41+
})
42+
} else {
43+
return ['vue-style-loader'].concat(loaders)
44+
}
45+
}
46+
47+
// http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
48+
return {
49+
css: generateLoaders(),
50+
postcss: generateLoaders(),
51+
less: generateLoaders('less'),
52+
sass: generateLoaders('sass', { indentedSyntax: true }),
53+
scss: generateLoaders('sass'),
54+
stylus: generateLoaders('stylus'),
55+
styl: generateLoaders('stylus')
56+
}
57+
}
58+
59+
// Generate loaders for standalone style files (outside of .vue)
60+
exports.styleLoaders = function (options) {
61+
var output = []
62+
var loaders = exports.cssLoaders(options)
63+
for (var extension in loaders) {
64+
var loader = loaders[extension]
65+
output.push({
66+
test: new RegExp('\\.' + extension + '$'),
67+
use: loader
68+
})
69+
}
70+
return output
71+
}

0 commit comments

Comments
 (0)