Skip to content

Commit c8da4a7

Browse files
committed
all
0 parents  commit c8da4a7

22 files changed

+10972
-0
lines changed

.babelrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"browsers": ["last 2 versions", "safari >= 7"]
6+
},
7+
"modules": "umd"
8+
}]
9+
],
10+
"plugins": [
11+
"transform-object-rest-spread",
12+
["transform-runtime", {
13+
"polyfill": false,
14+
"regenerator": true
15+
}]
16+
]
17+
}

.circleci/config.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/node:7.10
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/mongo:3.4.4
16+
17+
working_directory: ~/repo
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
keys:
25+
- v1-dependencies-{{ checksum "package.json" }}
26+
# fallback to using the latest cache if no exact match is found
27+
- v1-dependencies-
28+
29+
- run: yarn install
30+
31+
- save_cache:
32+
paths:
33+
- node_modules
34+
key: v1-dependencies-{{ checksum "package.json" }}
35+
36+
# run tests!
37+
- run: yarn test
38+
39+

.eslintrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"rules": {
4+
"indent": ["error", 4],
5+
"no-undef": "off",
6+
"no-console": "off"
7+
},
8+
"parserOptions": {
9+
"ecmaVersion": 6,
10+
"sourceType": "module"
11+
},
12+
"env": {
13+
"browser": true,
14+
"node": true
15+
}
16+
}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/dist
2+
node_modules
3+
npm-debug.log
4+
yarn.lock
5+
package.lock
6+
.DS_Store

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
__tests__

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
All notable changes to `vue-csv-import` will be documented in this file
4+
5+
## 1.0.0
6+
- Initial release

