fix proto generation script
All checks were successful
Publish NPM Package / Publish Job (push) Successful in 1m42s

This commit is contained in:
lendry
2026-05-21 22:07:48 +03:00
parent 5075c37e5e
commit b86057dfcf

View File

@@ -13,6 +13,14 @@ const rootDir = process.cwd()
const protoRoot = 'proto'
const genRoot = 'gen'
const isWindows = process.platform === 'win32'
const tsProtoBinDir = join(rootDir, 'node_modules', '.bin')
const tsProtoPlugin = isWindows
? join(tsProtoBinDir, 'protoc-gen-ts_proto.cmd')
: join(tsProtoBinDir, 'protoc-gen-ts_proto')
function toUnixPath(path) {
return path.replaceAll('\\', '/')
}
@@ -42,11 +50,8 @@ if (!existsSync(protoRoot)) {
process.exit(1)
}
const tsProtoBinDir = join('node_modules', '.bin')
const tsProtoCmd = join(tsProtoBinDir, 'protoc-gen-ts_proto.cmd')
if (!existsSync(tsProtoCmd)) {
console.error('ts-proto plugin not found.')
if (!existsSync(tsProtoPlugin)) {
console.error(`ts-proto plugin not found: ${tsProtoPlugin}`)
console.error('Run: yarn add -D ts-proto')
process.exit(1)
}
@@ -69,8 +74,6 @@ mkdirSync(genRoot, {
const env = {
...process.env,
// Windows обычно использует Path, Linux/macOS используют PATH.
PATH: `${tsProtoBinDir}${delimiter}${process.env.PATH ?? ''}`,
Path: `${tsProtoBinDir}${delimiter}${process.env.Path ?? ''}`,
}