From 7acfcc8b8cec01fb560abc8b4c6d8945219303fc Mon Sep 17 00:00:00 2001 From: Trinh Pham <9128061+trinhpham@users.noreply.github.com> Date: Wed, 7 Jun 2023 04:27:18 +0000 Subject: [PATCH] Generate type definition on publish --- .gitignore | 1 + package.json | 8 ++++++-- tsconfig.json | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 887c8e9..cd33c53 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ hack.* node_modules package-lock.json tmp +types diff --git a/package.json b/package.json index d640a45..4734ac0 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,10 @@ "version": "1.0.2", "main": "./lib", "files": [ - "./lib" + "./lib", + "./types" ], + "types": "types/index.d.ts", "dependencies": { "papi": "^1.1.0" }, @@ -20,9 +22,11 @@ "nyc": "^15.1.0", "prettier": "^2.7.1", "should": "^13.2.1", - "sinon": "^14.0.0" + "sinon": "^14.0.0", + "typescript": "^5.1.3" }, "scripts": { + "prepublishOnly": "tsc", "format": "prettier -w .", "test": "prettier -c . && nyc mocha -- --recursive --check-leaks --timeout 15000", "acceptance": "NOCK_OFF=true NOCK_REC=false JENKINS_TEST_URL=http://admin:admin@localhost:8080 mocha --recursive --check-leaks --timeout 15000" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..184b19e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "include": ["lib/**/*"], + "compilerOptions": { + "allowJs": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "types" + } +} \ No newline at end of file