Skip to content

fix moduleName to support npm config/mirrors #372

@plandem

Description

@plandem

Environment Information

  • OS: any
  • Node Version: any
  • NPM Version: any
  • C++ Toolchain: any
  • confluent-kafka-javascript version: 1.5.0

Steps to Reproduce

library uses such confluent-kafka-javascript as module_name for node-pre-gyp. but:

  1. node-pre-gyp replaces first dash with underscore (even last version of node-pre-gyp), https://github.com/mapbox/node-pre-gyp/blob/f9b39484f17955d83cdab42c178a600467fe96bd/lib/util/versioning.js#L312, so validModuleName transforms into confluent_kafka-javascript.

  2. npm replaces all dashes for npm config, so it always will transform it into npm_config_confluent_kafka_javascript_binary_host_mirror

  3. as result mirror will not be possible to set/use, because this will never work:

const host = process.env['npm_config_' + validModuleName + '_binary_host_mirror'] || package_json.binary.host;

have: npm_config_confluent_kafka_javascript_binary_host_mirror
want: npm_config_confluent_kafka-javascript_binary_host_mirror

So, I see only two options here - a) fix node-pre-gyp or b) change module_name and replace dashes with underscore. suppose b) is easier and npm config is not working anyway

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions