First init

This commit is contained in:
saplf
2018-09-28 15:20:43 +08:00
commit a8fabb15fd
27 changed files with 332 additions and 0 deletions

3
.browserslistrc Normal file
View File

@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8

30
.eslintrc.js Normal file
View File

@@ -0,0 +1,30 @@
module.exports = {
root: true,
env: {
browser: true,
},
'extends': [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard',
],
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// comma dangle
'comma-dangle': ['error', 'always-multiline'],
// space between function and parentheses
'space-before-function-paren': ['error', {
'anonymous': 'never',
'named': 'never',
'asyncArrow': 'always',
}],
},
parserOptions: {
parser: 'babel-eslint',
},
}

21
.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

31
README.md Normal file
View File

@@ -0,0 +1,31 @@
# console
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Run your unit tests
```
npm run test:unit
```

5
babel.config.js Normal file
View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app',
],
}

23
jest.config.js Normal file
View File

@@ -0,0 +1,23 @@
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue',
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
snapshotSerializers: [
'jest-serializer-vue',
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
],
testURL: 'http://localhost/',
}

29
package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "console",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.4",
"@vue/cli-plugin-eslint": "^3.0.4",
"@vue/cli-plugin-unit-jest": "^3.0.4",
"@vue/cli-service": "^3.0.4",
"@vue/eslint-config-standard": "^3.0.4",
"@vue/test-utils": "^1.0.0-beta.20",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.17"
}
}

5
postcss.config.js Normal file
View File

@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {},
},
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

17
public/index.html Normal file
View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>console</title>
</head>
<body>
<noscript>
<strong>We're sorry but console doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

29
src/App.vue Normal file
View File

@@ -0,0 +1,29 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div>
</template>
<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

15
src/main.js Normal file
View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { app } from './services'
Vue.config.productionTip = false
Vue.config.devtools = app.dev
Vue.config.performance = !app.dev
new Vue({
router,
store,
render: h => h(App),
}).$mount('#app')

23
src/router.js Normal file
View File

@@ -0,0 +1,23 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home,
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('./views/About.vue'),
},
],
})

3
src/services/app.js Normal file
View File

@@ -0,0 +1,3 @@
export default {
dev: process.env.NODE_ENV === 'development',
}

1
src/services/index.js Normal file
View File

@@ -0,0 +1 @@
export { default as app } from './app'

8
src/store/chain.js Normal file
View File

@@ -0,0 +1,8 @@
import Vuex from 'vuex'
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
getters: {},
})

15
src/store/index.js Normal file
View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import Vuex from 'vuex'
import chain from './chain'
import market from './market'
import network from './network'
import owner from './owner'
Vue.use(Vuex)
export default new Vuex.Store({
chain,
owner,
market,
network,
})

8
src/store/market.js Normal file
View File

@@ -0,0 +1,8 @@
import Vuex from 'vuex'
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
getters: {},
})

8
src/store/network.js Normal file
View File

@@ -0,0 +1,8 @@
import Vuex from 'vuex'
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
getters: {},
})

8
src/store/node.js Normal file
View File

@@ -0,0 +1,8 @@
import Vuex from 'vuex'
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
getters: {},
})

8
src/store/owner.js Normal file
View File

@@ -0,0 +1,8 @@
import Vuex from 'vuex'
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
getters: {},
})

5
src/views/About.vue Normal file
View File

@@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

11
src/views/Home.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png" />
</div>
</template>
<script>
export default {
name: 'Home',
}
</script>

5
tests/unit/.eslintrc.js Normal file
View File

@@ -0,0 +1,5 @@
module.exports = {
env: {
jest: true,
},
}

View File

@@ -0,0 +1,12 @@
// import { shallowMount } from '@vue/test-utils'
// import HelloWorld from '@/components/HelloWorld.vue'
//
// describe('HelloWorld.vue', () => {
// it('renders props.msg when passed', () => {
// const msg = 'new message'
// const wrapper = shallowMount(HelloWorld, {
// propsData: { msg },
// })
// expect(wrapper.text()).toMatch(msg)
// })
// })

9
vue.config.js Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
baseUrl: undefined,
outputDir: undefined,
assetsDir: undefined,
runtimeCompiler: undefined,
productionSourceMap: false,
parallel: undefined,
css: undefined,
}