Skip to content

Commit b6dccf6

Browse files
committed
chore: improve d.ts generation
chore: improve dts generation chore: remove api extractor config
1 parent c148467 commit b6dccf6

File tree

5 files changed

+508
-85
lines changed

5 files changed

+508
-85
lines changed

packages/shortest/index.d.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

packages/shortest/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,27 @@
55
"type": "module",
66
"main": "./dist/index.js",
77
"module": "./dist/index.js",
8-
"types": "./index.d.ts",
8+
"types": "./dist/index.d.ts",
99
"bin": {
1010
"shortest": "./dist/cli/bin.js"
1111
},
1212
"exports": {
1313
".": {
14-
"types": "./index.d.ts",
14+
"types": "./dist/index.d.ts",
1515
"import": "./dist/index.js",
1616
"require": "./dist/index.cjs"
1717
}
1818
},
1919
"files": [
2020
"dist",
21-
"dist/cli",
22-
"index.d.ts"
21+
"dist/cli"
2322
],
2423
"scripts": {
2524
"build": "rm -rf dist && pnpm build:types && pnpm build:js && pnpm build:cli",
2625
"prepare": "pnpm build",
2726
"prepublishOnly": "pnpm build",
2827
"postinstall": "node -e \"if (process.platform !== 'win32') { try { require('child_process').execSync('chmod +x dist/cli/bin.js') } catch (_) {} }\"",
29-
"build:types": "tsc --emitDeclarationOnly --outDir dist/types && cp index.d.ts dist/",
28+
"build:types": "tsup src/index.ts --dts-only --format esm --outDir dist",
3029
"build:js": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:esbuild --external:punycode --external:playwright --external:@anthropic-ai/sdk --external:expect --external:dotenv",
3130
"build:cjs": "esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/index.cjs --external:esbuild --external:punycode --external:playwright --external:@anthropic-ai/sdk --external:expect --external:dotenv",
3231
"build:cli": "esbuild src/cli/bin.ts --bundle --platform=node --format=esm --outdir=dist/cli --metafile=dist/meta-cli.json --external:fsevents --external:chokidar --external:glob --external:esbuild --external:events --external:path --external:fs --external:util --external:stream --external:os --external:assert --external:url --external:playwright --external:@anthropic-ai/sdk --external:expect --external:dotenv --external:otplib --external:picocolors --external:punycode --external:https --external:http --external:net --external:tls --external:crypto --external:mailosaur",
@@ -50,7 +49,8 @@
5049
"@types/node": "^20.11.24",
5150
"tsx": "^4.7.1",
5251
"typescript": "~5.6.2",
53-
"package-manager-detector": "0.2.8"
52+
"package-manager-detector": "0.2.8",
53+
"tsup": "8.3.5"
5454
},
5555
"engines": {
5656
"node": ">=18"

packages/shortest/src/globals.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { Expect } from "expect";
2+
3+
declare global {
4+
// @ts-ignore
5+
var expect: Expect;
6+
}

packages/shortest/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import {
1010
ShortestConfig,
1111
} from "./types";
1212

13+
// to include the global expect in the generated d.ts file
14+
import "./globals";
15+
1316
// Initialize config
1417
let globalConfig: ShortestConfig | null = null;
1518
const compiler = new TestCompiler();

0 commit comments

Comments
 (0)