LICENSE.md

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

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Vue.js component to handle CSV uploads with field mapping.
2+
3+
[![Latest Version on NPM](https://img.shields.io/npm/v/vue-csv-import.svg?style=flat-square)](https://npmjs.com/package/vue-csv-import)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
[![CircleCI](https://circleci.com/gh/jgile/vue-csv-import.svg?style=svg)](https://circleci.com/gh/jgile/vue-csv-import)
6+
7+
Add a short description here, with some examples on how the package can be used.
8+
9+
## Demo
10+
11+
Add a link to a site where the component is being demonstrated live.
12+
13+
## Installation
14+
15+
You can install the package via yarn:
16+
17+
```bash
18+
yarn add vue-csv-import
19+
```
20+
21+
or npm:
22+
23+
```bash
24+
npm install vue-csv-import --save
25+
```
26+
27+
## Usage
28+
29+
Add instruction on how the package can be used
30+
31+
### Testing
32+
33+
```bash
34+
yarn test
35+
```
36+
37+
### Changelog
38+
39+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
40+
41+
### Security
42+
43+
If you discover any security related issues, please contact John Gile.
44+
45+
## License
46+
47+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
48+
49+
## Credits
50+
51+
- [John Gile](https://github.com/jgile)
52+
- [All Contributors](../../contributors)

__tests__/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"jest": true
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`VueCsvImport can mount 1`] = `
4+
"
5+
<div id=\\"app\\"><div class=\\"vue-csv-uploader\\"><div class=\\"form\\"><div class=\\"form-check\\"><input type=\\"checkbox\\" id=\\"hasHeaders\\" class=\\"form-check-input\\"> <label for=\\"hasHeaders\\" class=\\"form-check-label\\">
6+
Has Headers
7+
</label></div> <div class=\\"form-group\\"><input type=\\"file\\" name=\\"csv\\" class=\\"form-control\\"></div> <div class=\\"form-group\\"><input type=\\"submit\\" class=\\"btn btn-default\\"></div> <!----></div></div></div>
8+
"
9+
`;

__tests__/vueCsvImport.test.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { VueCsvImport } from '../src';
2+
import Vue from 'vue/dist/vue.js';
3+
4+
describe('VueCsvImport', () => {
5+
Vue.component('vue-csv-import', VueCsvImport);
6+
7+
beforeEach(() => {
8+
document.body.innerHTML = `
9+
<div id="app">
10+
<vue-csv-import :map-fields="['one', 'two', 'three']" url="/hello"></vue-csv-import>
11+
</div>
12+
`;
13+
});
14+
15+
it('can mount', async () => {
16+
await createVm();
17+
18+
expect(document.body.innerHTML).toMatchSnapshot();
19+
});
20+
});
21+
22+
async function createVm() {
23+
const vm = new Vue({
24+
el: '#app',
25+
});
26+
27+
await Vue.nextTick(() => {});
28+
29+
return { app: vm, component: vm.$children[0] };
30+
}

docs/MOCK_DATA.csv

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name,date,home
2+
Home Ing,2/9/2018,false
3+
Y-find,8/4/2017,true
4+
Zamit,5/31/2017,false
5+
Duobam,4/13/2017,true
6+
Solarbreeze,8/1/2017,true
7+
Domainer,8/14/2017,true
8+
Zoolab,1/2/2018,true
9+
Toughjoyfax,2/9/2018,true
10+
Flowdesk,7/15/2017,false
11+
Lotlux,6/11/2017,false
12+
Holdlamis,11/18/2017,true
13+
Voyatouch,8/1/2017,false
14+
Tres-Zap,11/7/2017,false
15+
Toughjoyfax,5/4/2017,false
16+
Y-find,4/12/2017,true
17+
Redhold,9/1/2017,false
18+
Voyatouch,7/21/2017,false
19+
Wrapsafe,5/25/2017,false
20+
Tres-Zap,12/19/2017,false
21+
Konklab,9/2/2017,false
22+
Job,11/6/2017,true
23+
Stim,11/11/2017,true
24+
Vagram,1/2/2018,false
25+
Konklab,8/30/2017,true
26+
Tresom,1/20/2018,false
27+
Quo Lux,9/20/2017,false
28+
Tin,9/25/2017,false
29+
Veribet,1/21/2018,true
30+
Holdlamis,3/16/2018,false
31+
Redhold,3/2/2018,true
32+
Fintone,3/24/2018,false
33+
Viva,8/25/2017,false
34+
Voltsillam,7/20/2017,false
35+
Pannier,1/28/2018,true
36+
Cookley,12/7/2017,false
37+
Zaam-Dox,11/21/2017,false
38+
Regrant,11/28/2017,false
39+
Cookley,7/3/2017,false
40+
Otcom,5/29/2017,false
41+
Fintone,3/26/2018,false
42+
Prodder,11/3/2017,true
43+
Andalax,5/10/2017,true
44+
Duobam,5/19/2017,true
45+
Span,11/4/2017,true
46+
Bytecard,2/13/2018,false
47+
Otcom,1/5/2018,false
48+
Gembucket,11/22/2017,false
49+
Voyatouch,12/22/2017,false
50+
Zamit,8/18/2017,true
51+
Redhold,10/11/2017,true

docs/app.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Vue from 'vue';
2+
import { VueCsvImport } from '../src';
3+
4+
new Vue({
5+
components: { VueCsvImport },
6+
7+
el: '#app',
8+
});

docs/build/app.js

+162
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<html>
2+
<head>
3+
<title>vue-csv-import</title>
4+
5+
<style>
6+
7+
*,
8+
*:after,
9+
*:before {
10+
box-sizing: border-box;
11+
margin: 0;
12+
padding: 0;
13+
}
14+
15+
body {
16+
background-color: #efefef;
17+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
18+
font-size: 16px;
19+
padding: 2em;
20+
}
21+
22+
.page {
23+
background-color: #fff;
24+
max-width: 66em;
25+
margin: 0 auto;
26+
padding: 4em 2em;
27+
}
28+
29+
</style>
30+
31+
</head>
32+
<body>
33+
<div id="app" class="page">
34+
<div>
35+
<vue-csv-import url="/hello" :map-fields="['date','name','home']"></vue-csv-import>
36+
</div>
37+
</div>
38+
<script src="/build/app.js"></script>
39+
</body>
40+
</html>

docs/webpack.config.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const path = require('path');
2+
const merge = require('webpack-merge');
3+
4+
module.exports = merge(require('../webpack.base'), {
5+
context: __dirname,
6+
7+
entry: './app.js',
8+
9+
output: {
10+
path: path.resolve(__dirname, 'build'),
11+
filename: 'app.js',
12+
publicPath: '/build/',
13+
},
14+
15+
resolve: {
16+
alias: {
17+
vue: 'vue/dist/vue.js',
18+
},
19+
},
20+
21+
devServer: {
22+
contentBase: __dirname,
23+
port: 2000,
24+
},
25+
});

0 commit comments

Comments
 (0)