Open joscha opened 7 years ago
I introduced this because I noticed that a few people felt the need to fork protobuf.js without the cli to avoid the additional dependencies. The cleanest solution would be a -cli package probably.
I'd be happy to open a PR to make that happen - not sure how I would open a PR for the new CLI package though, do you want to create an empty repo for it in your name?
I'd probably just include it here similar to the packages in lib/
, making cli/
actually an npm package but excluding it from the top-level package through .npmignore
. That should be fine because the cli package will most likely have to be tightly coupled to the main package anyway.
Just hit this in CockroachDB - one of these dependencies moved and broke our CI.
This is a seriously bad practice - @joscha are you still working on a solution?
Yep, looks like jsdoc 3.5.0 changed something which causes the way it is being called from https://github.com/dcodeIO/protobuf.js/blob/6.8.0/cli/pbts.js, which causes randomly truncated output.
My bet is that there's an error popping out somewhere and not being handled.
@tamird Not working on a solution, sorry, as far as I remember, there were a few commits made in that direction however.
We're hitting this too. Perhaps I'm doing something unusual, but the cli's use of npm install
results in an npm_modules directory being adding in the protobufjs/cli subdirectory... a pretty surprising behavior.
@joscha the protobuf.js-cli
package solution seems like a great idea; @dcodeIO it sounds like you're amenable to a PR for this?
@dcodeIO what are the tasks remaining to complete this? I'd be happy to work on this.
Currently I'm carrying around a few hacks in my build process to prevent the cli tool from installing npms at run time.
Ping. Is there anything happening here? Fixing this issue seems like it should be pretty high priority, since shadow invoking NPM is such a dark pattern.
hey @dcodeIO, thanks for creating protobuf.js. Is there anything we can do to help get this CLI package over the line?
Hi there!
any solution for this issue?
It seems to have been open for a long time. We are experiencing the same problem on a monorepo with yarn workspaces and lerna. Due to concurrency, sometimes installing those dependencies using npm during the cli invocation causes very bad things to happen.
As someone mentioned, I think this is a very bad practice. These hidden dependencies are highly suspicious to any auditor and are undoubtedly the source of many problems.
Hi there!
any solution for this issue?
It seems to have been open for a long time. We are experiencing the same problem on a monorepo with yarn workspaces and lerna. Due to concurrency, sometimes installing those dependencies using npm during the cli invocation causes very bad things to happen.
As someone mentioned, I think this is a very bad practice. These hidden dependencies are highly suspicious to any auditor and are undoubtedly the source of many problems.
On my team, we worked around by using https://github.com/ds300/patch-package to remove the calls to util.setup()
in cli/pbjs.js and cli/pbts.js, and then made sure to list the relevant dependencies as devDependencies of our project.
Truly, finding npm install
in protobuf.js was one of the biggest wtf moments of my life. Like summoning the dead to solve a minor staffing issue.
Related to #1368
Could be fixed by #1234
But it was a big moment!
Our build broke because marked
is not park of yarn.lock
and now uses optional chaining, so won't work in node 10 anymore. Despite breaking backwards compatibility, this didn't happen with a major dependency version upgrade, and when pbts does its un-shrink-wrapped install, it just gets whatever latest version fulfills the dependency. :facepalm:
protobuf.js version: 6.6.5
When using the CLI version of protobuf.js, some additional dependencies are installed (they are defined without versions in
cliDependencies
of thepackage.json
. There are a few issues with this approach that I hope we can find a solution for:yarn
, meaning that whereverpbjs
was installed into does not havenpm
available on CI.Error: Cannot find module 'espree' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/Users/joscha/Development/wala/wala-sodaqone_3/node_modules/protobufjs/cli/targets/static.js:7:18)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
error Command failed with exit code 1.