A NodeJS-based software often uses a NodeJS package manager (NPM or Yarn) for building and/or running the software. Currently a porter must manually specify a package manager depending on the same major version according to USES=nodejs:<version>. Something like:
USES= nodejs:14 BUILD_DEPENDS= www/npm-node14>0:www/npm-node14
This proposal adds USE_NODEJS variable to nodejs.mk for specifying the NodeJS package manager used by a port.
USES= nodejs:14 USE_NODEJS= npm
adds BUILD_DEPENDS= www/npm-node14>0:www/npm-node14
If current version of NodeJS is used:
USES= nodejs:current USE_NODEJS= npm
adds BUILD_DEPENDS= www/npm>0:www/npm
So a porter does not have to manually ensure that NodeJS's major version and that of a package manager's are the same.
Additionally, fetch, extract, patch, build, run, and/or test can be taken as arguments to specify a specific *_DEPENDS like:
FETCH_DEPENDS= www/npm>0:www/npm BUILD_DEPENDS= www/npm>0:www/npm
P.S. I would like elastic (for textproc/kibana7) and opensearch (for textproc/opensearch-dashboards) teams to review this proposal. Does anybody know who I should contact?