setup-purescript icon indicating copy to clipboard operation
setup-purescript copied to clipboard

Don't use the versions file for tools installed via NPM

Open thomashoneyman opened this issue 4 years ago • 2 comments

The versions file exists to avoid rate limits imposed by GitHub when getting the latest release for various tools via the GitHub API. However, if a user specifies they want the latest tool and the tool is installed via NPM, then we should skip the versions file and just NPM install the latest -- we don't get rate limited on that.

thomashoneyman avatar Aug 08 '21 23:08 thomashoneyman

This function decides whether to fetch an exact version of a tool (because the user specified an exact version) or to look up the latest version in the versions file:

https://github.com/purescript-contrib/setup-purescript/blob/915bfb653aecc5e87c39601c4c7f10e7372578fd/src/Setup/BuildPlan.purs#L54-L80

However, if the InstallMethod for a tool is NPM:

https://github.com/purescript-contrib/setup-purescript/blob/915bfb653aecc5e87c39601c4c7f10e7372578fd/src/Setup/Data/Tool.purs#L78-L80

...then we should skip the versions file altogether and just NPM install the tool at its latest version according to NPM:

https://github.com/purescript-contrib/setup-purescript/blob/915bfb653aecc5e87c39601c4c7f10e7372578fd/src/Setup/Data/Tool.purs#L94-L148

Currently that only covers psa and purs-tidy.

thomashoneyman avatar Aug 08 '21 23:08 thomashoneyman

Does something like this (https://github.com/purescript-contrib/setup-purescript/pull/24) make sense as a possible fix?

pete-murphy avatar Aug 10 '21 17:08 pete-murphy