From ba4de42a4bb30c95999e563c84ae6e5b30796864 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 17 Nov 2023 01:40:02 -0500 Subject: [PATCH] Execute binaries from root node modules (#4304) --- 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; }