Skip to content

cliDependencies and npm dependency #716

Open
@joscha

Description

@joscha

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 the package.json.
There are a few issues with this approach that I hope we can find a solution for:

  • The project I am using is using yarn, meaning that wherever pbjs was installed into does not have npm available on CI.
  • Locally there is npm available, but quite often the install fails:
$ ./proto/gen.js.sh
installing jsdoc@^3.4.2
installing [email protected]
installing espree@^3.1.3
installing escodegen@^1.8.1
module.js:472
    throw err;
    ^

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.<anonymous> (/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.
  • The dependencies that are installed on-the-fly are not part of any yarn.lock or npm-shrinkwrap.json, meaning that the installation can 1) not be cached easily 2) not be reproduced easily 3) yarn will blow away any installed packages not part of the lock file any time yarn install is run 4) npm shrinkwrap will wet itself because there are additional packages installed.

A couple solutions come to mind:

  • Make these actual dependencies - after all they are used at runtime
  • Create a protobuf.js-cli package that has a dependency on the protobuf.js package and on all the CLI dependencies. That way this package could be lightweight for the people that are not interested in the CLI.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions