Skip to content

Commit f5645cd

Browse files
committed
init
0 parents  commit f5645cd

22 files changed

+409
-0
lines changed

.browserslistrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not dead

.eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
'extends': [
7+
'plugin:vue/essential',
8+
'eslint:recommended',
9+
'@vue/typescript/recommended',
10+
'@vue/prettier',
11+
'@vue/prettier/@typescript-eslint'
12+
],
13+
parserOptions: {
14+
ecmaVersion: 2020
15+
},
16+
rules: {
17+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
18+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
19+
},
20+
overrides: [
21+
{
22+
files: [
23+
'**/__tests__/*.{j,t}s?(x)',
24+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
25+
],
26+
env: {
27+
jest: true
28+
}
29+
}
30+
]
31+
}

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
6+
# local env files
7+
.env.local
8+
.env.*.local
9+
10+
# Log files
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# Editor directories and files
17+
.idea
18+
.vscode
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# veb
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn build
16+
```
17+
18+
### Run your unit tests
19+
```
20+
yarn test:unit
21+
```
22+
23+
### Lints and fixes files
24+
```
25+
yarn lint
26+
```
27+
28+
### Customize configuration
29+
See [Configuration Reference](https://cli.vuejs.org/config/).

babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

jest.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel'
3+
}

package.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "veb",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"test:unit": "vue-cli-service test:unit",
9+
"lint": "vue-cli-service lint"
10+
},
11+
"dependencies": {
12+
"core-js": "^3.6.5",
13+
"vue": "^2.6.11",
14+
"vue-class-component": "^7.2.3",
15+
"vue-property-decorator": "^8.4.2",
16+
"vue-router": "^3.2.0",
17+
"vuex": "^3.4.0"
18+
},
19+
"devDependencies": {
20+
"@types/jest": "^24.0.19",
21+
"@typescript-eslint/eslint-plugin": "^2.33.0",
22+
"@typescript-eslint/parser": "^2.33.0",
23+
"@vue/cli-plugin-babel": "~4.5.0",
24+
"@vue/cli-plugin-eslint": "~4.5.0",
25+
"@vue/cli-plugin-router": "~4.5.0",
26+
"@vue/cli-plugin-typescript": "~4.5.0",
27+
"@vue/cli-plugin-unit-jest": "~4.5.0",
28+
"@vue/cli-plugin-vuex": "~4.5.0",
29+
"@vue/cli-service": "~4.5.0",
30+
"@vue/eslint-config-prettier": "^6.0.0",
31+
"@vue/eslint-config-typescript": "^5.0.2",
32+
"@vue/test-utils": "^1.0.3",
33+
"eslint": "^6.7.2",
34+
"eslint-plugin-prettier": "^3.1.3",
35+
"eslint-plugin-vue": "^6.2.2",
36+
"lint-staged": "^9.5.0",
37+
"node-sass": "^4.12.0",
38+
"prettier": "^1.19.1",
39+
"sass-loader": "^8.0.2",
40+
"typescript": "~3.9.3",
41+
"vue-template-compiler": "^2.6.11"
42+
},
43+
"gitHooks": {
44+
"pre-commit": "lint-staged"
45+
},
46+
"lint-staged": {
47+
"*.{js,jsx,vue,ts,tsx}": [
48+
"vue-cli-service lint",
49+
"git add"
50+
]
51+
}
52+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div id="app">
3+
<div id="nav">
4+
<router-link to="/">Home</router-link> |
5+
<router-link to="/about">About</router-link>
6+
</div>
7+
<router-view/>
8+
</div>
9+
</template>
10+
11+
<style lang="scss">
12+
#app {
13+
font-family: Avenir, Helvetica, Arial, sans-serif;
14+
-webkit-font-smoothing: antialiased;
15+
-moz-osx-font-smoothing: grayscale;
16+
text-align: center;
17+
color: #2c3e50;
18+
}
19+
20+
#nav {
21+
padding: 30px;
22+
23+
a {
24+
font-weight: bold;
25+
color: #2c3e50;
26+
27+
&.router-link-exact-active {
28+
color: #42b983;
29+
}
30+
}
31+
}
32+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/HelloWorld.vue

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<p>
5+
For a guide and recipes on how to configure / customize this project,<br>
6+
check out the
7+
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
8+
</p>
9+
<h3>Installed CLI Plugins</h3>
10+
<ul>
11+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
12+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
13+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
14+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
15+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest" target="_blank" rel="noopener">unit-jest</a></li>
16+
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript" target="_blank" rel="noopener">typescript</a></li>
17+
</ul>
18+
<h3>Essential Links</h3>
19+
<ul>
20+
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
21+
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
22+
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
23+
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
24+
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
25+
</ul>
26+
<h3>Ecosystem</h3>
27+
<ul>
28+
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
29+
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
30+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
31+
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
32+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
33+
</ul>
34+
</div>
35+
</template>
36+
37+
<script lang="ts">
38+
import { Component, Prop, Vue } from 'vue-property-decorator';
39+
40+
@Component
41+
export default class HelloWorld extends Vue {
42+
@Prop() private msg!: string;
43+
}
44+
</script>
45+
46+
<!-- Add "scoped" attribute to limit CSS to this component only -->
47+
<style scoped lang="scss">
48+
h3 {
49+
margin: 40px 0 0;
50+
}
51+
ul {
52+
list-style-type: none;
53+
padding: 0;
54+
}
55+
li {
56+
display: inline-block;
57+
margin: 0 10px;
58+
}
59+
a {
60+
color: #42b983;
61+
}
62+
</style>

src/main.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
import router from './router'
4+
import store from './store'
5+
6+
Vue.config.productionTip = false
7+
8+
new Vue({
9+
router,
10+
store,
11+
render: h => h(App)
12+
}).$mount('#app')

src/router/index.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Vue from 'vue'
2+
import VueRouter, { RouteConfig } from 'vue-router'
3+
import Home from '../views/Home.vue'
4+
5+
Vue.use(VueRouter)
6+
7+
const routes: Array<RouteConfig> = [
8+
{
9+
path: '/',
10+
name: 'Home',
11+
component: Home
12+
},
13+
{
14+
path: '/about',
15+
name: 'About',
16+
// route level code-splitting
17+
// this generates a separate chunk (about.[hash].js) for this route
18+
// which is lazy-loaded when the route is visited.
19+
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
20+
}
21+
]
22+
23+
const router = new VueRouter({
24+
mode: 'history',
25+
base: process.env.BASE_URL,
26+
routes
27+
})
28+
29+
export default router

src/shims-tsx.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Vue, { VNode } from 'vue'
2+
3+
declare global {
4+
namespace JSX {
5+
// tslint:disable no-empty-interface
6+
interface Element extends VNode {}
7+
// tslint:disable no-empty-interface
8+
interface ElementClass extends Vue {}
9+
interface IntrinsicElements {
10+
[elem: string]: any
11+
}
12+
}
13+
}

src/shims-vue.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.vue' {
2+
import Vue from 'vue'
3+
export default Vue
4+
}

src/store/index.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Vue from 'vue'
2+
import Vuex from 'vuex'
3+
4+
Vue.use(Vuex)
5+
6+
export default new Vuex.Store({
7+
state: {
8+
},
9+
mutations: {
10+
},
11+
actions: {
12+
},
13+
modules: {
14+
}
15+
})

src/views/About.vue

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div class="about">
3+
<h1>This is an about page</h1>
4+
</div>
5+
</template>

src/views/Home.vue

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div class="home">
3+
<img alt="Vue logo" src="../assets/logo.png">
4+
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
5+
</div>
6+
</template>
7+
8+
<script lang="ts">
9+
import { Component, Vue } from 'vue-property-decorator';
10+
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
11+
12+
@Component({
13+
components: {
14+
HelloWorld,
15+
},
16+
})
17+
export default class Home extends Vue {}
18+
</script>

tests/unit/example.spec.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import HelloWorld from '@/components/HelloWorld.vue'
3+
4+
describe('HelloWorld.vue', () => {
5+
it('renders props.msg when passed', () => {
6+
const msg = 'new message'
7+
const wrapper = shallowMount(HelloWorld, {
8+
propsData: { msg }
9+
})
10+
expect(wrapper.text()).toMatch(msg)
11+
})
12+
})

0 commit comments

Comments
 (0)