add vuejs wrapper for component.

This commit is contained in:
Miroslav Šedivý 2021-01-21 16:01:23 +01:00
parent c48caf32eb
commit 1def45f2a1
3 changed files with 29 additions and 11 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@demodesk/neko", "name": "@demodesk/neko",
"version": "0.1.1", "version": "1.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -2,15 +2,6 @@
"name": "@demodesk/neko", "name": "@demodesk/neko",
"version": "1.1.0", "version": "1.1.0",
"description": "Client as reusable Vue.js component for neko streaming server.", "description": "Client as reusable Vue.js component for neko streaming server.",
"main": "dist/neko.umd.js",
"module": "dist/neko.common.js",
"unpkg": "dist/neko.min.js",
"files": [
"dist/*"
],
"browser": {
"./sfc": "src/component/main.vue"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gitlab.com/demodesk/neko/client.git" "url": "https://gitlab.com/demodesk/neko/client.git"
@ -18,10 +9,12 @@
"bugs": { "bugs": {
"url": "https://gitlab.com/demodesk/neko/client/-/issues" "url": "https://gitlab.com/demodesk/neko/client/-/issues"
}, },
"main": "dist/neko.umd.js",
"module": "dist/neko.common.js",
"scripts": { "scripts": {
"serve": "vue-cli-service serve --mode development", "serve": "vue-cli-service serve --mode development",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"build": "vue-cli-service build --target lib --name neko ./src/component/main.vue" "build": "vue-cli-service build --target lib --name neko ./src/index.ts"
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.1", "@fortawesome/fontawesome-free": "^5.15.1",
@ -55,6 +48,9 @@
"typescript": "^4.0.5", "typescript": "^4.0.5",
"vue-template-compiler": "^2.6.12" "vue-template-compiler": "^2.6.12"
}, },
"files": [
"dist/*"
],
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions" "last 2 versions"

22
src/index.ts Normal file
View File

@ -0,0 +1,22 @@
import Vue from 'vue';
import Neko from './component/main.vue'
/**
* Fügt eine "install" function hinzu
*
* Weitere Infos:
* https://vuejs.org/v2/cookbook/packaging-sfc-for-npm.html#Packaging-Components-for-npm
*/
const NekoElements = {
install(vue: typeof Vue): void {
vue.component('Neko', Neko);
},
};
if (typeof window !== 'undefined' && window.Vue) {
// @ts-ignore
window.Vue.use(NekoElements, {});
}
export { Neko };
export default NekoElements;