From 11108ae378d2038e65a09acbc267db2c89602e86 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 23 Apr 2026 08:25:53 +0300 Subject: [PATCH] Reorganize files to simplify TypeScript configuration --- jest.config.js | 2 +- package.json | 5 +++-- {__tests__ => src/__tests__}/index.spec.ts | 2 +- tsconfig.build.json | 11 ----------- tsconfig.json | 7 ++++--- 5 files changed, 9 insertions(+), 18 deletions(-) rename {__tests__ => src/__tests__}/index.spec.ts (99%) delete mode 100644 tsconfig.build.json diff --git a/jest.config.js b/jest.config.js index a710251..5eda61c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,6 +9,6 @@ module.exports = { '^.+\\.tsx?$': 'ts-jest', }, testEnvironment: 'node', - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', + testRegex: '(/src\/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], }; diff --git a/package.json b/package.json index 895ac7d..0022b0b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "author": "Joscha Feth ", "license": "MIT", "files": [ - "dist" + "dist", + "!**/__tests__/**" ], "engines": { "node": ">=18" @@ -41,7 +42,7 @@ }, "scripts": { "build": "rimraf ./dist && npm run compile", - "compile": "tsc --project tsconfig.build.json", + "compile": "tsc", "prepack": "npm run build", "pretest": "prettier --check .", "test": "jest --ci", diff --git a/__tests__/index.spec.ts b/src/__tests__/index.spec.ts similarity index 99% rename from __tests__/index.spec.ts rename to src/__tests__/index.spec.ts index 70501d2..b165248 100644 --- a/__tests__/index.spec.ts +++ b/src/__tests__/index.spec.ts @@ -1,4 +1,4 @@ -import detective = require('../src'); +import detective = require('..'); function assert(source: string, deps: string[], options?: detective.Options) { expect(detective(source, options)).toEqual(deps); diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index c569cf1..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "types": ["node"], - "rootDir": "src", - "outDir": "dist", - "declaration": true, - "declarationDir": "dist" - }, - "include": ["src/**/*"] -} diff --git a/tsconfig.json b/tsconfig.json index 17d6609..5b0eada 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,10 @@ "module": "commonjs", "target": "es2022", "types": ["node", "jest"], - "paths": { - "*": ["./src/*"] - } + "rootDir": "src", + "outDir": "dist", + "declaration": true, + "declarationDir": "dist" }, "include": ["src/**/*", "__tests__/**/*"] }