feat: publish type definitions

This commit is contained in:
Ayo 2023-09-18 22:52:38 +02:00
parent b05941caca
commit b3892cf95d
8 changed files with 46 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
node_modules/
dist/
# temporary files # temporary files
*~ *~
*swo *swo

View file

@ -1,5 +1,6 @@
// @ts-check // @ts-check
import WebComponent from "../index.mjs";
import WebComponent from "../dist";
export class HelloWorld extends WebComponent { export class HelloWorld extends WebComponent {
name = "World"; name = "World";

View file

@ -1,5 +1,6 @@
// @ts-check // @ts-check
import WebComponent from "../index.mjs";
import WebComponent from "../dist/index";
class SimpleText extends WebComponent { class SimpleText extends WebComponent {
onInit() { onInit() {

View file

@ -1,3 +0,0 @@
import { WebComponent } from './WebComponent.mjs';
export default WebComponent;

29
package-lock.json generated Normal file
View file

@ -0,0 +1,29 @@
{
"name": "web-component-base",
"version": "1.6.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "web-component-base",
"version": "1.6.1",
"license": "MIT",
"devDependencies": {
"typescript": "^5.2.2"
}
},
"node_modules/typescript": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}

View file

@ -2,17 +2,17 @@
"name": "web-component-base", "name": "web-component-base",
"version": "1.6.1", "version": "1.6.1",
"description": "Minimal base class for creating reactive custom elements easily", "description": "Minimal base class for creating reactive custom elements easily",
"main": "index.mjs", "main": "index.d.ts",
"scripts": { "scripts": {
"start": "npx simple-server ." "start": "npx simple-server .",
"build": "tsc --allowJs src/* --outDir dist --declaration"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.sr.ht/~ayoayco/web-component-base" "url": "https://git.sr.ht/~ayoayco/web-component-base"
}, },
"files": [ "files": [
"index.mjs", "dist/*"
"WebComponent.mjs"
], ],
"keywords": [ "keywords": [
"web components", "web components",
@ -25,5 +25,8 @@
"bugs": { "bugs": {
"url": "https://todo.sr.ht/~ayoayco/web-component-base" "url": "https://todo.sr.ht/~ayoayco/web-component-base"
}, },
"homepage": "https://git.sr.ht/~ayoayco/web-component-base#readme" "homepage": "https://git.sr.ht/~ayoayco/web-component-base#readme",
"devDependencies": {
"typescript": "^5.2.2"
}
} }

2
src/index.js Normal file
View file

@ -0,0 +1,2 @@
import { WebComponent } from "./WebComponent.js";
export default WebComponent;