From 41fdbc2ea06ecaf3b26e5236f70f9b0d4372040a Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 30 Nov 2022 13:44:25 +0100 Subject: [PATCH 1/2] restructure --- .taprc | 3 +++ package.json | 21 ++++++++++----------- test/{base.js => base.test.js} | 0 test/{hooks.js => hooks.test.js} | 0 test/{router.js => router.test.js} | 0 tsconfig.json | 11 ----------- index.d.ts => types/index.d.ts | 0 {test/types => types}/index.test-d.ts | 2 +- 8 files changed, 14 insertions(+), 23 deletions(-) rename test/{base.js => base.test.js} (100%) rename test/{hooks.js => hooks.test.js} (100%) rename test/{router.js => router.test.js} (100%) delete mode 100644 tsconfig.json rename index.d.ts => types/index.d.ts (100%) rename {test/types => types}/index.test-d.ts (99%) diff --git a/.taprc b/.taprc index 48f7aff..fec4f69 100644 --- a/.taprc +++ b/.taprc @@ -3,3 +3,6 @@ jsx: false flow: false coverage: true jobs: 1 + +files: + - test/**/*.test.js diff --git a/package.json b/package.json index 43689a5..7312001 100644 --- a/package.json +++ b/package.json @@ -3,16 +3,12 @@ "version": "7.1.1", "description": "basic websocket support for fastify", "main": "index.js", - "types": "index.d.ts", - "tsd": { - "directory": "./test/types" - }, + "types": "types/index.d.ts", "scripts": { - "lint": "standard | snazzy", - "unit": "tap --100 \"test/*.js\"", - "test:js": "npm run lint && npm run unit", - "test:ts": "tsd", - "test": "npm run lint && npm run test:js && npm run test:ts" + "lint": "standard", + "test": "npm run test:unit && npm run test:typescript", + "test:unit": "tap", + "test:typescript": "tsd" }, "repository": { "type": "git", @@ -34,7 +30,6 @@ "@sinclair/typebox": "^0.25.10", "@types/ws": "^8.2.2", "fastify": "^4.0.0-rc.2", - "snazzy": "^9.0.0", "split2": "^4.1.0", "standard": "^17.0.0", "tap": "^16.0.0", @@ -46,5 +41,9 @@ }, "publishConfig": { "access": "public" - } + }, + "pre-commit": [ + "lint", + "test" + ] } diff --git a/test/base.js b/test/base.test.js similarity index 100% rename from test/base.js rename to test/base.test.js diff --git a/test/hooks.js b/test/hooks.test.js similarity index 100% rename from test/hooks.js rename to test/hooks.test.js diff --git a/test/router.js b/test/router.test.js similarity index 100% rename from test/router.js rename to test/router.test.js diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 37c41b6..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "lib": ["es2015"], - "module": "commonjs", - "noEmit": true, - "strict": true, - "noImplicitAny": true - }, - "includes": ["./test/types/*.test-d.ts", "index.d.ts"] -} diff --git a/index.d.ts b/types/index.d.ts similarity index 100% rename from index.d.ts rename to types/index.d.ts diff --git a/test/types/index.test-d.ts b/types/index.test-d.ts similarity index 99% rename from test/types/index.test-d.ts rename to types/index.test-d.ts index 32cd1ad..5bcf9ea 100644 --- a/test/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -1,4 +1,4 @@ -import wsPlugin, { WebsocketHandler, SocketStream } from '../..'; +import wsPlugin, { WebsocketHandler, SocketStream } from '..'; import type { IncomingMessage } from "http"; import fastify, { RouteOptions, FastifyRequest, FastifyInstance, FastifyReply, RequestGenericInterface, FastifyBaseLogger, RawServerDefault, FastifySchema, RawRequestDefaultExpression, RawServerBase, ContextConfigDefault, RawReplyDefaultExpression } from 'fastify'; import { expectType } from 'tsd'; From 7d644986c9d8e7328d5ec6a541189451050a70b9 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Wed, 30 Nov 2022 13:46:05 +0100 Subject: [PATCH 2/2] lint on push --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 325921f..e58887a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,4 +14,5 @@ jobs: test: uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 with: + lint: true license-check: true