Skip to content

Commit

Permalink
chore: replace protoc with @pingghost/protoc
Browse files Browse the repository at this point in the history
Ref: arduino/arduino-ide#2457
Signed-off-by: dankeboy36 <dankeboy36@gmail.com>
  • Loading branch information
dankeboy36 committed Nov 17, 2024
1 parent 64a5ac8 commit 5fa927a
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 116 deletions.
232 changes: 119 additions & 113 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
"prepublishOnly": "npm run test && npm run compile && npm run lint && npm run format"
},
"dependencies": {
"@pingghost/protoc": "^1.0.2",
"commander": "^10.0.1",
"debug": "^4.3.4",
"execa": "^7.1.1",
"globby": "^13.1.4",
"https-proxy-agent": "^5.0.1",
"nice-grpc-common": "^2.0.0",
"protobufjs": "^7.2.3",
"protoc": "^1.1.3",
"rimraf": "^5.0.1",
"semver": "^7.5.1",
"tmp-promise": "^3.0.3",
Expand Down
7 changes: 6 additions & 1 deletion src/__tests__/generate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ describe('generate', () => {
await dir(async (path) => {
const out = join(path, 'src-gen');
await generate({
src: join(require.resolve('protoc'), '..', 'protoc', 'include'),
src: join(
require.resolve('@pingghost/protoc'),
'..',
'protoc',
'include'
),
out,
});
await execa('npm', ['link', 'protobufjs']);
Expand Down
3 changes: 2 additions & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ async function generate(
throw new Error(`Failed to create '--out' ${out}: ${err}`);
}

// Credit: https://github.com/arduino/arduino-ide/pull/2457/commits/f842badea8b0272f697db9c06ad31da732e62f45
// eslint-disable-next-line @typescript-eslint/no-var-requires
const protoc = require('protoc/protoc'); // TODO: add support for external protoc
const protoc = require('@pingghost/protoc/protoc'); // TODO: add support for external protoc
const plugin = plugins[name];
const args = [...createArgs([name, plugin], src, out), ...protos];
log('executing %s with args %j', protoc, args);
Expand Down

0 comments on commit 5fa927a

Please sign in to comment.