Skip to content

Commit 55480a1

Browse files
committed
init
0 parents  commit 55480a1

20 files changed

+10059
-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 ie <= 8

.eslintrc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
extends: ["plugin:vue/essential", "@vue/prettier"],
7+
rules: {
8+
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9+
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
10+
},
11+
parserOptions: {
12+
parser: "babel-eslint"
13+
}
14+
};

.gitignore

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

README.md

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

babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ["@vue/app"]
3+
};

jest.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
moduleFileExtensions: ["js", "jsx", "json", "vue"],
3+
transform: {
4+
"^.+\\.vue$": "vue-jest",
5+
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
6+
"jest-transform-stub",
7+
"^.+\\.jsx?$": "babel-jest"
8+
},
9+
moduleNameMapper: {
10+
"^@/(.*)$": "<rootDir>/src/$1"
11+
},
12+
snapshotSerializers: ["jest-serializer-vue"],
13+
testMatch: [
14+
"**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"
15+
],
16+
testURL: "http://localhost/"
17+
};

package.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "hswi5",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint",
9+
"test:unit": "vue-cli-service test:unit"
10+
},
11+
"dependencies": {
12+
"vue": "^2.5.22",
13+
"vue-router": "^3.0.1"
14+
},
15+
"devDependencies": {
16+
"@vue/cli-plugin-babel": "^3.4.0",
17+
"@vue/cli-plugin-eslint": "^3.4.0",
18+
"@vue/cli-plugin-unit-jest": "^3.4.0",
19+
"@vue/cli-service": "^3.4.0",
20+
"@vue/eslint-config-prettier": "^4.0.1",
21+
"@vue/test-utils": "^1.0.0-beta.20",
22+
"babel-core": "7.0.0-bridge.0",
23+
"babel-eslint": "^10.0.1",
24+
"babel-jest": "^23.6.0",
25+
"eslint": "^5.8.0",
26+
"eslint-plugin-vue": "^5.0.0",
27+
"fibers": "^3.1.1",
28+
"sass": "^1.16.0",
29+
"sass-loader": "^7.1.0",
30+
"vue-template-compiler": "^2.5.21"
31+
}
32+
}

postcss.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: {
3+
autoprefixer: {}
4+
}
5+
};

public/favicon.ico

1.12 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>hswi5</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but hswi5 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

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
#nav {
20+
padding: 30px;
21+
a {
22+
font-weight: bold;
23+
color: #2c3e50;
24+
&.router-link-exact-active {
25+
color: #42b983;
26+
}
27+
}
28+
}
29+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/HelloWorld.vue

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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"
8+
>vue-cli documentation</a
9+
>.
10+
</p>
11+
<h3>Installed CLI Plugins</h3>
12+
<ul>
13+
<li>
14+
<a
15+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
16+
target="_blank"
17+
rel="noopener"
18+
>babel</a
19+
>
20+
</li>
21+
<li>
22+
<a
23+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
24+
target="_blank"
25+
rel="noopener"
26+
>eslint</a
27+
>
28+
</li>
29+
<li>
30+
<a
31+
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest"
32+
target="_blank"
33+
rel="noopener"
34+
>unit-jest</a
35+
>
36+
</li>
37+
</ul>
38+
<h3>Essential Links</h3>
39+
<ul>
40+
<li>
41+
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
42+
</li>
43+
<li>
44+
<a href="https://forum.vuejs.org" target="_blank" rel="noopener"
45+
>Forum</a
46+
>
47+
</li>
48+
<li>
49+
<a href="https://chat.vuejs.org" target="_blank" rel="noopener"
50+
>Community Chat</a
51+
>
52+
</li>
53+
<li>
54+
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener"
55+
>Twitter</a
56+
>
57+
</li>
58+
<li>
59+
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
60+
</li>
61+
</ul>
62+
<h3>Ecosystem</h3>
63+
<ul>
64+
<li>
65+
<a href="https://router.vuejs.org" target="_blank" rel="noopener"
66+
>vue-router</a
67+
>
68+
</li>
69+
<li>
70+
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
71+
</li>
72+
<li>
73+
<a
74+
href="https://github.com/vuejs/vue-devtools#vue-devtools"
75+
target="_blank"
76+
rel="noopener"
77+
>vue-devtools</a
78+
>
79+
</li>
80+
<li>
81+
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener"
82+
>vue-loader</a
83+
>
84+
</li>
85+
<li>
86+
<a
87+
href="https://github.com/vuejs/awesome-vue"
88+
target="_blank"
89+
rel="noopener"
90+
>awesome-vue</a
91+
>
92+
</li>
93+
</ul>
94+
</div>
95+
</template>
96+
97+
<script>
98+
export default {
99+
name: "HelloWorld",
100+
props: {
101+
msg: String
102+
}
103+
};
104+
</script>
105+
106+
<!-- Add "scoped" attribute to limit CSS to this component only -->
107+
<style scoped lang="scss">
108+
h3 {
109+
margin: 40px 0 0;
110+
}
111+
ul {
112+
list-style-type: none;
113+
padding: 0;
114+
}
115+
li {
116+
display: inline-block;
117+
margin: 0 10px;
118+
}
119+
a {
120+
color: #42b983;
121+
}
122+
</style>

src/main.js

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

src/router.js

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

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/.eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
env: {
3+
jest: true
4+
}
5+
};

tests/unit/example.spec.js

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