Skip to content

Commit dd46fd1

Browse files
committed
init
0 parents  commit dd46fd1

File tree

11 files changed

+7562
-0
lines changed

11 files changed

+7562
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
coverage
3+
dist
4+
poi.config.js
5+
output_test

.eslintrc.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
parser: 'babel-eslint',
5+
sourceType: 'module',
6+
ecmaVersion: 2017,
7+
ecmaFeatures: {
8+
jsx: true
9+
},
10+
},
11+
env: {
12+
browser: true,
13+
es6: true,
14+
jest: true,
15+
},
16+
extends: [
17+
'eslint:recommended',
18+
'plugin:vue/recommended',
19+
'plugin:import/errors',
20+
'plugin:import/warnings',
21+
],
22+
plugins: [
23+
'vue',
24+
'import'
25+
],
26+
rules: {
27+
// don't require .vue extension when importing
28+
'import/extensions': ['error', 'always', {
29+
'js': 'never',
30+
'vue': 'never'
31+
}],
32+
// allow debugger during development
33+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
34+
// no console.log, but can use .warn and .error.
35+
'no-console': ['error', { allow: ['warn', 'error'] }],
36+
// disallow indentation using both tabs and spaces
37+
'no-mixed-spaces-and-tabs': 2,
38+
// ensure consistent 2 space indentation and indent cases under switch
39+
'indent': [2, 2, {'SwitchCase': 1}],
40+
// allow paren-less arrow functions
41+
'arrow-parens': 0,
42+
// allow async-await
43+
'generator-star-spacing': 0,
44+
// trailing comma
45+
'comma-dangle': [2,'always'],
46+
// semicolons
47+
'semi': [2, 'always'],
48+
},
49+
settings: {
50+
'import/resolver': {
51+
webpack:{
52+
config: {
53+
resolve: {
54+
extensions: ['.js', '.vue']
55+
}
56+
}
57+
}
58+
}
59+
}
60+
};

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
node_modules/
3+
.vscode/
4+
npm-debug.log
5+
coverage
6+
dist/
7+
output_test/
8+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 greyby
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Vue from 'vue';
2+
import VueTagAutocomplete from './src/VueTagAutocomplete';
3+
4+
new Vue({
5+
el: '#app',
6+
components: {
7+
VueTagAutocomplete,
8+
},
9+
render() {
10+
return (
11+
<div>
12+
<VueTagAutocomplete/>
13+
</div>
14+
);
15+
},
16+
});

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "vue-tag-autocomplete",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "poi",
8+
"build": "poi build --format umd || poi build --component",
9+
"test": "poi test && jest output_test/test.js",
10+
"test:update": "poi test && jest output_test/test.js -u",
11+
"lint": "eslint --fix . --ext .vue --ext .js",
12+
"lint:check": "eslint . --ext .vue --ext .js"
13+
},
14+
"author": "Lucien Lee",
15+
"license": "MIT",
16+
"devDependencies": {
17+
"babel-eslint": "^8.0.3",
18+
"eslint": "^4.0.0",
19+
"eslint-import-resolver-webpack": "^0.8.3",
20+
"eslint-loader": "^1.9.0",
21+
"eslint-plugin-import": "^2.8.0",
22+
"eslint-plugin-vue": "^4.0.0-beta.2",
23+
"jest": "^21.2.1",
24+
"jest-serializer-vue": "^0.3.0",
25+
"node-sass": "^4.7.2",
26+
"poi": "^9.5.10",
27+
"poi-preset-eslint": "^9.0.1",
28+
"poi-preset-transform-test-files": "^9.0.3",
29+
"sass-loader": "^6.0.6",
30+
"vue-test-utils": "^1.0.0-beta.7"
31+
},
32+
"peerDependencies": {
33+
"vue": "^2.5.9"
34+
},
35+
"dependencies": {},
36+
"jest": {
37+
"snapshotSerializers": [
38+
"<rootDir>/node_modules/jest-serializer-vue"
39+
]
40+
}
41+
}

poi.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const componentName = 'VueTagAutocomplete';
2+
3+
const camelToKebab = str => str
4+
.replace(/(^[A-Z])/, ([first]) => first.toLowerCase())
5+
.replace(/([A-Z])/g, ([letter]) => `-${letter.toLowerCase()}`);
6+
7+
module.exports = options => {
8+
const { mode, component } = options;
9+
10+
const basic = {
11+
12+
};
13+
14+
if (options.mode === 'development') {
15+
return {
16+
...basic,
17+
entry: './index.js',
18+
};
19+
}
20+
21+
if (options.mode === 'test') {
22+
return {
23+
presets: [
24+
require('poi-preset-transform-test-files')(),
25+
]
26+
}
27+
}
28+
29+
// production, build as component
30+
return {
31+
...basic,
32+
entry: {
33+
[camelToKebab(componentName)]: `./src/${componentName}.vue`
34+
},
35+
filename: {
36+
js: '[name].js',
37+
css: '[name].css'
38+
},
39+
presets: [
40+
require('poi-preset-eslint')(),
41+
],
42+
html: false,
43+
moduleName: componentName,
44+
extractCSS: !options.component,
45+
component: options.component,
46+
};
47+
};

src/VueTagAutocomplete.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<div>
3+
<h1>{{ name }}</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: "Vue",
10+
data () {
11+
return {
12+
name: 'World',
13+
};
14+
},
15+
mounted() {
16+
},
17+
};
18+
</script>
19+
20+
<style scoped>
21+
h1 {
22+
color:aqua;
23+
}
24+
</style>
25+

test/VueTagAutocomplete.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount, } from 'vue-test-utils';
2+
import VueTagAutocomplete from '../src/VueTagAutocomplete';
3+
4+
describe('Component', () => {
5+
test('is a Vue instance', () => {
6+
const wrapper = mount(VueTagAutocomplete);
7+
expect(wrapper.isVueInstance()).toBeTruthy();
8+
});
9+
10+
it('has the expected html structure', () => {
11+
const wrapper = mount(VueTagAutocomplete);
12+
expect(wrapper.element).toMatchSnapshot();
13+
});
14+
});

0 commit comments

Comments
 (0)