check-node-version icon indicating copy to clipboard operation
check-node-version copied to clipboard

Support to check .tool-versions

Open Ajwah opened this issue 2 years ago • 1 comments

Request

  • Does it make sense to parse ASDF's .tool-versions to obtain the node version that applies and compare that it corresponds to the node version as installed?

Clarification/Context

  • I just had an issue with my AWS CI/CD pipeline where I pull the nodejs:lts image causing my build to fail on Oct 25th as at that point the LTS version changed (as it is bound to do on a yearly basis.) from 16.X -> 18.X.

  • Another reason where this may apply is in terms of onboarding. Not everyone uses ASDF and in this way I can introduce some automated accountability across the board.

For the time being I can use this repo as follows to fulfill my objective by including a script in my package.json:

"check-node-version": "check-node-version --print --node $(cat .tool-versions | grep 'nodejs ' | cut -d' ' -f2)"

UPDATE:

Just tested out on my pipeline and it worked flawlesly:


[Container] 2022/10/29 14:58:44 Running command npm run check-node-version
--
55 | > check-node-version --print --node $(cat .tool-versions \| grep 'nodejs ' \| cut -d' ' -f2)
56 |  
57 | node: 18.12.0
58 | Wanted node version 16.16.0 (16.16.0)
59 | To install node, see https://nodejs.org/download/release/v16.16.0/

Perhaps we could have a solution of this nature be available with the option: --asdf ?

Ajwah avatar Oct 29 '22 14:10 Ajwah

I would be open to supporting asdf's .tool-versions -- would you be interested in sending a PR?

parshap avatar Oct 29 '22 15:10 parshap