Skip to content

Commit 6dd59ec

Browse files
committed
init
0 parents  commit 6dd59ec

19 files changed

+9775
-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

.editorconfig

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*.{js,jsx,ts,tsx,vue}]
2+
indent_style = space
3+
indent_size = 2
4+
end_of_line = lf
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
max_line_length = 100

.eslintrc.js

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

.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+
# vue-base-template
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+
};

package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "vue-base-template",
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-router": "^3.2.0",
15+
"vuex": "^3.4.0"
16+
},
17+
"devDependencies": {
18+
"@vue/cli-plugin-babel": "~4.5.0",
19+
"@vue/cli-plugin-eslint": "~4.5.0",
20+
"@vue/cli-plugin-router": "~4.5.0",
21+
"@vue/cli-plugin-unit-mocha": "~4.5.0",
22+
"@vue/cli-plugin-vuex": "~4.5.0",
23+
"@vue/cli-service": "~4.5.0",
24+
"@vue/eslint-config-airbnb": "^5.0.2",
25+
"@vue/test-utils": "^1.0.3",
26+
"babel-eslint": "^10.1.0",
27+
"chai": "^4.1.2",
28+
"eslint": "^6.7.2",
29+
"eslint-plugin-import": "^2.20.2",
30+
"eslint-plugin-vue": "^6.2.2",
31+
"sass": "^1.26.5",
32+
"sass-loader": "^8.0.2",
33+
"vue-template-compiler": "^2.6.11"
34+
}
35+
}

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

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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-mocha" target="_blank" rel="noopener">unit-mocha</a></li>
16+
</ul>
17+
<h3>Essential Links</h3>
18+
<ul>
19+
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
20+
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
21+
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
22+
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
23+
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
24+
</ul>
25+
<h3>Ecosystem</h3>
26+
<ul>
27+
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
28+
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
29+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
30+
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
31+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
32+
</ul>
33+
</div>
34+
</template>
35+
36+
<script>
37+
export default {
38+
name: 'HelloWorld',
39+
props: {
40+
msg: String,
41+
},
42+
};
43+
</script>
44+
45+
<!-- Add "scoped" attribute to limit CSS to this component only -->
46+
<style scoped lang="scss">
47+
h3 {
48+
margin: 40px 0 0;
49+
}
50+
ul {
51+
list-style-type: none;
52+
padding: 0;
53+
}
54+
li {
55+
display: inline-block;
56+
margin: 0 10px;
57+
}
58+
a {
59+
color: #42b983;
60+
}
61+
</style>

src/main.js

+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.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Vue from 'vue';
2+
import VueRouter from 'vue-router';
3+
import Home from '../views/Home.vue';
4+
5+
Vue.use(VueRouter);
6+
7+
const routes = [
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+
routes,
25+
});
26+
27+
export default router;

src/store/index.js

+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 App"/>
5+
</div>
6+
</template>
7+
8+
<script>
9+
// @ is an alias to /src
10+
import HelloWorld from '@/components/HelloWorld.vue';
11+
12+
export default {
13+
name: 'Home',
14+
components: {
15+
HelloWorld,
16+
},
17+
};
18+
</script>

tests/unit/example.spec.js

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

0 commit comments

Comments
 (0)