From 8dea20fccf1b940549ce07c83cfa27099b46609d Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 30 Apr 2021 13:11:26 +0200 Subject: [PATCH] Chore: Restructured for npm publishing --- .gitignore | 1 + package.json | 25 ++++++++++++++----- cache.handler.ts => src/cache.handler.ts | 0 index.ts => src/index.ts | 0 .../litElementState.helpers.ts | 0 .../litElementState.service.ts | 0 .../litElementStateSubscription.ts | 0 .../litElementStateful.ts | 4 +-- tsconfig.json | 16 ++++-------- yarn.lock | 11 ++++---- 10 files changed, 32 insertions(+), 25 deletions(-) rename cache.handler.ts => src/cache.handler.ts (100%) rename index.ts => src/index.ts (100%) rename litElementState.helpers.ts => src/litElementState.helpers.ts (100%) rename litElementState.service.ts => src/litElementState.service.ts (100%) rename litElementStateSubscription.ts => src/litElementStateSubscription.ts (100%) rename litElementStateful.ts => src/litElementStateful.ts (98%) diff --git a/.gitignore b/.gitignore index 857c115..7d30ad5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules/ .idea +/dist/ diff --git a/package.json b/package.json index 31cb7cd..7e85994 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,30 @@ { - "name": "lit-state", - "version": "3.0.1", + "name": "@stefanholzapfel/lit-state", + "version": "3.0.2", "description": "A reactive state management for Lit 2", "repository": { "type": "git", "url": "https://github.com/stefanholzapfel/lit-state.git" }, - "browser": "index.ts", - "scripts": {}, + "scripts": { + "build": "tsc --build --clean && tsc", + "publish_npm": "tsc --build --clean && tsc && yarn publish" + }, "author": "Stefan Holzapfel", "license": "MIT", "dependencies": { - "lit-helpers": "https://github.com/stefanholzapfel/lit-helpers.git#2.0.0", + "lit": "^2.0.0-rc.1", "ts-essentials": "^7.0.1" - } + }, + "devDependencies": { + "typescript": "^4.2.4" + }, + "type": "module", + "types": "dist/index.d.ts", + "main:": "dist/index.js", + "module": "dist/index.js", + "files": [ + "dist", + "src" + ] } diff --git a/cache.handler.ts b/src/cache.handler.ts similarity index 100% rename from cache.handler.ts rename to src/cache.handler.ts diff --git a/index.ts b/src/index.ts similarity index 100% rename from index.ts rename to src/index.ts diff --git a/litElementState.helpers.ts b/src/litElementState.helpers.ts similarity index 100% rename from litElementState.helpers.ts rename to src/litElementState.helpers.ts diff --git a/litElementState.service.ts b/src/litElementState.service.ts similarity index 100% rename from litElementState.service.ts rename to src/litElementState.service.ts diff --git a/litElementStateSubscription.ts b/src/litElementStateSubscription.ts similarity index 100% rename from litElementStateSubscription.ts rename to src/litElementStateSubscription.ts diff --git a/litElementStateful.ts b/src/litElementStateful.ts similarity index 98% rename from litElementStateful.ts rename to src/litElementStateful.ts index 57b84f3..ba2f382 100644 --- a/litElementStateful.ts +++ b/src/litElementStateful.ts @@ -1,4 +1,5 @@ import {DeepPartial} from 'ts-essentials'; +import { LitElement } from 'lit'; import { StateSubscriptionFunction, ReducableState, @@ -7,9 +8,8 @@ import { import {LitElementStateService} from './litElementState.service'; import {LitElementStateSubscription} from './litElementStateSubscription'; import {optionsFromDefaultOrParams} from './litElementState.helpers'; -import {LitElementEnhanced} from '../lit-helpers'; -export class LitElementStateful extends LitElementEnhanced { +export class LitElementStateful extends LitElement { private autoUnsubscribeSubs: LitElementStateSubscription[] = []; private stateService: LitElementStateService; diff --git a/tsconfig.json b/tsconfig.json index 238a5ae..882d273 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,18 +4,12 @@ "moduleResolution": "node", "target": "es2020", "lib": ["dom", "es2020"], - "sourceMap": true, - "experimentalDecorators": true + "declaration": true, + "declarationMap": true, + "experimentalDecorators": true, + "outDir": "dist" }, - "include": [ - "*" - ], "exclude": [ - "node_modules", - "**/*.spec.ts" - ], - "browserslist": [ - "> 1%", - "last 2 versions" + "node_modules" ] } diff --git a/yarn.lock b/yarn.lock index 9a883e4..68fee87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,12 +20,6 @@ lit-element@^3.0.0-rc.1: "@lit/reactive-element" "^1.0.0-rc.1" lit-html "^2.0.0-rc.1" -"lit-helpers@https://github.com/stefanholzapfel/lit-helpers.git#2.0.0": - version "2.0.0" - resolved "https://github.com/stefanholzapfel/lit-helpers.git#3b65b9dda8b7438f4e9db6bc9c389341a5fd73bc" - dependencies: - lit "^2.0.0-rc.1" - lit-html@^2.0.0-rc.1: version "2.0.0-rc.2" resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.0.0-rc.2.tgz#c7ac652af1df7e5d8e32a3e6130221766d09cbde" @@ -46,3 +40,8 @@ ts-essentials@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.1.tgz#d205508cae0cdadfb73c89503140cf2228389e2d" integrity sha512-8lwh3QJtIc1UWhkQtr9XuksXu3O0YQdEE5g79guDfhCaU1FWTDIEDZ1ZSx4HTHUmlJZ8L812j3BZQ4a0aOUkSA== + +typescript@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961" + integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==