Skip to content

Commit 9dec94f

Browse files
committed
restructured the application for modularity
1 parent 331fe8b commit 9dec94f

File tree

18 files changed

+106
-86
lines changed

18 files changed

+106
-86
lines changed

.eslintrc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module.exports = {
2222
// allow async-await
2323
'generator-star-spacing': 0,
2424
// allow debugger during development
25-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
25+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
26+
// require semicolons
27+
"semi": [2, "always"]
2628
}
2729
}

package.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,34 @@
1313
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
1414
},
1515
"dependencies": {
16+
"bulma": "^0.3.1",
17+
"localforage": "^1.4.3",
1618
"vue": "^2.1.10",
17-
"vue-router": "^2.2.0"
19+
"vue-router": "^2.2.0",
20+
"vuex": "^2.1.2"
1821
},
1922
"devDependencies": {
2023
"autoprefixer": "^6.7.2",
2124
"babel-core": "^6.22.1",
2225
"babel-eslint": "^7.1.1",
2326
"babel-loader": "^6.2.10",
27+
"babel-plugin-istanbul": "^3.1.2",
2428
"babel-plugin-transform-runtime": "^6.22.0",
2529
"babel-preset-es2015": "^6.22.0",
2630
"babel-preset-stage-2": "^6.22.0",
2731
"babel-register": "^6.22.0",
32+
"chai": "^3.5.0",
2833
"chalk": "^1.1.3",
34+
"chromedriver": "^2.27.2",
2935
"connect-history-api-fallback": "^1.3.0",
36+
"cross-env": "^3.1.4",
37+
"cross-spawn": "^5.0.1",
3038
"css-loader": "^0.26.1",
3139
"eslint": "^3.14.1",
40+
"eslint-config-standard": "^6.2.1",
3241
"eslint-friendly-formatter": "^2.0.7",
3342
"eslint-loader": "^1.6.1",
3443
"eslint-plugin-html": "^2.0.0",
35-
"eslint-config-standard": "^6.2.1",
3644
"eslint-plugin-promise": "^3.4.0",
3745
"eslint-plugin-standard": "^2.0.1",
3846
"eventsource-polyfill": "^0.9.6",
@@ -43,8 +51,7 @@
4351
"function-bind": "^1.1.0",
4452
"html-webpack-plugin": "^2.28.0",
4553
"http-proxy-middleware": "^0.17.3",
46-
"webpack-bundle-analyzer": "^2.2.1",
47-
"cross-env": "^3.1.4",
54+
"inject-loader": "^2.0.1",
4855
"karma": "^1.4.1",
4956
"karma-coverage": "^1.1.1",
5057
"karma-mocha": "^1.3.0",
@@ -55,25 +62,24 @@
5562
"karma-webpack": "^2.0.2",
5663
"lolex": "^1.5.2",
5764
"mocha": "^3.2.0",
58-
"chai": "^3.5.0",
59-
"sinon": "^1.17.7",
60-
"sinon-chai": "^2.8.0",
61-
"inject-loader": "^2.0.1",
62-
"babel-plugin-istanbul": "^3.1.2",
63-
"phantomjs-prebuilt": "^2.1.14",
64-
"chromedriver": "^2.27.2",
65-
"cross-spawn": "^5.0.1",
6665
"nightwatch": "^0.9.12",
67-
"selenium-server": "^3.0.1",
68-
"semver": "^5.3.0",
66+
"node-sass": "^4.5.0",
6967
"opn": "^4.0.2",
7068
"ora": "^1.1.0",
69+
"phantomjs-prebuilt": "^2.1.14",
70+
"sass-loader": "^5.0.1",
71+
"scss-loader": "0.0.1",
72+
"selenium-server": "^3.0.1",
73+
"semver": "^5.3.0",
7174
"shelljs": "^0.7.6",
75+
"sinon": "^1.17.7",
76+
"sinon-chai": "^2.8.0",
7277
"url-loader": "^0.5.7",
7378
"vue-loader": "^10.3.0",
7479
"vue-style-loader": "^2.0.0",
7580
"vue-template-compiler": "^2.1.10",
7681
"webpack": "^2.2.1",
82+
"webpack-bundle-analyzer": "^2.2.1",
7783
"webpack-dev-middleware": "^1.10.0",
7884
"webpack-hot-middleware": "^2.16.1",
7985
"webpack-merge": "^2.6.1"

src/App.vue renamed to src/app/App.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
22
<div id="app">
3-
<img src="./assets/logo.png">
3+
<img src="../assets/logo.png">
44
<router-view></router-view>
55
</div>
66
</template>
77

88
<script>
99
export default {
1010
name: 'app'
11-
}
11+
};
1212
</script>
1313

1414
<style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div id="accounts-list-view">
3+
I'm a list of accounts!
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'accounts-list-view'
10+
};
11+
</script>
12+
13+
<style scoped lang='scss'>
14+
#accounts-list-view {
15+
}
16+
</style>

src/app/accounts/components/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as AccountsListView } from './AccountsListView';

src/app/accounts/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as routes } from './routes';
2+
export { default as vuex } from './vuex';

src/app/accounts/routes.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as components from './components';
2+
3+
export default [
4+
{
5+
path: '/',
6+
component: components.AccountsListView
7+
}
8+
];

src/app/accounts/vuex/actions.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const doSomething = ({ commit }, data) => {
2+
commit('DO_SOMETHING', { data: data });
3+
};

src/app/accounts/vuex/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as actions from './actions';
2+
import mutations from './mutations';
3+
4+
const state = {
5+
something: {}
6+
};
7+
8+
export default {
9+
state,
10+
actions,
11+
mutations
12+
};

src/app/accounts/vuex/mutations.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
DO_SOMETHING (state, { data }) {
3+
state.something = data;
4+
}
5+
};

src/app/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as routes } from './routes';
2+
export { default as vuex } from './vuex';
3+
export { default as App } from './App';

src/app/routes.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { routes as accounts } from './accounts';
2+
3+
export default [ ...accounts ];

src/app/vuex.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { vuex as accounts } from './accounts';
2+
3+
export default { accounts };

src/assets/logo.png

-2.99 KB
Loading

src/components/Hello.vue

-53
This file was deleted.

src/main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// The Vue build version to load with the `import` command
22
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3-
import Vue from 'vue'
4-
import App from './App'
5-
import router from './router'
3+
import Vue from 'vue';
4+
import { App } from './app';
5+
import router from './router';
6+
import store from './store';
67

78
/* eslint-disable no-new */
89
new Vue({
910
el: '#app',
11+
store,
1012
router,
1113
template: '<App/>',
1214
components: { App }
13-
})
15+
});

src/router/index.js

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import Vue from 'vue'
2-
import Router from 'vue-router'
3-
import Hello from 'components/Hello'
1+
import Vue from 'vue';
2+
import Router from 'vue-router';
3+
import { routes } from '../app';
44

5-
Vue.use(Router)
5+
Vue.use(Router);
66

77
export default new Router({
8-
routes: [
9-
{
10-
path: '/',
11-
name: 'Hello',
12-
component: Hello
13-
}
14-
]
15-
})
8+
mode: 'history',
9+
routes: routes
10+
});

src/store/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Vue from 'vue';
2+
import Vuex from 'vuex';
3+
import { vuex } from '../app';
4+
5+
Vue.use(Vuex);
6+
7+
const debug = process.env.NODE_ENV !== 'production';
8+
9+
export default new Vuex.Store({
10+
modules: vuex,
11+
strict: debug
12+
});

0 commit comments

Comments
 (0)