-
Notifications
You must be signed in to change notification settings - Fork 5
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
sanszhu
committed
May 24, 2018
0 parents
commit 7d538be
Showing
37 changed files
with
9,308 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,21 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"es2015": { "modules": false } | ||
}], | ||
"stage-2" | ||
], | ||
"plugins": [ | ||
["transform-runtime", { | ||
"polyfill": true, | ||
}], | ||
"transform-vue-jsx" | ||
], | ||
"comments": false, | ||
"env": { | ||
"test": { | ||
"presets": ["latest", "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,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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 @@ | ||
build/*.js |
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 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
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,5 @@ | ||
.DS_Store | ||
node_modules/ | ||
dist/ | ||
npm-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,15 @@ | ||
{ | ||
"types": ["feature", "fix", "doc", "style", "refactor", "test", "chore", "revert"], | ||
"scope": { | ||
"required": true, | ||
"allowed": ["*"], | ||
"validate": false, | ||
"multiple": false | ||
}, | ||
"warnOnFail": false, | ||
"maxSubjectLength": 100, | ||
"subjectPattern": ".+", | ||
"subjectPatternErrorMsg": "subject does not match subject pattern!", | ||
"helpMessage": "\ngit commit规范:\n\nExample:\nfeature(ivr): change color of svg node\n\ntype -- 本次commit的类别,可选值:\n - feature:新功能\n - fix:修补bug\n - doc:文档\n - style: 格式(不影响代码运行的变动)\n - refactor:重构(即不是新增功能,也不是修改bug的代码变动)\n - test:增加测试 \n - chore:构建过程或辅助工具的变动\n\nscope -- 本次commit所属的需求名或影响范围\n\ndetail -- 本次commit的简短描述\n - 不超过50个字符\n - 以动词开头,使用现在时,如change、remove等\n - 首字母小写\n - 结尾不加句号(.)", | ||
"autoFix": 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 sanszhu | ||
|
||
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,20 @@ | ||
# Nerd | ||
|
||
> A Project Template with some webpack config and .rc | ||
> Nerd is not cool , Nerd is Usefull | ||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
npm install | ||
|
||
# serve with hot reload at localhost:8080 | ||
npm run dev | ||
|
||
# build for production with minification | ||
npm run build | ||
|
||
# build for production and view the bundle analyzer report | ||
npm run 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' | ||
process.env.NODE_ENV_INNER = 'development' | ||
|
||
var ora = require('ora') | ||
var path = require('path') | ||
var http = require('http') | ||
var fs = require('fs') | ||
var chalk = require('chalk') | ||
var webpack = require('webpack') | ||
var config = require('../config') | ||
var webpackConfig = require('./webpack.prod.conf') | ||
|
||
var spinner = ora('building for production...') | ||
spinner.start() | ||
|
||
var pack = function() { | ||
webpack(webpackConfig, function (err, stats) { | ||
spinner.stop() | ||
if (err) 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,58 @@ | ||
require('./check-versions')() | ||
|
||
process.env.NODE_ENV = 'production' | ||
|
||
var ora = require('ora') | ||
var rm = require('rimraf') | ||
var path = require('path') | ||
var http = require('http') | ||
var fs = require('fs') | ||
var chalk = require('chalk') | ||
var webpack = require('webpack') | ||
var config = require('../config') | ||
var webpackConfig = require('./webpack.prod.conf') | ||
|
||
var spinner = ora('building for production...') | ||
spinner.start() | ||
|
||
var download = function(url, dest, cb) { | ||
var file = fs.createWriteStream(dest); | ||
var request = http.get(url, function(response) { | ||
response.pipe(file); | ||
file.on('finish', function() { | ||
file.close(cb); // close() is async, call cb after close completes. | ||
}); | ||
}).on('error', function(err) { // Handle errors | ||
fs.unlink(dest); // Delete the file async. (But we don't check the result) | ||
if (cb) cb(); | ||
}); | ||
}; | ||
|
||
var pack = function() { | ||
webpack(webpackConfig, function (err, stats) { | ||
spinner.stop() | ||
if (err) 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' | ||
)) | ||
}) | ||
}; | ||
|
||
var dest = path.resolve(__dirname, '../offline/vhtml/vue.prod.js'); | ||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { | ||
if (err) throw err | ||
rm(dest, err => { | ||
if (err) throw err | ||
download('http://bqq.gtimg.com/vhtml/latest/vue.prod.js', dest, pack) | ||
}) | ||
}) |
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,45 @@ | ||
var chalk = require('chalk') | ||
var semver = require('semver') | ||
var packageConfig = require('../package.json') | ||
|
||
function exec (cmd) { | ||
return require('child_process').execSync(cmd).toString().trim() | ||
} | ||
|
||
var versionRequirements = [ | ||
{ | ||
name: 'node', | ||
currentVersion: semver.clean(process.version), | ||
versionRequirement: packageConfig.engines.node | ||
}, | ||
{ | ||
name: 'npm', | ||
currentVersion: exec('npm --version'), | ||
versionRequirement: packageConfig.engines.npm | ||
} | ||
] | ||
|
||
module.exports = function () { | ||
var warnings = [] | ||
for (var i = 0; i < versionRequirements.length; i++) { | ||
var mod = versionRequirements[i] | ||
if (!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 (var i = 0; i < warnings.length; i++) { | ||
var warning = warnings[i] | ||
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,62 @@ | ||
|
||
var nss = ['call', 'ea', 'mobile/ka', 'mobile/call']; | ||
var res = ''; | ||
res += `<h1>组件</h1>\n\r | ||
<table> | ||
<tr><td>组件</td><td><a target="_blank" href="/examples/pages/index">/examples/pages/index</a></td></tr> | ||
<tr><td>图标仪表盘</td><td><a target="_blank" href="/iconTool">/iconTool</a></td></tr> | ||
</table>\n\r | ||
` | ||
nss.forEach((ns) => { | ||
res += `<h1>${ns}</h1>\n\r`; | ||
var url = `../src/pages/${ns}/route.config.js`; | ||
delete require.cache[require.resolve(url)]; | ||
var routes = require(url); | ||
var table = `<table> | ||
${routes.map((route)=>{ | ||
let children = route.children || []; | ||
return children.reduce((prev, cur) => { | ||
return prev + tr(cur, ns, { | ||
title: (route.meta && route.meta.title || route.path) + '-', | ||
path: route.path + '/' | ||
}) | ||
}, tr(route, ns)) | ||
}).join('')} | ||
</table>\n\r`; | ||
res += table; | ||
}) | ||
|
||
function tr(route, ns, parent = { | ||
title: '', | ||
path: '' | ||
}) { | ||
return `<tr> | ||
<td>${route.meta && parent.title + route.meta.title || parent.path + route.path}</td> | ||
<td><a target="_blank" href="/${ns}${parent.path + route.path}">${parent.path + route.path}</a></td> | ||
</tr>` | ||
} | ||
|
||
var html = ` | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>dashboard</title> | ||
<meta charset="utf-8"> | ||
</head> | ||
<style> | ||
table { | ||
border-collapse: collapse; | ||
} | ||
td { | ||
border: 1px solid #ccc; | ||
padding: 10px; | ||
} | ||
</style> | ||
<body> | ||
${res} | ||
</body> | ||
</html> | ||
` | ||
module.exports = html; |
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,10 @@ | ||
/* eslint-disable */ | ||
require('eventsource-polyfill') | ||
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=false') | ||
|
||
hotClient.subscribe(function (event) { | ||
if (event.action === 'reload') { | ||
window.location.reload() | ||
} | ||
//window.location.reload() | ||
}) |
Oops, something went wrong.