From 8600d08e094f79714e0a255e703c4282511559b4 Mon Sep 17 00:00:00 2001 From: hemengke <23536175@qq.com> Date: Fri, 22 Dec 2023 14:18:06 +0800 Subject: [PATCH] chore: add usage docs and only emit declaration on build --- README.md | 26 +++++++++++++++++++++++++- package-lock.json | 4 ++-- package.json | 4 +++- tsconfig.json | 3 ++- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 00f429c..abeefa9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,31 @@ t2t-tools is type conversion tool of typescript. -# API +## Install +```bash +npm install t2t-tools -D +``` + +## Usage + +Add to a d.ts declaration file +```ts +/// +``` + +OR + +add `t2t-tools` to `compilerOptions.types` inside tsconfig.json + +```json +{ + "compilerOptions": { + "types": ["t2t-tools"] + } +} +``` + +## API | 方法名 | 解释 | | :-------------------: | :---------------------------------------------------: | diff --git a/package-lock.json b/package-lock.json index b624de5..446ac9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "t2t-tools", - "version": "0.0.1", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "t2t-tools", - "version": "0.0.1", + "version": "0.1.0", "license": "MIT", "devDependencies": { "conventional-changelog-cli": "^4.1.0", diff --git a/package.json b/package.json index 8e72638..68845e4 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,10 @@ "name": "t2t-tools", "version": "0.1.0", "description": "type conversion tool of typescript", - "main": "./dist/index.js", "types": "./dist/index.d.ts", + "files": [ + "./dist/*.d.ts" + ], "repository": "https://github.com/thomas-void0/t2t-tools", "homepage": "https://github.com/thomas-void0/t2t-tools", "scripts": { diff --git a/tsconfig.json b/tsconfig.json index fb9800c..8b0602b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ "pretty": true, "removeComments": false, "sourceMap": false, - "stripInternal": true + "stripInternal": true, + "emitDeclarationOnly": true } }