From 6193324e89ec75125d00ae32e4ff5ae768ade0c2 Mon Sep 17 00:00:00 2001 From: Jarek Rozanski Date: Tue, 16 May 2023 20:01:42 +0000 Subject: [PATCH] Support for TypeScript Modules --- index.js | 6 +++--- package-lock.json | 37 ++++++++++++++++++++++++++++++++++ package.json | 9 ++++++++- sample/vue-sample/package.json | 2 +- tsconfig.json | 14 +++++++++++++ 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 package-lock.json create mode 100644 tsconfig.json diff --git a/index.js b/index.js index dfb0b1a..a54b8e5 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,12 @@ -import { initWideAngle } from "./src"; +import { initWideAngle } from "./dist"; import { ref } from 'vue'; export default { install: async (app, options) => { const waaRef = ref() - app.provide('waa', waaRef); + app.provide('waa', waaRef); initWideAngle(options) - .then(waa => { + .then(waa => { waaRef.value = waa; console.debug("[WAA] Wide Angle Analytics instance available"); }) diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d422b80 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,37 @@ +{ + "name": "wideangle-vuejs", + "version": "0.0.3", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "wideangle-vuejs", + "version": "0.0.3", + "license": "Apache-2.0", + "devDependencies": { + "typescript": "^5.0.4" + } + }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + } + }, + "dependencies": { + "typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true + } + } +} diff --git a/package.json b/package.json index 6c30d36..006100f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "repository": "github:inputobjects/wideangle-vuejs", "main": "index.js", "scripts": { + "build": "tsc -p tsconfig.json", + "clear": "rimraf dist", + "rebuild": "npm run clear && npm run build", + "prepublishOnly": "npm run rebuild" }, "keywords": [ "wide angle analytics", @@ -16,5 +20,8 @@ "vuejs plugin" ], "author": "Wide Angle Analytics ", - "license": "Apache-2.0" + "license": "Apache-2.0", + "devDependencies": { + "typescript": "^5.0.4" + } } diff --git a/sample/vue-sample/package.json b/sample/vue-sample/package.json index cc7d528..2f07364 100644 --- a/sample/vue-sample/package.json +++ b/sample/vue-sample/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "dev": "vite", + "dev": "vite --host 0.0.0.0", "build": "vite build", "preview": "vite preview" }, diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c8b7297 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "include": ["src/**/*"], + "compilerOptions": { + "target": "es2016", + // "module": "commonjs", + "declaration": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "allowJs": true, + "outDir": "dist", + "skipLibCheck": true + } +}