From bc7bd49d32eef2d314e1f3021efffdf7504efe12 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 16 Nov 2023 14:25:06 -0500 Subject: [PATCH] Execute binaries from root node modules --- scripts/generate-protos.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/generate-protos.js b/scripts/generate-protos.js index bb9b47b0a4..21c84763e8 100644 --- a/scripts/generate-protos.js +++ b/scripts/generate-protos.js @@ -4,6 +4,7 @@ const cp = require('child_process'); const path = require('path'); const appRoot = process.cwd(); +const rootBinDir = path.resolve(__dirname, '..', 'node_modules', '.bin'); const generatedPath = path.resolve(appRoot, './src/generated'); const protosPath = path.resolve(appRoot, './protos'); @@ -40,7 +41,7 @@ function pbts(pbjsOutFile) { const pbtsOptions = [ '-o', path.join(generatedPath, 'root.d.ts'), ]; - return exec('npx', ['--package=protobufjs-cli', 'pbts', ...pbtsOptions, pbjsOutFile]); + return exec(path.resolve(rootBinDir, 'pbts'), [...pbtsOptions, pbjsOutFile]); } async function pbjs(files) { @@ -52,7 +53,7 @@ async function pbjs(files) { '--null-defaults', '-o', outFile, ]; - await exec('npx', ['--package=protobufjs-cli', 'pbjs', ...pbjsOptions, ...files]); + await exec(path.resolve(rootBinDir, 'pbjs'), [...pbjsOptions, ...files]); return outFile; }