feat: add proto paths
All checks were successful
Publish / Publish npm package action (push) Successful in 19s

This commit is contained in:
Sergey Krylov 2026-01-28 06:13:27 +03:00
parent fa73b7d5c6
commit 954d352941
8 changed files with 58 additions and 2 deletions

View File

@ -25,6 +25,9 @@ jobs:
- name: 'Install dependencies' - name: 'Install dependencies'
run: yarn install --frozen-lockfile run: yarn install --frozen-lockfile
- name: 'Build'
run: yarn run build
- name: 'Generate contracts' - name: 'Generate contracts'
run: yarn generate run: yarn generate

View File

@ -1,10 +1,13 @@
{ {
"name": "@teacinema/contracts", "name": "@teacinema/contracts",
"version": "1.0.1", "version": "1.0.2",
"description": "Protocol Buffers contracts for microservices", "description": "Protocol Buffers contracts for microservices",
"scripts": { "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" "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": [ "files": [
"gen", "gen",
"proto" "proto"
@ -14,8 +17,12 @@
}, },
"dependencies": { "dependencies": {
"@nestjs/microservices": "^11.1.12", "@nestjs/microservices": "^11.1.12",
"rxjs": "^7.8.2",
"protoc": "33.4.0", "protoc": "33.4.0",
"rxjs": "^7.8.2",
"ts-proto": "2.11.0" "ts-proto": "2.11.0"
},
"devDependencies": {
"@types/node": "^25.0.10",
"typescript": "^5.9.3"
} }
} }

1
src/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './proto'

1
src/proto/index.ts Normal file
View File

@ -0,0 +1 @@
export * from './paths'

5
src/proto/paths.ts Normal file
View File

@ -0,0 +1,5 @@
import { join } from 'node:path';
export const PROTO_PATHS = {
AUTH: join(__dirname, '../../proto/auth.proto'),
} as const

9
tsconfig.build.json Normal file
View File

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "dist",
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "test"]
}

13
tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2024",
"types": ["node"],
"strict": true,
"strictNullChecks": false,
"jsx": "react-jsx",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -15,6 +15,13 @@
iterare "1.2.1" iterare "1.2.1"
tslib "2.8.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: case-anything@^2.1.13:
version "2.1.13" version "2.1.13"
resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.13.tgz#0cdc16278cb29a7fcdeb072400da3f342ba329e9" 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" version "2.8.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== 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==