node-gradle / node-gradle/gradle-node-plugin

Add possibility to download nodejs binary once and re-use it in different modules

Open
#109 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Groovy
Stars
677
Forks
120
PR merge metrics
No merged PRs in 30d

Description

Hi! Correct me if I'm wrong but from what I see user of gradle-node-plugin is supposed to choose between two options:

  1. to download specific version of node.js
  2. to rely on existence of globally installed node.js

However in multimodule projects there's quite often a need to be able to download nodejs once but to point to that particular binary everywhere.

Again, correct me if I'm wrong, but from what I see reading the code - if, say, N modules are configure like this:

node {
    workDir = ...

    version = gradle.nodeVersion
    npmVersion = gradle.npmVersion
    yarnVersion = gradle.yarnVersion

    nodeModulesDir = ... // subproject-specific node_modules path
    download = true
}

than nodejs will be downloaded N times and every next module will start with deleting nodejs distrib installed by previous one.
Not only this is suboptimal but introduces lost of unpredicted troubles (for instance, with a parallel build)

So I'm either asking:
Is there a way to download nodejs only once and reuse it in different modules?

If the answer is positive than I would like to know how exactly it can be done.
If there's no such feature I'd be glad to propose it and even to implement if needed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the multimodule Gradle configuration shown in the issue, then inspect how each module handles the configured Node.js download and work directory. Done means the configuration can download one Node.js binary and reuse it across modules without repeated deletion or parallel-build conflicts; verify this with a multimodule build.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, nodejs
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.