confluentinc / confluentinc/confluent-kafka-javascript

fix moduleName to support npm config/mirrors

Open
#372 1 comment 0 reactions 0 assignees View on GitHub
status:waiting-for-interest
Dominant language
TypeScript
Stars
304
Forks
45
Avg merge
11h 47m
Merged PRs (30d)
5

Description

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.