Skip to content

Commit 93bb3d4

Browse files
committed
[DEV]: Initialize repo with existing state
1 parent df62bbe commit 93bb3d4

18 files changed

+8356
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
["es2015", { "modules": false }],
4+
"stage-0"
5+
]
6+
}

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist/

.eslintrc.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
parserOptions: {
5+
sourceType: 'module'
6+
},
7+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8+
extends: 'standard',
9+
// required to lint *.vue files
10+
plugins: [
11+
'html'
12+
],
13+
env: {
14+
browser: true,
15+
},
16+
// add your custom rules here
17+
'rules': {
18+
// allow paren-less arrow functions
19+
'arrow-parens': 0,
20+
// allow async-await
21+
'generator-star-spacing': 0,
22+
// allow debugger during development
23+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
24+
// trailing comma
25+
'comma-dangle': ['error', 'always-multiline'],
26+
}
27+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

README.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# vue-typed-js
2+
3+
[![npm](https://img.shields.io/npm/v/vue-typed-js.svg) ![npm](https://img.shields.io/npm/dm/vue-typed-js.svg)](https://www.npmjs.com/package/vue-typed-js)
4+
[![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)
5+
6+
A Vue.js Plugin
7+
8+
## Table of contents
9+
10+
- [Installation](#installation)
11+
- [Usage](#usage)
12+
- [Example](#example)
13+
14+
# Installation
15+
16+
```
17+
npm install --save vue-typed-js
18+
```
19+
20+
## Default import
21+
22+
Install all the components:
23+
24+
```javascript
25+
import Vue from 'vue'
26+
import VueTypedJs from 'vue-typed-js'
27+
28+
Vue.use(VueTypedJs)
29+
```
30+
31+
Use specific components:
32+
33+
```javascript
34+
import Vue from 'vue'
35+
import { Test } from 'vue-typed-js'
36+
37+
Vue.component('test', Test)
38+
```
39+
40+
**⚠️ A css file is included when importing the package. You may have to setup your bundler to embed the css in your page.**
41+
42+
## Distribution import
43+
44+
Install all the components:
45+
46+
```javascript
47+
import 'vue-typed-js/dist/vue-typed-js.css'
48+
import VueTypedJs from 'vue-typed-js/dist/vue-typed-js.common'
49+
50+
Vue.use(VueTypedJs)
51+
```
52+
53+
Use specific components:
54+
55+
```javascript
56+
import 'vue-typed-js/dist/vue-typed-js.css'
57+
import { Test } from 'vue-typed-js/dist/vue-typed-js.common'
58+
59+
Vue.component('test', Test)
60+
```
61+
62+
**⚠️ You may have to setup your bundler to embed the css file in your page.**
63+
64+
## Browser
65+
66+
```html
67+
<link rel="stylesheet" href="vue-typed-js/dist/vue-typed-js.css"/>
68+
69+
<script src="vue.js"></script>
70+
<script src="vue-typed-js/dist/vue-typed-js.browser.js"></script>
71+
```
72+
73+
The plugin should be auto-installed. If not, you can install it manually with the instructions below.
74+
75+
Install all the components:
76+
77+
```javascript
78+
Vue.use(VueTypedJs)
79+
```
80+
81+
Use specific components:
82+
83+
```javascript
84+
Vue.component('test', VueTypedJs.Test)
85+
```
86+
87+
## Source import
88+
89+
Install all the components:
90+
91+
```javascript
92+
import Vue from 'vue'
93+
import VueTypedJs from 'vue-typed-js/src'
94+
95+
Vue.use(VueTypedJs)
96+
```
97+
98+
Use specific components:
99+
100+
```javascript
101+
import Vue from 'vue'
102+
import { Test } from 'vue-typed-js/src'
103+
104+
Vue.component('test', Test)
105+
```
106+
107+
**⚠️ You need to configure your bundler to compile `.vue` files.** More info [in the official documentation](https://vuejs.org/v2/guide/single-file-components.html).
108+
109+
# Usage
110+
111+
> TODO
112+
113+
# Example
114+
115+
> TODO
116+
117+
---
118+
119+
# Plugin Development
120+
121+
## Installation
122+
123+
The first time you create or clone your plugin, you need to install the default dependencies:
124+
125+
```
126+
npm install
127+
```
128+
129+
## Watch and compile
130+
131+
This will run webpack in watching mode and output the compiled files in the `dist` folder.
132+
133+
```
134+
npm run dev
135+
```
136+
137+
## Use it in another project
138+
139+
While developping, you can follow the install instructions of your plugin and link it into the project that uses it.
140+
141+
In the plugin folder:
142+
143+
```
144+
npm link
145+
```
146+
147+
In the other project folder:
148+
149+
```
150+
npm link vue-typed-js
151+
```
152+
153+
This will install it in the dependencies as a symlink, so that it gets any modifications made to the plugin.
154+
155+
## Publish to npm
156+
157+
You may have to login to npm before, with `npm adduser`. The plugin will be built in production mode before getting published on npm.
158+
159+
```
160+
npm publish
161+
```
162+
163+
## Manual build
164+
165+
This will build the plugin into the `dist` folder in production mode.
166+
167+
```
168+
npm run build
169+
```
170+
171+
---
172+
173+
## License
174+
175+
[MIT](http://opensource.org/licenses/MIT)

config/webpack.config.base.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var webpack = require('webpack')
2+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
3+
4+
var outputFile = 'vue-typed-js'
5+
var globalName = 'VueTypedJs'
6+
7+
var config = require('../package.json')
8+
9+
module.exports = {
10+
entry: './src/index.js',
11+
module: {
12+
rules: [
13+
{
14+
enforce: 'pre',
15+
test: /\.(js|vue)$/,
16+
loader: 'eslint-loader',
17+
exclude: /node_modules/,
18+
},
19+
{
20+
test: /.js$/,
21+
use: 'babel-loader',
22+
},
23+
{
24+
test: /\.vue$/,
25+
loader: 'vue-loader',
26+
options: {
27+
loaders: {
28+
css: ExtractTextPlugin.extract('css-loader'),
29+
sass: ExtractTextPlugin.extract('css-loader!sass-loader'),
30+
scss: ExtractTextPlugin.extract('css-loader!sass-loader'),
31+
},
32+
},
33+
},
34+
],
35+
},
36+
plugins: [
37+
new webpack.DefinePlugin({
38+
'VERSION': JSON.stringify(config.version),
39+
}),
40+
new ExtractTextPlugin(outputFile + '.css'),
41+
],
42+
}

config/webpack.config.browser.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var webpack = require('webpack')
2+
var merge = require('webpack-merge')
3+
var base = require('./webpack.config.base')
4+
var path = require('path')
5+
6+
var outputFile = 'vue-typed-js'
7+
var globalName = 'VueTypedJs'
8+
9+
module.exports = merge(base, {
10+
output: {
11+
path: path.resolve(__dirname, '../dist'),
12+
filename: outputFile + '.browser.js',
13+
library: globalName,
14+
libraryTarget: 'umd',
15+
},
16+
externals: {
17+
// Put external libraries like lodash here
18+
// With their global name
19+
// Example: 'lodash': '_'
20+
},
21+
plugins: [
22+
new webpack.optimize.UglifyJsPlugin({
23+
compress: {
24+
warnings: true,
25+
},
26+
mangle: false,
27+
}),
28+
],
29+
})

config/webpack.config.common.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var webpack = require('webpack')
2+
var merge = require('webpack-merge')
3+
var base = require('./webpack.config.base')
4+
var path = require('path')
5+
6+
var outputFile = 'vue-typed-js'
7+
var globalName = 'VueTypedJs'
8+
9+
module.exports = merge(base, {
10+
output: {
11+
path: path.resolve(__dirname, '../dist'),
12+
filename: outputFile + '.common.js',
13+
libraryTarget: 'commonjs2',
14+
},
15+
target: 'node',
16+
externals: {
17+
// Put external libraries like lodash here
18+
// With their package name
19+
// Example: 'lodash': 'lodash'
20+
},
21+
plugins: [
22+
new webpack.optimize.UglifyJsPlugin({
23+
compress: {
24+
warnings: true,
25+
},
26+
mangle: false,
27+
}),
28+
],
29+
})

config/webpack.config.dev.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var merge = require('webpack-merge')
2+
var base = require('./webpack.config.base')
3+
var path = require('path')
4+
5+
var outputFile = 'vue-typed-js'
6+
var globalName = 'VueTypedJs'
7+
8+
module.exports = merge(base, {
9+
output: {
10+
path: path.resolve(__dirname, '../dist'),
11+
filename: outputFile + '.common.js',
12+
library: globalName,
13+
libraryTarget: 'umd',
14+
},
15+
devtool: 'eval-source-map',
16+
})

dist/vue-typed-js.browser.js

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

0 commit comments

Comments
 (0)