Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Commit b4009d8

Browse files
author
Jason Cui
committed
[Config] upgrade from webpack-boilerplate.
1 parent 4299243 commit b4009d8

26 files changed

+775
-537
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"space-before-function-paren": "off",
2929
"max-len": "off",
3030
"linebreak-style": "off",
31-
"no-unused-vars": "off"
31+
"no-unused-vars": "off",
32+
"eol-last": "off"
3233
}
3334
}

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sudo: required
2+
language: node_js
3+
node_js:
4+
- "6"
5+
- "7"
6+
7+
cache: yarn
8+
9+
install:
10+
- yarn
11+
12+
13+
before_script:
14+
- yarn add global gulp
15+
16+
script: yarn run build
17+
18+
cache: yarn

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Aquariuslt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

gulpfile.babel.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './tasks/build';
2+
import './tasks/clean';
3+
import './tasks/test';
4+
import './tasks/serve';

package.json

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "Vue-Boilerplate",
33
"version": "1.0.0",
4+
"description": "A Vue boilerplate like Angular build flow.",
45
"author": "Aquariuslt<superaquariuslt@gmail.com>",
5-
"description": "Vue boilerplate",
6-
"repository": "https://github.com/Aquariuslt/Vue-Boilerplate",
76
"license": "MIT",
87
"scripts": {
9-
"start": "webpack-dev-server --config ./tasks/webpack/webpack.dev.babel.js",
10-
"dev": "webpack-dev-server --config ./tasks/webpack/webpack.dev.babel.js",
11-
"build": "rimraf dist && webpack --config ./tasks/webpack/webpack.prod.babel.js",
12-
"lint": "eslint --ext .js,.vue src"
8+
"clean": "gulp clean",
9+
"dev": "gulp serve",
10+
"build": "gulp build:prod",
11+
"lint": "gulp lint",
12+
"test": "gulp test"
1313
},
1414
"dependencies": {
1515
"gsap": "^1.19.1",
@@ -44,11 +44,16 @@
4444
"file-loader": "^0.11.0",
4545
"friendly-errors-webpack-plugin": "^1.1.3",
4646
"gulp": "^3.9.1",
47+
"gulp-inject-string": "^1.1.0",
48+
"gulp-rimraf": "^0.2.1",
49+
"gulp-sequence": "^0.4.6",
50+
"gulp-util": "^3.0.8",
4751
"html-webpack-plugin": "^2.28.0",
4852
"http-proxy-middleware": "^0.17.3",
4953
"less": "^2.7.2",
5054
"less-loader": "^4.0.3",
5155
"lodash": "^4.17.4",
56+
"moment": "^2.18.1",
5257
"node-sass": "^4.5.2",
5358
"normalize.css": "^6.0.0",
5459
"opn": "^4.0.2",
@@ -57,14 +62,15 @@
5762
"sass-loader": "^6.0.3",
5863
"style-loader": "^0.16.1",
5964
"url-loader": "^0.5.8",
60-
"vue-loader": "^11.1.4",
61-
"vue-style-loader": "^2.0.0",
62-
"vue-template-compiler": "^2.2.4",
63-
"webpack": "^2.2.1",
65+
"vue-loader": "^11.3.4",
66+
"vue-style-loader": "^3.0.0",
67+
"vue-template-compiler": "^2.2.6",
68+
"webpack": "^2.3.3",
6469
"webpack-bundle-analyzer": "^2.2.1",
6570
"webpack-dev-middleware": "^1.10.0",
6671
"webpack-dev-server": "^2.4.2",
6772
"webpack-hot-middleware": "^2.16.1",
68-
"webpack-merge": "^2.6.1"
73+
"webpack-merge": "^2.6.1",
74+
"winston": "^2.3.1"
6975
}
7076
}

src/app/components/workflow/Workflow.vue

+67-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
<!-- Node G -->
1515
<transition-group name="workflow-node-list" class="workflow-node-graph" tag="g">
1616
<circle v-for="node in nodeList"
17-
r="30"
1817
v-bind:key="node"
18+
v-bind:r="node.r"
1919
v-bind:cx="node.cx"
2020
v-bind:cy="node.cy"
21+
v-bind:class="node.fillClass"
22+
v-on:click="increase(node)"
2123
class="workflow-node">
2224
</circle>
2325
</transition-group>
@@ -39,6 +41,7 @@
3941

