Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit 0b12e92

Browse files
committed
Initial
0 parents  commit 0b12e92

26 files changed

+860
-0
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

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// https://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/standard/standard/blob/master/docs/RULES-en.md
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+
}

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Editor directories and files
9+
.idea
10+
.vscode
11+
*.suo
12+
*.ntvs*
13+
*.njsproj
14+
*.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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# calendar
2+
3+
> A full calendar suite for VueJS
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 a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

build/build.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict'
2+
require('./check-versions')()
3+
4+
process.env.NODE_ENV = 'production'
5+
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const config = require('../config')
12+
const webpackConfig = require('./webpack.prod.conf')
13+
14+
const spinner = ora('building for production...')
15+
spinner.start()
16+
17+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18+
if (err) throw err
19+
webpack(webpackConfig, function (err, stats) {
20+
spinner.stop()
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+
30+
if (stats.hasErrors()) {
31+
console.log(chalk.red(' Build failed with errors.\n'))
32+
process.exit(1)
33+
}
34+
35+
console.log(chalk.cyan(' Build complete.\n'))
36+
console.log(chalk.yellow(
37+
' Tip: built files are meant to be served over an HTTP server.\n' +
38+
' Opening index.html over file:// won\'t work.\n'
39+
))
40+
})
41+
})

build/check-versions.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
6+
function exec (cmd) {
7+
return require('child_process').execSync(cmd).toString().trim()
8+
}
9+
10+
const versionRequirements = [
11+
{
12+
name: 'node',
13+
currentVersion: semver.clean(process.version),
14+
versionRequirement: packageConfig.engines.node
15+
}
16+
]
17+
18+
if (shell.which('npm')) {
19+
versionRequirements.push({
20+
name: 'npm',
21+
currentVersion: exec('npm --version'),
22+
versionRequirement: packageConfig.engines.npm
23+
})
24+
}
25+
26+
module.exports = function () {
27+
const warnings = []
28+
for (let i = 0; i < versionRequirements.length; i++) {
29+
const mod = versionRequirements[i]
30+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
31+
warnings.push(mod.name + ': ' +
32+
chalk.red(mod.currentVersion) + ' should be ' +
33+
chalk.green(mod.versionRequirement)
34+
)
35+
}
36+
}
37+
38+
if (warnings.length) {
39+
console.log('')
40+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
41+
console.log()
42+
for (let i = 0; i < warnings.length; i++) {
43+
const warning = warnings[i]
44+
console.log(' ' + warning)
45+
}
46+
console.log()
47+
process.exit(1)
48+
}
49+
}

build/dev-client.js

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

build/dev-server.js

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

build/utils.js

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

0 commit comments

Comments
 (0)