From 1def45f2a1a9128a4c0497bc852cb98067bbed91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 21 Jan 2021 16:01:23 +0100 Subject: [PATCH] add vuejs wrapper for component. --- package-lock.json | 2 +- package.json | 16 ++++++---------- src/index.ts | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 src/index.ts diff --git a/package-lock.json b/package-lock.json index 0dbee7a3..31bda3cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@demodesk/neko", - "version": "0.1.1", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1ee302b0..7db72147 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,6 @@ "name": "@demodesk/neko", "version": "1.1.0", "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": { "type": "git", "url": "https://gitlab.com/demodesk/neko/client.git" @@ -18,10 +9,12 @@ "bugs": { "url": "https://gitlab.com/demodesk/neko/client/-/issues" }, + "main": "dist/neko.umd.js", + "module": "dist/neko.common.js", "scripts": { "serve": "vue-cli-service serve --mode development", "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": { "@fortawesome/fontawesome-free": "^5.15.1", @@ -55,6 +48,9 @@ "typescript": "^4.0.5", "vue-template-compiler": "^2.6.12" }, + "files": [ + "dist/*" + ], "browserslist": [ "> 1%", "last 2 versions" diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..d3f5a92c --- /dev/null +++ b/src/index.ts @@ -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;