4042
<script>
4143
import _ from 'lodash';
44+
import {TweenLite} from 'gsap';
4245
4346
let sampleWorkflowSchemaData = {
4447
nodes: [
@@ -123,9 +126,11 @@
123126
console.log('depth:', depth, 'nodes:', depthNodeLength);
124127
_.each(currentDepthNodes, function (node, nodeIndex) {
125128
let clonedNode = _.clone(node);
129+
clonedNode.r = 30;
126130
clonedNode.cx = widthPerDepth * depth + widthPerDepth / 2;
127131
clonedNode.cy = layout.height / (depthNodeLength * 2) + nodeIndex * (layout.height / (depthNodeLength));
128132
clonedNode.depth = depth;
133+
clonedNode.fillClass = calculateFillColorClass(clonedNode.r);
129134
nodeList.push(clonedNode);
130135
});
131136
});
@@ -150,10 +155,13 @@
150155
// calculate label
151156
let labelList = [];
152157
_.each(nodeList, function (node) {
158+
let scaled = 3.5;
159+
let textLength = _.isUndefined(node.name) ? 0 : node.name.length * scaled;
160+
let textHeight = 3 * scaled;
153161
let label = {
154162
text: node.name,
155-
x: node.cx,
156-
y: node.cy
163+
x: node.cx - textLength,
164+
y: node.cy + node.r + textHeight
157165
};
158166
labelList.push(label);
159167
});
@@ -183,6 +191,22 @@
183191
}
184192
185193
194+
function calculateFillColorClass(level) {
195+
const warningLimit = 40;
196+
const dangerLimit = 50;
197+
let targetClassPrefix = 'workflow-node';
198+
199+
if (level >= warningLimit && level < dangerLimit) {
200+
return targetClassPrefix + '-warning';
201+
}
202+
if (level >= dangerLimit) {
203+
return targetClassPrefix + '-danger';
204+
}
205+
206+
return targetClassPrefix + '-normal';
207+
}
208+
209+
186210
export default{
187211
name: 'workflow',
188212
props: [
@@ -205,7 +229,26 @@
205229
this.pathList = pathList;
206230
this.labelList = labelList;
207231
},
208-
methods: {}
232+
methods: {
233+
increase: function (workflowNode) {
234+
let originalRadius = workflowNode.r;
235+
let targetRadius = originalRadius + 5;
236+
237+
let targetFillColorClass = calculateFillColorClass(workflowNode.r);
238+
239+
TweenLite.to(
240+
workflowNode,
241+
1,
242+
{
243+
r: targetRadius,
244+
fillClass: targetFillColorClass
245+
}
246+
);
247+
},
248+
decrease: function () {
249+
console.log('decrease');
250+
}
251+
}
209252
};
210253
</script>
211254

