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

YarnInstallTask should not declare yarn.lock as output if run with --frozen-lockfile

Open
#198 0 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

In #93 method getYarnLockFileAsOutput() was introduced to YarnInstallTask.kt which is annotated with @OutputFile.

The consequence is that the automatically generated task cleanYarn wants to remove that file.
In our workflow, this file is committed to git, so we get a dirty workspace when executing the 'clean' task for that project (which in turn executed the 'cleanYarn' task).

We do run the yarn task with the option --frozen-lockfile by default, and only turn it on with a gradle project option (i.e. we inverted the default behavior of yarn install)

I think the best solution would be to only declare yarn.lock as output if --frozen-lockfile is not set.

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 in YarnInstallTask.kt at getYarnLockFileAsOutput() and trace how the --frozen-lockfile option is handled. Done means yarn.lock is not declared as an output when that option is set, so cleanYarn does not remove the committed file, while the existing output behavior remains for other runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, nodejs
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.