Переглянути джерело

ref: build type decls with tsc instead of tsup

Sv443 1 рік тому
батько
коміт
0e4fbb67b0
3 змінених файлів з 10 додано та 11 видалено
  1. 1 1
      README.md
  2. 8 8
      package.json
  3. 1 2
      tsconfig.json

+ 1 - 1
README.md

@@ -1,7 +1,7 @@
 <div style="text-align: center;" align="center">
 
 ## UserUtils
-Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, modify the DOM more easily and more.  
+Zero-dependency library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, modify the DOM more easily and more.  
 Contains builtin TypeScript declarations. Webpack compatible and supports ESM and CJS.  
 If you like using this library, please consider [supporting the development ❤️](https://github.com/sponsors/Sv443)
 

+ 8 - 8
package.json

@@ -4,13 +4,14 @@
   "description": "Library with various utilities for userscripts - register listeners for when CSS selectors exist, intercept events, modify the DOM more easily and more ",
   "main": "dist/index.js",
   "module": "dist/index.mjs",
-  "types": "dist/index.d.ts",
+  "types": "dist/lib/index.d.ts",
   "scripts": {
-    "lint": "tsc && eslint .",
-    "build-common": "tsup lib/index.ts --format cjs,esm --dts --clean --treeshake",
-    "build-iife": "tsup lib/index.ts --format cjs,esm,iife --dts --clean --treeshake --minify",
-    "build": "npm run build-common -- --minify",
-    "dev": "npm run build-common -- --sourcemap --watch",
+    "lint": "tsc --noEmit && eslint .",
+    "build-types": "tsc --emitDeclarationOnly --declaration --outDir dist",
+    "build-common": "tsup lib/index.ts --format cjs,esm --clean --treeshake",
+    "build-iife": "tsup lib/index.ts --format cjs,esm,iife --clean --treeshake --minify",
+    "build": "npm run build-common -- --minify && npm run build-types",
+    "dev": "npm run build-common -- --sourcemap --watch --onSuccess \"npm run build-types\"",
     "publish-package": "npm run build && changeset publish"
   },
   "repository": {
@@ -43,8 +44,7 @@
   "files": [
     "/dist/index.js",
     "/dist/index.mjs",
-    "/dist/index.d.ts",
-    "/dist/index.d.mts",
+    "/dist/lib/**.*",
     "/package.json",
     "/README.md",
     "/CHANGELOG.md",

+ 1 - 2
tsconfig.json

@@ -15,8 +15,7 @@
     "strict": true,
     "useDefineForClassFields": true,
     "noImplicitThis": false,
-    "noUncheckedIndexedAccess": true,
-    "noEmit": true
+    "noUncheckedIndexedAccess": true
   },
   "exclude": ["**/*.js", "dist/**"]
 }