Skip to content

Commit

Permalink
chore: improve d.ts generation
Browse files Browse the repository at this point in the history
chore: improve dts generation

chore: remove api extractor config
  • Loading branch information
amk-dev committed Jan 1, 2025
1 parent 79c0b12 commit 077a925
Show file tree
Hide file tree
Showing 5 changed files with 508 additions and 85 deletions.
79 changes: 0 additions & 79 deletions packages/shortest/index.d.ts

This file was deleted.

12 changes: 6 additions & 6 deletions packages/shortest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,27 @@
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./index.d.ts",
"types": "./dist/index.d.ts",
"bin": {
"shortest": "./dist/cli/bin.js"
},
"exports": {
".": {
"types": "./index.d.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist",
"dist/cli",
"index.d.ts"
"dist/cli"
],
"scripts": {
"build": "rm -rf dist && pnpm build:types && pnpm build:js && pnpm build:cli",
"prepare": "pnpm build",
"prepublishOnly": "pnpm build",
"postinstall": "node -e \"if (process.platform !== 'win32') { try { require('child_process').execSync('chmod +x dist/cli/bin.js') } catch (_) {} }\"",
"build:types": "tsc --emitDeclarationOnly --outDir dist/types && cp index.d.ts dist/",
"build:types": "tsup src/index.ts --dts-only --format esm --outDir dist",
"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",
"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",
"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",
Expand All @@ -50,7 +49,8 @@
"@types/node": "^20.11.24",
"tsx": "^4.7.1",
"typescript": "~5.6.2",
"package-manager-detector": "0.2.8"
"package-manager-detector": "0.2.8",
"tsup": "8.3.5"
},
"engines": {
"node": ">=18"
Expand Down
6 changes: 6 additions & 0 deletions packages/shortest/src/globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Expect } from "expect";

declare global {
// @ts-ignore
var expect: Expect;
}
3 changes: 3 additions & 0 deletions packages/shortest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import {
ShortestConfig,
} from "./types";

// to include the global expect in the generated d.ts file
import "./globals";

// Initialize config
let globalConfig: ShortestConfig | null = null;
const compiler = new TestCompiler();
Expand Down
Loading

0 comments on commit 077a925

Please sign in to comment.