Skip to content

Commit 602bb6d

Browse files
committed
Set initial props
1 parent 6941ec2 commit 602bb6d

39 files changed

+11119
-56
lines changed

.babelrc

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

.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

.eslintignore

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

.eslintrc.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
extends: 'airbnb-base',
13+
// required to lint *.vue files
14+
plugins: [
15+
'html'
16+
],
17+
// check if imports actually resolve
18+
'settings': {
19+
'import/resolver': {
20+
'webpack': {
21+
'config': 'build/webpack.base.conf.js'
22+
}
23+
}
24+
},
25+
// add your custom rules here
26+
'rules': {
27+
'no-console': 'off',
28+
'import/extensions': ['error', 'always', {
29+
'js': 'never',
30+
'vue': 'never'
31+
}],
32+
// allow optionalDependencies
33+
'import/no-extraneous-dependencies': ['error', {
34+
'optionalDependencies': ['test/unit/index.js']
35+
}],
36+
// allow debugger during development
37+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
38+
}
39+
}

.gitignore

+9-55
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,13 @@
1-
# Logs
2-
logs
3-
*.log
1+
.DS_Store
2+
node_modules/
43
npm-debug.log*
54
yarn-debug.log*
65
yarn-error.log*
76

8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (http://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# Typescript v1 declaration files
40-
typings/
41-
42-
# Optional npm cache directory
43-
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
53-
54-
# Yarn Integrity file
55-
.yarn-integrity
56-
57-
# dotenv environment variables file
58-
.env
59-
7+
# Editor directories and files
8+
.idea
9+
.vscode
10+
*.suo
11+
*.ntvs*
12+
*.njsproj
13+
*.sln

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

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
# vue-grid
2-
Vue implementation of Grid Layout
2+
3+
> Vue implementation of css grid layout
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+
21+
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).

build/build-lib.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+
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.lib.conf')
12+
13+
var spinner = ora('building for library...')
14+
spinner.start()
15+
16+
rm(path.join(config.lib.assetsRoot, config.lib.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: Now you are ready to publish your library to npm.\n' +
32+
' Then users can import it as an es6 module: import vueGrid from \'vue-grid\'\n'
33+
))
34+
})
35+
})

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+
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')
12+
13+
var 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+
})

build/check-versions.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var chalk = require('chalk')
2+
var semver = require('semver')
3+
var packageConfig = require('../package.json')
4+
var shell = require('shelljs')
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+
17+
if (shell.which('npm')) {
18+
versionRequirements.push({
19+
name: 'npm',
20+
currentVersion: exec('npm --version'),
21+
versionRequirement: packageConfig.engines.npm
22+
})
23+
}
24+
25+
module.exports = function () {
26+
var warnings = []
27+
for (var i = 0; i < versionRequirements.length; i++) {
28+
var mod = versionRequirements[i]
29+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30+
warnings.push(mod.name + ': ' +
31+
chalk.red(mod.currentVersion) + ' should be ' +
32+
chalk.green(mod.versionRequirement)
33+
)
34+
}
35+
}
36+
37+
if (warnings.length) {
38+
console.log('')
39+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
40+
console.log()
41+
for (var i = 0; i < warnings.length; i++) {
42+
var warning = warnings[i]
43+
console.log(' ' + warning)
44+
}
45+
console.log()
46+
process.exit(1)
47+
}
48+
}

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+
})

build/dev-server.js

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

0 commit comments

Comments
 (0)