Skip to content

Commit 63932cb

Browse files
committedJul 29, 2018
init
0 parents  commit 63932cb

16 files changed

+12325
-0
lines changed
 

‎.eslintrc.js

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

‎.gitignore

Lines changed: 21 additions & 0 deletions
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*

‎.postcssrc.js

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

‎package-lock.json

Lines changed: 12037 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "vue-test-utils-typescript-example",
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": "jest"
10+
},
11+
"dependencies": {
12+
"vue": "^2.5.16"
13+
},
14+
"devDependencies": {
15+
"@vue/cli-plugin-typescript": "^3.0.0-rc.9",
16+
"@vue/cli-service": "^3.0.0-rc.9",
17+
"@vue/test-utils": "^1.0.0-beta.22",
18+
"jest": "^23.4.2",
19+
"ts-jest": "^23.0.1",
20+
"typescript": "^2.9.0",
21+
"vue-jest": "^2.6.0",
22+
"vue-template-compiler": "^2.5.16"
23+
},
24+
"postcss": {
25+
"plugins": {
26+
"autoprefixer": {}
27+
}
28+
},
29+
"browserslist": [
30+
"> 1%",
31+
"last 2 versions",
32+
"not ie <= 8"
33+
],
34+
"jest": {
35+
"moduleFileExtensions": [
36+
"js",
37+
"ts",
38+
"json",
39+
"vue"
40+
],
41+
"transform": {
42+
".*\\.(vue)$": "vue-jest",
43+
"^.+\\.tsx?$": "ts-jest"
44+
},
45+
"testURL": "http://localhost/",
46+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$"
47+
}
48+
}

‎public/favicon.ico

1.12 KB
Binary file not shown.

‎public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
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>vue-test-utils-typescript-example</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but vue-test-utils-typescript-example 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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<div id="app">
3+
<img 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 Vue from 'vue';
10+
import HelloWorld from './components/HelloWorld.vue';
11+
12+
export default Vue.extend({
13+
name: 'app',
14+
components: {
15+
HelloWorld,
16+
},
17+
});
18+
</script>
19+
20+
<style>
21+
#app {
22+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
23+
-webkit-font-smoothing: antialiased;
24+
-moz-osx-font-smoothing: grayscale;
25+
text-align: center;
26+
color: #2c3e50;
27+
margin-top: 60px;
28+
}
29+
</style>

‎src/assets/logo.png

6.69 KB
Loading

‎src/components/HelloWorld.vue

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<p>
5+
For guide and recipes on how to configure / customize this project,<br>
6+
check out the
7+
<a href="https://cli.vuejs.org" target="_blank">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-typescript" target="_blank">typescript</a></li>
12+
</ul>
13+
<h3>Essential Links</h3>
14+
<ul>
15+
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
16+
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
17+
<li><a href="https://chat.vuejs.org" target="_blank">Community Chat</a></li>
18+
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
19+
<li><a href="https://news.vuejs.org" target="_blank">News</a></li>
20+
</ul>
21+
<h3>Ecosystem</h3>
22+
<ul>
23+
<li><a href="https://router.vuejs.org" target="_blank">vue-router</a></li>
24+
<li><a href="https://vuex.vuejs.org" target="_blank">vuex</a></li>
25+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank">vue-devtools</a></li>
26+
<li><a href="https://vue-loader.vuejs.org" target="_blank">vue-loader</a></li>
27+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
28+
</ul>
29+
</div>
30+
</template>
31+
32+
<script lang="ts">
33+
import Vue from 'vue';
34+
35+
export default Vue.extend({
36+
name: 'HelloWorld',
37+
props: {
38+
msg: String,
39+
},
40+
});
41+
</script>
42+
43+
<!-- Add "scoped" attribute to limit CSS to this component only -->
44+
<style scoped>
45+
h3 {
46+
margin: 40px 0 0;
47+
}
48+
ul {
49+
list-style-type: none;
50+
padding: 0;
51+
}
52+
li {
53+
display: inline-block;
54+
margin: 0 10px;
55+
}
56+
a {
57+
color: #42b983;
58+
}
59+
</style>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { shallowMount } from '@vue/test-utils';
2+
import HelloWorld from '../HelloWorld.vue';
3+
4+
describe('HelloWorld.vue', () => {
5+
test('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+
});

‎src/main.ts

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

‎src/shims-tsx.d.ts

Lines changed: 13 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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+
}

‎tsconfig.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "esnext",
5+
"strict": true,
6+
"jsx": "preserve",
7+
"importHelpers": true,
8+
"moduleResolution": "node",
9+
"esModuleInterop": true,
10+
"sourceMap": true,
11+
"baseUrl": ".",
12+
"types": [
13+
"node" ],
14+
"paths": {
15+
"@/*": [
16+
"src/*"
17+
]
18+
},
19+
"lib": [
20+
"es2015",
21+
"dom",
22+
"dom.iterable",
23+
"scripthost"
24+
]
25+
},
26+
"include": [
27+
"src/**/*.ts",
28+
"src/**/*.tsx",
29+
"src/**/*.vue",
30+
"tests/**/*.ts",
31+
"tests/**/*.tsx"
32+
],
33+
"exclude": [
34+
"node_modules"
35+
]
36+
}

‎tslint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"defaultSeverity": "warning",
3+
"extends": [
4+
"tslint:recommended"
5+
],
6+
"linterOptions": {
7+
"exclude": [
8+
"node_modules/**"
9+
]
10+
},
11+
"rules": {
12+
"quotemark": [true, "single"],
13+
"indent": [true, "spaces", 2],
14+
"interface-name": false,
15+
"ordered-imports": false,
16+
"object-literal-sort-keys": false,
17+
"no-consecutive-blank-lines": false
18+
}
19+
}

0 commit comments

Comments
 (0)
Please sign in to comment.