From 18a341635a566d1ed6206bbc454ac430c9f83b45 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 3 Aug 2022 17:34:03 +0200 Subject: [PATCH 1/2] disable package-lock generation move typings to types folder adapt changes regarding types to package.json update typing from FastifyPlugin to FastifyPluginCallback --- .npmrc | 1 + .taprc | 3 +++ package.json | 7 ++++--- index.d.ts => types/index.d.ts | 4 ++-- index.test-d.ts => types/index.test-d.ts | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .npmrc rename index.d.ts => types/index.d.ts (94%) rename index.test-d.ts => types/index.test-d.ts (96%) diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.taprc b/.taprc index 04c78a0..a0a44cc 100644 --- a/.taprc +++ b/.taprc @@ -2,3 +2,6 @@ jsx: false ts: false flow: false coverage: false +jobs: 1 +files: + - 'test/**/*.test.js' diff --git a/package.json b/package.json index a33269e..9e0d839 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "7.0.0", "description": "Measure process load with automatic handling of 'Service Unavailable' plugin for Fastify.", "main": "index.js", + "types": "types/index.d.ts", "scripts": { "lint": "standard | snazzy", - "unit": "tap -j 1 test/*test.js", - "test": "npm run lint && npm run unit && npm run typescript", - "typescript": "tsd" + "test": "npm run test:unit && npm run test:typescript", + "test:unit": "tap", + "test:typescript": "tsd" }, "repository": { "type": "git", diff --git a/index.d.ts b/types/index.d.ts similarity index 94% rename from index.d.ts rename to types/index.d.ts index e0c7dd9..4c5b5b5 100644 --- a/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,6 @@ import { FastifyInstance, - FastifyPlugin, + FastifyPluginCallback, FastifyReply, FastifyRequest } from "fastify"; @@ -34,7 +34,7 @@ declare module "fastify" { } } -declare let underPressure: FastifyPlugin< +declare let underPressure: FastifyPluginCallback< underPressure.UnderPressureOptions >; diff --git a/index.test-d.ts b/types/index.test-d.ts similarity index 96% rename from index.test-d.ts rename to types/index.test-d.ts index 478ac6d..965d6ad 100644 --- a/index.test-d.ts +++ b/types/index.test-d.ts @@ -1,4 +1,4 @@ -import underPressure from "."; +import underPressure from ".."; import fastify from "fastify"; const server = fastify(); @@ -16,7 +16,7 @@ const server = fastify(); reply.send({ hello: "world" }); }); - server.listen(3000, err => { + server.listen({port: 3000}, err => { if (err) throw err; }); }; From b59339bec87a896b1818be996e7d0fe88a02dadc Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 3 Aug 2022 17:35:53 +0200 Subject: [PATCH 2/2] activate linting in workflow --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 325921f..079a8f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,3 +15,4 @@ jobs: uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 with: license-check: true + lint: true