fix proto generation script
All checks were successful
Publish NPM Package / Publish Job (push) Successful in 1m42s
All checks were successful
Publish NPM Package / Publish Job (push) Successful in 1m42s
This commit is contained in:
@@ -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 ?? ''}`,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user