diff --git a/.taprc b/.taprc new file mode 100644 index 0000000..eb6eb3e --- /dev/null +++ b/.taprc @@ -0,0 +1,2 @@ +files: + - test/**/*.test.js diff --git a/package.json b/package.json index 22d2ebe..3edb604 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "4.0.0", "description": "Fastify basic auth plugin", "main": "index.js", - "types": "index.d.ts", + "types": "types/index.d.ts", "scripts": { "lint": "standard", "test": "npm run test:unit && npm run test:types", - "test:unit": "tap test.js", + "test:unit": "tap", "test:types": "tsd" }, "repository": { diff --git a/test.js b/test/index.test.js similarity index 99% rename from test.js rename to test/index.test.js index bd3159b..4adb633 100644 --- a/test.js +++ b/test/index.test.js @@ -2,7 +2,7 @@ const { test } = require('tap') const Fastify = require('fastify') -const basicAuth = require('./index') +const basicAuth = require('..') const fastifyAuth = require('@fastify/auth') test('Basic', t => { diff --git a/index.d.ts b/types/index.d.ts similarity index 86% rename from index.d.ts rename to types/index.d.ts index fdc8465..acc6211 100644 --- a/index.d.ts +++ b/types/index.d.ts @@ -1,9 +1,8 @@ import { FastifyRequest, - FastifyPlugin, + FastifyPluginAsync, FastifyReply, onRequestHookHandler, - preParsingHookHandler, preValidationHookHandler, preHandlerHookHandler, FastifyInstance @@ -30,5 +29,5 @@ export interface FastifyBasicAuthOptions { header?: string; } -declare const fastifyBasicAuth: FastifyPlugin +declare const fastifyBasicAuth: FastifyPluginAsync export default fastifyBasicAuth; diff --git a/index.test-d.ts b/types/index.test-d.ts similarity index 98% rename from index.test-d.ts rename to types/index.test-d.ts index e24a56c..9b895f2 100644 --- a/index.test-d.ts +++ b/types/index.test-d.ts @@ -7,7 +7,7 @@ import fastify, { preHandlerHookHandler, FastifyInstance } from 'fastify' -import fastifyBasicAuth from '.' +import fastifyBasicAuth from '..' const app = fastify()