Skip to content

Commit

Permalink
Execute binaries from root node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan committed Nov 16, 2023
1 parent 4eddf51 commit bc7bd49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/generate-protos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit bc7bd49

Please sign in to comment.