add typescript and go generate
Some checks failed
Publish NPM Package / Publish Job (push) Failing after 1m39s
Some checks failed
Publish NPM Package / Publish Job (push) Failing after 1m39s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Определение proto-контрактов и генерация типов TypeScript.",
|
||||
"scripts": {
|
||||
"generate": "node scripts/generate-proto.mjs"
|
||||
"generate": "node scripts/generate-npm.mjs"
|
||||
},
|
||||
"files": [
|
||||
"proto",
|
||||
@@ -19,9 +19,11 @@
|
||||
"dependencies": {
|
||||
"@nestjs/microservices": "^11.1.23",
|
||||
"protobufjs": "^8.4.0",
|
||||
"rxjs": "^7.8.2"
|
||||
"rxjs": "^7.8.2",
|
||||
"ts-proto": "^2.11.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-proto": "^2.11.8"
|
||||
"@types/node": "^25.9.1",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
14
scripts/ganerate-go.sh
Normal file
14
scripts/ganerate-go.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "Generating Go protobuf code..."
|
||||
|
||||
protoc -I ./proto \
|
||||
--go_out=./gen/go \
|
||||
--go_grpc_out=./gen/go \
|
||||
--go_opt=module=git.lendry.ru/glifa/contracts \
|
||||
--go_grpc_opt=module=git.lendry.ru/glifa/contracts \
|
||||
./proto/*.proto
|
||||
|
||||
echo "Go protobuf code generated successfully in ./gen/go"
|
||||
1
src/indext.ts
Normal file
1
src/indext.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './proto'
|
||||
1
src/proto/index.ts
Normal file
1
src/proto/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './paths'
|
||||
42
src/proto/paths.ts
Normal file
42
src/proto/paths.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { join } from "path";
|
||||
|
||||
export const PROTO_PATHS = {
|
||||
AUTH: {
|
||||
SERVICE: join(__dirname, "../../proto/auth/v1/service.proto"),
|
||||
TYPES: join(__dirname, "../../proto/auth/v1/types.proto"),
|
||||
},
|
||||
COMMON: {
|
||||
AUTHZ: join(__dirname, "../../proto/common/v1/authz.proto"),
|
||||
ENUMS: join(__dirname, "../../proto/common/v1/enums.proto"),
|
||||
TYPES: join(__dirname, "../../proto/common/v1/types.proto"),
|
||||
},
|
||||
EDGE: {
|
||||
SERVICE: join(__dirname, "../../proto/edge/v1/service.proto"),
|
||||
},
|
||||
EVENTS: {
|
||||
ENVELOPE: join(__dirname, "../../proto/events/v1/envelope.proto"),
|
||||
AUTH_EVENTS: join(__dirname, "../../proto/events/v1/auth_events.proto"),
|
||||
CORE_EVENTS: join(__dirname, "../../proto/events/v1/core_events.proto"),
|
||||
CHANNEL_EVENTS: join(
|
||||
__dirname,
|
||||
"../../proto/events/v1/channel_events.proto",
|
||||
),
|
||||
MEDIA_EVENTS: join(__dirname, "../../proto/events/v1/media_events.proto"),
|
||||
},
|
||||
MEDIA: {
|
||||
SERVICE: join(__dirname, "../../proto/media/v1/service.proto"),
|
||||
TYPES: join(__dirname, "../../proto/media/v1/types.proto"),
|
||||
},
|
||||
WS: {
|
||||
SERVICE: join(__dirname, "../../proto/ws/v1/service.proto"),
|
||||
TYPES: join(__dirname, "../../proto/ws/v1/types.proto"),
|
||||
},
|
||||
CORE: {
|
||||
SERVICE: join(__dirname, "../../proto/core/v1/service.proto"),
|
||||
TYPES: join(__dirname, "../../proto/core/v1/types.proto"),
|
||||
},
|
||||
CHANNEL: {
|
||||
SERVICE: join(__dirname, "../../proto/channel/v1/service.proto"),
|
||||
TYPES: join(__dirname, "../../proto/channel/v1/types.proto"),
|
||||
},
|
||||
} as const;
|
||||
11
tsconfig.build.json
Normal file
11
tsconfig.build.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"types": ["node"],
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "test"]
|
||||
}
|
||||
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2024",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictNullChecks": false
|
||||
}
|
||||
}
|
||||
17
yarn.lock
17
yarn.lock
@@ -15,6 +15,13 @@
|
||||
iterare "1.2.1"
|
||||
tslib "2.8.1"
|
||||
|
||||
"@types/node@^25.9.1":
|
||||
version "25.9.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-25.9.1.tgz#3bda556db500ae4319c08e7fc9ab94f19013ba0b"
|
||||
integrity sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==
|
||||
dependencies:
|
||||
undici-types ">=7.24.0 <7.24.7"
|
||||
|
||||
case-anything@^2.1.13:
|
||||
version "2.1.13"
|
||||
resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.13.tgz#0cdc16278cb29a7fcdeb072400da3f342ba329e9"
|
||||
@@ -84,3 +91,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@^6.0.3:
|
||||
version "6.0.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.3.tgz#90251dc007916e972786cb94d74d15b185577d21"
|
||||
integrity sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==
|
||||
|
||||
"undici-types@>=7.24.0 <7.24.7":
|
||||
version "7.24.6"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.24.6.tgz#61275b485d7fd4e9d269c7cf04ec2873c9cc0f91"
|
||||
integrity sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==
|
||||
|
||||
Reference in New Issue
Block a user