-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7eae270
Showing
27 changed files
with
4,938 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"presets": [ | ||
["env", { "modules": false }], | ||
"stage-2" | ||
], | ||
"plugins": ["transform-runtime"], | ||
"comments": false, | ||
"env": { | ||
"test": { | ||
"presets": ["env", "stage-2"], | ||
"plugins": [ "istanbul" ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
node_modules/ | ||
dist/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
plugins: | ||
autoprefixer: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 - Present [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# vue-pcs | ||
|
||
> A demo for CoffeeScript based Vue.js project | ||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
yarn | ||
|
||
# serve with hot reload at localhost:8080 | ||
yarn dev | ||
|
||
# build for production with minification | ||
yarn build | ||
|
||
# build for production and view the bundle analyzer report | ||
yarn build --report | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require('./check-versions')() | ||
|
||
process.env.NODE_ENV = 'production' | ||
|
||
ora = require 'ora' | ||
rm = require 'rimraf' | ||
path = require 'path' | ||
chalk = require 'chalk' | ||
webpack = require 'webpack' | ||
config = require '../config' | ||
webpackConfig = require './webpack.prod.conf' | ||
|
||
spinner = ora 'Building for production...' | ||
spinner.start() | ||
|
||
files = path.join config.build.assetsRoot, config.build.assetsSubDirectory | ||
|
||
rm files, (err) -> | ||
if err then throw err | ||
|
||
webpack webpackConfig, (err, stats) -> | ||
spinner.stop() | ||
if err then throw err | ||
|
||
process.stdout.write "#{stats.toString | ||
colors: true | ||
modules: false | ||
children: false | ||
chunks: false | ||
chunkModules: false}\n\n" | ||
|
||
console.log chalk.cyan ' Build complete.\n' | ||
console.log chalk.yellow( | ||
' Tip: built files are meant to be served over an HTTP server.\n' | ||
' Opening index.html over file:// won\'t work.\n' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
chalk = require 'chalk' | ||
semver = require 'semver' | ||
packageConfig = require '../package' | ||
shell = require 'shelljs' | ||
|
||
exec = (cmd) -> | ||
require 'child_process' | ||
.execSync cmd | ||
.toString() | ||
.trim() | ||
|
||
versionRequirements = [ | ||
name: 'node' | ||
currentVersion: semver.clean(process.version) | ||
versionRequirement: packageConfig.engines.node | ||
] | ||
|
||
if shell.which 'npm' | ||
versionRequirements.push | ||
name: 'npm' | ||
currentVersion: exec 'npm --version' | ||
versionRequirement: packageConfig.engines.npm | ||
|
||
module.exports = -> | ||
warnings = [] | ||
for mod in versionRequirements | ||
if not semver.satisfies mod.currentVersion, mod.versionRequirement | ||
warnings.push "#{mod.name}:#{chalk.red(mod.currentVersion)} should be #{chalk.green(mod.versionRequirement)}" | ||
|
||
if warnings.length | ||
console.log '' | ||
console.log chalk.yellow 'To use this template, you must update following to modules:' | ||
console.log() | ||
for warning in warnings | ||
console.log " #{warning}" | ||
console.log() | ||
process.exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'eventsource-polyfill' | ||
|
||
hotClient = require 'webpack-hot-middleware/client?noInfo=true&reload=true' | ||
|
||
hotClient.subscribe (evnet) -> | ||
if evnet.action is 'reload' then window.location.reload() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require('./check-versions')() | ||
|
||
config = require '../config' | ||
|
||
unless process.env.NODE_ENV then process.env.NODE_ENV = JSON.parse config.dev.env.NODE_ENV | ||
|
||
opn = require 'opn' | ||
path = require 'path' | ||
express = require 'express' | ||
webpack = require 'webpack' | ||
proxyMiddleware = require 'http-proxy-middleware' | ||
webpackConfig = require './webpack.dev.conf' | ||
|
||
port = process.env.PORT or config.dev.port | ||
autoOpenBrowser = config.dev.autoOpenBrowser | ||
proxyTable = config.dev.proxyTable | ||
|
||
app = express() | ||
compiler = webpack webpackConfig | ||
|
||
devMiddleware = require('webpack-dev-middleware') compiler, | ||
publicPath: webpackConfig.output.publicPath | ||
quiet: on | ||
|
||
hotMiddleware = require('webpack-hot-middleware') compiler, | ||
log: -> {} | ||
|
||
compiler.plugin 'compilation', (compilation) -> | ||
compilation.plugin 'html-webpack-plugin-after-emit', (data, cb) -> | ||
hotMiddleware.publish | ||
action: 'reload' | ||
cb() | ||
|
||
for context, options of proxyTable | ||
if typeof options is 'string' | ||
options = | ||
target: options | ||
app.use proxyMiddleware options.filter or context, options | ||
|
||
app.use require('connect-history-api-fallback')() | ||
app.use devMiddleware | ||
app.use hotMiddleware | ||
|
||
staticPath = path.posix.join config.dev.assetsPublicPath, config.dev.assetsSubDirectory | ||
app.use staticPath, express.static './static' | ||
|
||
uri = "http://localhost:#{port}" | ||
|
||
_resovle = null | ||
readyPromise = new Promise (resolve) -> _resovle = resolve | ||
|
||
console.log '> Starting dev server...' | ||
devMiddleware.waitUntilValid -> | ||
console.log "> Listening at #{uri} \n" | ||
|
||
if autoOpenBrowser and process.env.NODE_ENV isnt 'testing' then opn uri | ||
_resovle() | ||
|
||
server = app.listen port | ||
|
||
module.exports = | ||
ready: readyPromise | ||
close: -> server.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
path = require 'path' | ||
config = require '../config' | ||
ExtractTextPlugin = require 'extract-text-webpack-plugin' | ||
|
||
isProduction = process.env.NODE_ENV is 'production' | ||
|
||
exports.assetsPath = (_path) -> | ||
assetsSubDirectory = if isProduction then config.build.assetsSubDirectory else config.dev.assetsSubDirectory | ||
path.posix.join assetsSubDirectory, _path | ||
|
||
exports.cssLoaders = (options = {}) -> | ||
cssLoader = | ||
loader: 'css-loader' | ||
options: | ||
minimize: isProduction | ||
sourceMap: options.sourceMap | ||
|
||
# generate loader string to be used with extract text plugin | ||
generateLoaders = (loader, loaderOptions) -> | ||
loaders = [cssLoader] | ||
if loader | ||
loaders.push | ||
loader: "#{loader}-loader" | ||
options: Object.assign {}, loaderOptions, | ||
sourceMap: options.sourceMap | ||
|
||
if options.extract | ||
ExtractTextPlugin.extract | ||
use: loaders | ||
fallback: 'vue-style-loader' | ||
else | ||
['vue-style-loader', loaders...] | ||
|
||
css: generateLoaders() | ||
postcss: generateLoaders() | ||
less: generateLoaders 'less' | ||
sass: generateLoaders 'sass', | ||
indentedSyntax: on | ||
scss: generateLoaders 'sass' | ||
stylus: generateLoaders 'stylus' | ||
styl: generateLoaders 'stylus' | ||
|
||
exports.styleLoaders = (options) -> | ||
output = [] | ||
for extension, loader of exports.cssLoaders(options) | ||
output.push | ||
test: new RegExp "\\.#{extension}$" | ||
use: loader | ||
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
utils = require './utils' | ||
config = require '../config' | ||
isProduction = process.env.NODE_ENV is 'production' | ||
|
||
cssLoaders = utils.cssLoaders | ||
sourceMap: if isProduction then config.build.productionSourceMap else config.dev.cssSourceMap | ||
extract: isProduction | ||
|
||
module.exports = | ||
use: cssLoaders | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
path = require 'path' | ||
utils = require './utils' | ||
config = require '../config' | ||
vueLoaderConfig = require './vue-loader.conf' | ||
|
||
isProduction = process.env.NODE_ENV is 'production' | ||
|
||
resolve = (dir) -> | ||
path.join __dirname, '..', dir | ||
|
||
module.exports = | ||
entry: | ||
app: './src/main' | ||
|
||
output: | ||
path: resolve 'dist' | ||
filename: '[name].js' | ||
publicPath: if isProduction then config.build.assetsPublicPath else config.dev.assetsPublicPath | ||
|
||
resolve: | ||
extensions: ['.coffee', '.js', '.vue', '.json'] | ||
alias: | ||
'vue$': 'vue/dist/vue.esm.js', | ||
'@': resolve 'src' | ||
|
||
module: | ||
rules: [ | ||
test: /\.coffee$/ | ||
rules: [ | ||
loader: 'coffee-loader' | ||
, | ||
loader: 'babel-loader' | ||
enforce: 'post' | ||
] | ||
exclude: [ | ||
resolve 'node_modules' | ||
] | ||
, | ||
test: /\.vue$/ | ||
loader: 'vue-loader' | ||
options: vueLoaderConfig | ||
, | ||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/ | ||
loader: 'url-loader' | ||
options: | ||
limit: 10000 | ||
name: utils.assetsPath 'img/[name].[hash:7].[ext]' | ||
, | ||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/ | ||
loader: 'url-loader' | ||
options: | ||
limit: 10000 | ||
name: utils.assetsPath 'fonts/[name].[hash:7].[ext]' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
webpack = require 'webpack' | ||
merge = require 'webpack-merge' | ||
HtmlWebpackPlugin = require 'html-webpack-plugin' | ||
FriendlyErrorsPlugin = require 'friendly-errors-webpack-plugin' | ||
|
||
utils = require './utils' | ||
config = require '../config' | ||
baseWebpackConfig = require './webpack.base.config' | ||
|
||
for name of baseWebpackConfig.entry | ||
baseWebpackConfig.entry[name] = ['./build/dev-client', baseWebpackConfig.entry[name]] | ||
|
||
module.exports = merge baseWebpackConfig, | ||
module: | ||
rules: utils.styleLoaders | ||
sourceMap: config.dev.cssSourceMap | ||
devtool: '#cheap-module-eval-source-map' | ||
plugins: [ | ||
new webpack.DefinePlugin | ||
'process.env': config.dev.env | ||
new webpack.HotModuleReplacementPlugin() | ||
new webpack.NoEmitOnErrorsPlugin() | ||
new HtmlWebpackPlugin | ||
filename: 'index.html' | ||
template: 'index.html' | ||
inject: on | ||
new FriendlyErrorsPlugin() | ||
] |
Oops, something went wrong.