Skip to content

Commit c143e9c

Browse files
authored
chore: bump all dev dependencies (#308)
1 parent a48c8f7 commit c143e9c

File tree

9 files changed

+177
-108
lines changed

9 files changed

+177
-108
lines changed

.eslintrc.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
extends: ['@bjerk/eslint-config', 'plugin:jest/recommended'],
3+
plugins: ['jest'],
4+
ignorePatterns: ['dist', 'node_modules'],
5+
overrides: [
6+
{
7+
files: 'jest.config.*',
8+
rules: {
9+
'import/no-default-export': 'off',
10+
},
11+
},
12+
],
13+
parserOptions: {
14+
project: './tsconfig.eslint.json',
15+
16+
tsconfigRootDir: __dirname,
17+
},
18+
};

.eslintrc.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/fastify-plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const inputData = z.object({
1111
bookingId: z.string(),
1212
});
1313

14-
const server = () => {
14+
const server = async () => {
1515
const fastify = Fastify().withTypeProvider<TypeBoxTypeProvider>();
1616

17-
fastify.register(
17+
await fastify.register(
1818
pubSubFastifyPlugin,
1919
makePubSubConfig({
2020
parser: d => inputData.parse(d),
@@ -30,4 +30,4 @@ const server = () => {
3030
fastify.server.listen(8000);
3131
};
3232

33-
server();
33+
void server();

package.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@
2323
],
2424
"scripts": {
2525
"build": "tsc",
26-
"lint": "eslint '**/*.ts' --fix",
2726
"generate:docs": "typedoc --readme none --out docs src",
27+
"lint": "eslint '**/*.ts' --fix",
28+
"prepare": "husky install",
2829
"test": "jest --coverage src",
29-
"prepare": "husky install"
30+
"format": "prettier --write '**/*.ts'",
31+
"format:check": "prettier --check '**/*.ts'"
3032
},
3133
"lint-staged": {
3234
"*.ts": [
3335
"prettier --write"
3436
]
3537
},
36-
"prettier": "@cobraz/prettier",
38+
"prettier": "@simenandre/prettier",
3739
"dependencies": {
3840
"@fastify/type-provider-typebox": "^3.4.0",
3941
"@sinclair/typebox": "^0.30.0",
@@ -44,27 +46,19 @@
4446
"pino-cloud-logging": "^1.0.3"
4547
},
4648
"devDependencies": {
47-
"@bjerk/eslint-config": "^4.0.0",
48-
"@cobraz/prettier": "^2.0.0",
49+
"@bjerk/eslint-config": "^5.4.0",
50+
"@simenandre/prettier": "^5.0.0",
4951
"@tsconfig/node16": "^1.0.3",
5052
"@types/jest": "^29.5.0",
5153
"@types/json-schema-faker": "^0.5.1",
5254
"@types/node": "^16",
53-
"@typescript-eslint/eslint-plugin": "^5.59.0",
54-
"@typescript-eslint/parser": "^5.59.0",
5555
"eslint": "^8.38.0",
56-
"eslint-config-prettier": "^8.8.0",
57-
"eslint-plugin-eslint-comments": "^3.2.0",
58-
"eslint-plugin-import": "^2.27.5",
59-
"eslint-plugin-jest": "^27.2.1",
60-
"eslint-plugin-prettier": "^4.2.1",
61-
"eslint-plugin-promise": "^6.1.1",
62-
"eslint-plugin-unicorn": "^47.0.0",
56+
"eslint-plugin-jest": "^27.2.3",
6357
"husky": "^8.0.0",
6458
"jest": "^29.5.0",
6559
"json-schema-faker": "^0.5.0-rcv.32",
6660
"lint-staged": "^13.1.0",
67-
"prettier": "^2.6.2",
61+
"prettier": "^3.0.0",
6862
"ts-jest": "^29.1.0",
6963
"typedoc": "^0.24.4",
7064
"typedoc-plugin-markdown": "^3.1.1",

src/cloud-functions.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ import type * as express from 'express';
22
import pino from 'pino';
33
import { gcpLogOptions } from 'pino-cloud-logging';
44
import { handlePubSubMessage } from './common';
5-
import { PubSubConfig, PubSubHandler } from './types';
5+
import { PubSubConfig, PubSubHandler, PubSubMessage } from './types';
6+
7+
export type CloudRunRequest = express.Request<
8+
unknown,
9+
unknown,
10+
{
11+
message: PubSubMessage;
12+
}
13+
>;
614

715
export interface PubSubCloudFunctionsConfig<Data, Context>
816
extends PubSubConfig<Data, Context> {
917
logger?: pino.LoggerOptions;
1018

11-
context?: (req?: express.Request) => Context | Promise<Context>;
19+
context?: (req?: CloudRunRequest) => Context | Promise<Context>;
1220
}
1321

1422
export type CloudFunctionFun = (
15-
req: express.Request,
23+
req: CloudRunRequest,
1624
res: express.Response,
1725
) => Promise<void>;
1826

src/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function handlePubSubMessage<Data, Context, Logger>(
1515
const { message, parseJson = true, parser, handler, context, log } = args;
1616
const bufferString = Buffer.from(message.data, 'base64').toString().trim();
1717

18-
let data = parseJson ? JSON.parse(bufferString) : bufferString;
18+
let data = (parseJson ? JSON.parse(bufferString) : bufferString) as Data;
1919

2020
if (parser) {
2121
data = await parser(data);

src/fastify-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const pubSubFastifyPluginFn = async <Data, Context>(
4242
},
4343
);
4444

45-
return reply.code(res?.statusCode || 204).send();
45+
return reply.code(res?.statusCode ?? 204).send();
4646
} catch (error) {
4747
if (onError) {
4848
await onError(error, context);

tsconfig.eslint.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "@tsconfig/node16/tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./dist",
5+
"declaration": true,
6+
"sourceMap": true
7+
},
8+
"include": ["src/**/*", "examples/**/*"],
9+
"exclude": ["node_modules", "**/*.spec.ts"]
10+
}

0 commit comments

Comments
 (0)