Execute binaries from root node modules (#4302)

This commit is contained in:
Daniel Dyla 2023-11-16 15:56:26 -05:00 committed by GitHub
parent 4eddf51eb9
commit 51be418b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}