npm-install
npm-install copied to clipboard
Using yarn but ignoring lockfile
Given a project with a yarn.lock
and calling the action with useLockFile: false
, I was surprised that it actually runs npm install
, instead of yarn --no-lockfile
. I would have expected the latter.
This seems to be intentional, looking at this code, but I wonder why?
@bahmutov - is this by design or can I open an MR to address this?
Ughh it seems like a bug
Sent from my iPhone
On Jun 20, 2021, at 10:37, Ian Gilkes @.***> wrote:
@bahmutov - is this by design or can I open an MR to address this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I have opened a pull request which hopefully addresses this issue.
Let me know how it goes!
https://github.com/bahmutov/npm-install/pull/102
@YenHub Thanks for tackling this! I have finally tried this, but still see the same (wrong) behavior (see https://github.com/kaliber5/ember-stargate/pull/322/checks?check_run_id=3905655494#step:4:40).
However it seems to me the action is not actually using the latest code, as the dist/index.js
files has been last updated 9 month ago! @bahmutov seems your automated publishing workflow isn't compiling the action automatically, so how is this supposed to work?
Another point: I think for the lockfile to be ignored, yarn
has to run with the --no-lockfile
option. So shouldn't this line be like follows?
const args = shouldUsePackageLock ? ['--frozen-lockfile'] : ['--no-lockfile']
Thanks @simonihmig for your update
RE:
const args = shouldUsePackageLock ? ['--frozen-lockfile'] : ['--no-lockfile']
Where an empty array is passed into exec
as args, no args are presented, therefore Yarn will run with it's default behaviour, that is, no lock file behaviour.
You effectively end up with:-
return exec.exec(quote(yarnPath), [], options)
Where an empty array is passed into exec as args, no args are presented, therefore Yarn will run with it's default behaviour, that is, no lock file behaviour.
I understand that, but the default behavior of yarn
is to take the lockfile into account!? (at least that is for yarn v1)