Skip to content

Commit

Permalink
restructure and nodenext (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Dec 5, 2022
1 parent 3b94c3a commit c394b23
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 188 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
with:
license-check: true
lint: true
2 changes: 2 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
files:
- test/**/*.test.js
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ module.exports = fp(fastifySensible, {
name: '@fastify/sensible',
fastify: '4.x'
})
module.exports.default = fastifySensible
module.exports.fastifySensible = fastifySensible
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
"version": "5.1.1",
"description": "Defaults for Fastify that everyone can agree on",
"main": "index.js",
"types": "types/index.d.ts",
"scripts": {
"test": "standard && tap test/*.test.js && tsd"
"lint": "standard",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"test:unit": "tap"
},
"repository": {
"type": "git",
Expand Down
168 changes: 0 additions & 168 deletions test/types.test.ts

This file was deleted.

13 changes: 0 additions & 13 deletions tsconfig.json

This file was deleted.

17 changes: 12 additions & 5 deletions index.d.ts → types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { FastifyPlugin } from 'fastify'
import { HttpErrors, HttpErrorReplys } from "./lib/httpError"
import { FastifyPluginCallback } from 'fastify'
import { HttpErrors, HttpErrorReplys } from "../lib/httpError"

type FastifySensible = FastifyPluginCallback<fastifySensible.SensibleOptions>

type singleValueTypes = 'must-revalidate' |
'no-cache' |
Expand Down Expand Up @@ -60,8 +62,13 @@ declare module 'fastify' {
}
}

export interface SensibleOptions {
declare namespace fastifySensible {
export interface SensibleOptions {
}

export const fastifySensible: FastifySensible
export { fastifySensible as default }
}

declare const fastifySensible: FastifyPlugin<SensibleOptions>
export default fastifySensible;
declare function fastifySensible(...params: Parameters<FastifySensible>): ReturnType<FastifySensible>
export = fastifySensible
2 changes: 1 addition & 1 deletion index.test-d.ts → types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType, expectAssignable, expectError } from 'tsd'
import fastify from 'fastify'
import fastifySensible from '.'
import fastifySensible from '..'

const app = fastify()

Expand Down

0 comments on commit c394b23

Please sign in to comment.