From 954d35294151b3e2d883f5bb9655a718b5f58cb2 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Wed, 28 Jan 2026 06:13:27 +0300 Subject: [PATCH] feat: add proto paths --- .gitea/workflows/publish.yml | 3 +++ package.json | 11 +++++++++-- src/index.ts | 1 + src/proto/index.ts | 1 + src/proto/paths.ts | 5 +++++ tsconfig.build.json | 9 +++++++++ tsconfig.json | 13 +++++++++++++ yarn.lock | 17 +++++++++++++++++ 8 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/index.ts create mode 100644 src/proto/index.ts create mode 100644 src/proto/paths.ts create mode 100644 tsconfig.build.json create mode 100644 tsconfig.json diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 11379a1..86eb2b2 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -25,6 +25,9 @@ jobs: - name: 'Install dependencies' run: yarn install --frozen-lockfile + - name: 'Build' + run: yarn run build + - name: 'Generate contracts' run: yarn generate diff --git a/package.json b/package.json index c615dca..ecc01ff 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,13 @@ { "name": "@teacinema/contracts", - "version": "1.0.1", + "version": "1.0.2", "description": "Protocol Buffers contracts for microservices", "scripts": { + "build": "tsc -p tsconfig.build.json", "generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit" }, + "main": "dist/index.js", + "types": "dist/index.d.ts", "files": [ "gen", "proto" @@ -14,8 +17,12 @@ }, "dependencies": { "@nestjs/microservices": "^11.1.12", - "rxjs": "^7.8.2", "protoc": "33.4.0", + "rxjs": "^7.8.2", "ts-proto": "2.11.0" + }, + "devDependencies": { + "@types/node": "^25.0.10", + "typescript": "^5.9.3" } } diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..4e7a31c --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +export * from './proto' diff --git a/src/proto/index.ts b/src/proto/index.ts new file mode 100644 index 0000000..676f1e5 --- /dev/null +++ b/src/proto/index.ts @@ -0,0 +1 @@ +export * from './paths' diff --git a/src/proto/paths.ts b/src/proto/paths.ts new file mode 100644 index 0000000..564578c --- /dev/null +++ b/src/proto/paths.ts @@ -0,0 +1,5 @@ +import { join } from 'node:path'; + +export const PROTO_PATHS = { + AUTH: join(__dirname, '../../proto/auth.proto'), +} as const diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..9fff834 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "dist", + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..58bf9df --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2024", + "types": ["node"], + "strict": true, + "strictNullChecks": false, + "jsx": "react-jsx", + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/yarn.lock b/yarn.lock index 5281339..58f5d36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,6 +15,13 @@ iterare "1.2.1" tslib "2.8.1" +"@types/node@^25.0.10": + version "25.0.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-25.0.10.tgz#4864459c3c9459376b8b75fd051315071c8213e7" + integrity sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg== + dependencies: + undici-types "~7.16.0" + case-anything@^2.1.13: version "2.1.13" resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.13.tgz#0cdc16278cb29a7fcdeb072400da3f342ba329e9" @@ -77,3 +84,13 @@ tslib@2.8.1, tslib@^2.1.0: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + +typescript@^5.9.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== + +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==