@@ -226,6 +269,23 @@
226269
}
227270
228271
.workflow-node-graph {
272+
transition: 1s;
273+
}
274+
275+
$workflow-normal-color: #41B883;
276+
$workflow-warning-color: #b88207;
277+
$workflow-danger-color: #b82800;
278+
279+
.workflow-node {
280+
&-normal {
281+
fill: $workflow-normal-color !important;;
282+
}
283+
&-warning {
284+
fill: $workflow-warning-color !important;
285+
}
286+
&-danger {
287+
fill: $workflow-danger-color !important;;
288+
}
229289
}
230290
231291
$workflow-node-content-color: #41B883;
@@ -248,7 +308,8 @@
248308
}
249309
250310
.workflow-label {
251-
font-weight: bold;
311+
font-size: 14px;
312+
font-weight: lighter;
252313
fill: #000000;
253314
}
254315
@@ -277,16 +338,13 @@
277338
278339
}
279340
280-
281-
282341
.workflow-label-list-enter-active,
283-
.workflow-label-list-leave-active{
342+
.workflow-label-list-leave-active {
284343
opacity: 0;
285344
transition: 1s;
286345
}
287346
288347
289-
290348
</style>
291349

292350

src/assets/.gitkeep

Whitespace-only changes.

src/assets/fonts/material-icons.woff2

-46.4 KB
Binary file not shown.

src/fonts.css

+4-24
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
/* For Global Material Design Icons */
21
@font-face {
3-
font-family: 'Material Icons';
2+
font-family: 'Roboto';
43
font-style: normal;
54
font-weight: 400;
6-
src: url(./assets/fonts/material-icons.woff2) format('woff2');
5+
src: local(Roboto), url(./assets/fonts/roboto.woff) format('woff');
76
}
87

9-
.material-icons {
10-
font-family: 'Material Icons';
11-
font-weight: normal;
12-
font-style: normal;
13-
font-size: 24px;
14-
line-height: 1;
15-
letter-spacing: normal;
16-
text-transform: none;
17-
display: inline-block;
18-
white-space: nowrap;
19-
word-wrap: normal;
20-
direction: ltr;
21-
-webkit-font-feature-settings: 'liga';
22-
-webkit-font-smoothing: antialiased;
8+
body * {
9+
font-family: 'Roboto', serif !important;
2310
}
24-
25-
@font-face {
26-
font-family: 'Roboto';
27-
font-style: normal;
28-
font-weight: 400;
29-
src: local(Roboto), url(./assets/fonts/roboto.woff) format('woff');
30-
}

src/style.css src/styles.css

File renamed without changes.

tasks/build.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Created by Aquariuslt on 15/04/2017.*/
2+
import gulp from 'gulp';
3+
import gutil from 'gulp-util';
4+
import sequence from 'gulp-sequence';
5+
6+
import webpack from 'webpack';
7+
import webpackProdConfig from './config/webpack.prod.config.babel';
8+
9+
import './clean';
10+
11+
import logger from './util/logger';
12+
13+
gulp.task('build', function (done) {
14+
logger.info('Webpack building.');
15+
webpack(webpackProdConfig, function (error, stats) {
16+
if (error) {
17+
throw new gutil.PluginError('webpack', error);
18+
}
19+
gutil.log(stats.toString(webpackProdConfig.stats));
20+
logger.info('Webpack build done');
21+
done();
22+
});
23+
});
24+
25+
26+
gulp.task('build:prod', sequence(['clean'], ['build']));
27+
28+

tasks/clean.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Created by Aquariuslt on 15/04/2017.*/
2+
import gulp from 'gulp';
3+
import rimraf from 'gulp-rimraf';
4+
5+
import logger from './util/logger';
6+
7+
import prodConfig from './config/prod.config';
8+
9+
gulp.task('clean', function () {
10+
logger.info('Deleting dist folder');
11+
return gulp.src(prodConfig.dist)
12+
.pipe(rimraf());
13+
});

tasks/config/base.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* Created by Aquariuslt on 14/04/2017.*/
2+
let baseConfig = {
3+
src: 'src',
4+
dist: 'dist',
5+
// assets folder will be copied into dist folder
6+
assets: [
7+
{
8+
from: 'src/assets',
9+
to: 'assets'
10+
}
11+
],
12+
// if you use favicon.ico or other filename under /src please update here
13+
favicon: 'favicon.png'
14+
};
15+
16+
export default baseConfig;

tasks/config/dev.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Created by Aquariuslt on 14/04/2017.*/
2+
3+
import merge from 'webpack-merge';
4+
import baseConfig from './base.config';
5+
import * as pathUtil from '../util/path-util';
6+
7+
8+
/**
9+
* Update development environment configurable variables here.
10+
* */
11+
12+
const PROTOCOL = 'http://';
13+
const HOST = '127.0.0.1';
14+
const PORT = 5000;
15+
16+
17+
let devConfig = merge(baseConfig, {
18+
output: {
19+
path: pathUtil.root('build'),
20+
publicPath: PROTOCOL + HOST + ':' + PORT
21+
},
22+
devServer: {
23+
host: HOST,
24+
port: PORT
25+
}
26+
});
27+
28+
export default devConfig;

0 commit comments

Comments
 (0)