diff --git a/package.json b/package.json index b8958f8..f21b870 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,10 @@ "main": "./build/index.js", "type": "module", "files": [ - "build/src", - "build/index.d.ts", - "build/index.js" + "build", + "!build/bin", + "!build/tests_helpers", + "!build/tests" ], "exports": { ".": "./build/index.js", @@ -20,9 +21,10 @@ "pretest": "npm run lint && npm run typecheck", "test": "c8 npm run quick:test", "clean": "del-cli build", - "compile": "npm run lint && npm run clean && tsc", + "precompile": "npm run lint && npm run clean", + "compile": "tsup-node && tsc --emitDeclarationOnly --declaration", "build": "npm run compile", - "release": "np --message=\"chore(release): %s\"", + "release": "np", "version": "npm run build", "prepublishOnly": "npm run build", "lint": "eslint . --ext=.ts", @@ -52,6 +54,7 @@ "np": "^8.0.4", "prettier": "^3.0.3", "ts-node": "^10.9.1", + "tsup": "^7.2.0", "typescript": "^5.2.2" }, "dependencies": { @@ -118,5 +121,17 @@ }, "directories": { "test": "tests" + }, + "tsup": { + "entry": [ + "./index.ts", + "./src/types.ts" + ], + "outDir": "./build", + "clean": true, + "format": "esm", + "dts": false, + "sourcemap": true, + "target": "esnext" } } diff --git a/tests/api_client/base.spec.ts b/tests/api_client/base.spec.ts index 47476fa..fb5dec9 100644 --- a/tests/api_client/base.spec.ts +++ b/tests/api_client/base.spec.ts @@ -11,7 +11,7 @@ import { test } from '@japa/runner' import { ApiClient } from '../../src/client.js' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' import { ApiResponse } from '../../src/response.js' import { RequestConfig } from '../../src/types.js' diff --git a/tests/request/auth.spec.ts b/tests/request/auth.spec.ts index f62046c..4437abd 100644 --- a/tests/request/auth.spec.ts +++ b/tests/request/auth.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request | auth', (group) => { group.each.setup(async () => { diff --git a/tests/request/base.spec.ts b/tests/request/base.spec.ts index d0b34e4..6192ab2 100644 --- a/tests/request/base.spec.ts +++ b/tests/request/base.spec.ts @@ -13,7 +13,7 @@ import { IncomingMessage } from 'node:http' import { ApiRequest } from '../../src/request.js' import { RequestConfig } from '../../src/types.js' import { ApiResponse } from '../../src/response.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request', (group) => { group.each.setup(async () => { diff --git a/tests/request/body.spec.ts b/tests/request/body.spec.ts index 2b8ef47..a2f3f8a 100644 --- a/tests/request/body.spec.ts +++ b/tests/request/body.spec.ts @@ -12,7 +12,7 @@ import { parse } from 'node:querystring' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { awaitStream, httpServer } from '../../test_helpers/index.js' +import { awaitStream, httpServer } from '../../tests_helpers/index.js' import { fileURLToPath } from 'node:url' test.group('Request | body', (group) => { diff --git a/tests/request/cookies.spec.ts b/tests/request/cookies.spec.ts index 0dda6c4..6f868c5 100644 --- a/tests/request/cookies.spec.ts +++ b/tests/request/cookies.spec.ts @@ -11,7 +11,7 @@ import cookie from 'cookie' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request | cookies', (group) => { group.each.setup(async () => { diff --git a/tests/request/custom_types.spec.ts b/tests/request/custom_types.spec.ts index 648dd94..8eb1aae 100644 --- a/tests/request/custom_types.spec.ts +++ b/tests/request/custom_types.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { awaitStream, httpServer } from '../../test_helpers/index.js' +import { awaitStream, httpServer } from '../../tests_helpers/index.js' test.group('Request | custom types', (group) => { group.each.setup(async () => { diff --git a/tests/request/headers.spec.ts b/tests/request/headers.spec.ts index 1c42230..d7fa1f7 100644 --- a/tests/request/headers.spec.ts +++ b/tests/request/headers.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request | headers', (group) => { group.each.setup(async () => { diff --git a/tests/request/lifecycle_hooks.spec.ts b/tests/request/lifecycle_hooks.spec.ts index de1810a..65764d8 100644 --- a/tests/request/lifecycle_hooks.spec.ts +++ b/tests/request/lifecycle_hooks.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request | lifecycle hooks', (group) => { group.each.setup(async () => { diff --git a/tests/request/query_string.spec.ts b/tests/request/query_string.spec.ts index 9afecb6..168bfea 100644 --- a/tests/request/query_string.spec.ts +++ b/tests/request/query_string.spec.ts @@ -11,7 +11,7 @@ import { parse } from 'node:querystring' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Request | query string', (group) => { group.each.setup(async () => { diff --git a/tests/response/assertions.spec.ts b/tests/response/assertions.spec.ts index bb13114..43fa370 100644 --- a/tests/response/assertions.spec.ts +++ b/tests/response/assertions.spec.ts @@ -11,7 +11,7 @@ import cookie from 'cookie' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | assertions', (group) => { group.each.setup(async () => { diff --git a/tests/response/base.spec.ts b/tests/response/base.spec.ts index e1e7eba..988ee21 100644 --- a/tests/response/base.spec.ts +++ b/tests/response/base.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response', (group) => { group.each.setup(async () => { diff --git a/tests/response/cookies.spec.ts b/tests/response/cookies.spec.ts index f476c4f..aed2438 100644 --- a/tests/response/cookies.spec.ts +++ b/tests/response/cookies.spec.ts @@ -11,7 +11,7 @@ import cookie from 'cookie' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | cookies', (group) => { group.each.setup(async () => { diff --git a/tests/response/custom_types.spec.ts b/tests/response/custom_types.spec.ts index dce5bbf..5b7d017 100644 --- a/tests/response/custom_types.spec.ts +++ b/tests/response/custom_types.spec.ts @@ -11,7 +11,7 @@ import { load } from 'cheerio' import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | custom types', (group) => { group.each.setup(async () => { diff --git a/tests/response/data_types.spec.ts b/tests/response/data_types.spec.ts index 8994a38..e90baa7 100644 --- a/tests/response/data_types.spec.ts +++ b/tests/response/data_types.spec.ts @@ -12,7 +12,7 @@ import { test } from '@japa/runner' import { createReadStream } from 'node:fs' import { ApiRequest } from '../../src/request.js' -import { awaitStream, httpServer } from '../../test_helpers/index.js' +import { awaitStream, httpServer } from '../../tests_helpers/index.js' import { fileURLToPath } from 'node:url' test.group('Response | data types', (group) => { diff --git a/tests/response/error_handling.spec.ts b/tests/response/error_handling.spec.ts index 9ef63b4..5fb1526 100644 --- a/tests/response/error_handling.spec.ts +++ b/tests/response/error_handling.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | error handling', (group) => { group.each.setup(async () => { diff --git a/tests/response/lifecycle_hooks.spec.ts b/tests/response/lifecycle_hooks.spec.ts index 924753c..1ecdf2e 100644 --- a/tests/response/lifecycle_hooks.spec.ts +++ b/tests/response/lifecycle_hooks.spec.ts @@ -11,7 +11,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' import { ApiResponse } from '../../src/response.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | lifecycle hooks', (group) => { group.each.setup(async () => { diff --git a/tests/response/redirects.spec.ts b/tests/response/redirects.spec.ts index cc810da..d2538b2 100644 --- a/tests/response/redirects.spec.ts +++ b/tests/response/redirects.spec.ts @@ -10,7 +10,7 @@ import { test } from '@japa/runner' import { ApiRequest } from '../../src/request.js' -import { httpServer } from '../../test_helpers/index.js' +import { httpServer } from '../../tests_helpers/index.js' test.group('Response | redirects', (group) => { group.each.setup(async () => { diff --git a/test_helpers/index.ts b/tests_helpers/index.ts similarity index 100% rename from test_helpers/index.ts rename to tests_helpers/index.ts