Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement downloader #2

Merged
merged 16 commits into from
Nov 5, 2023
Merged

feat: implement downloader #2

merged 16 commits into from
Nov 5, 2023

Conversation

nhedger
Copy link
Member

@nhedger nhedger commented Nov 2, 2023

This PR implements a downloader that prompts users to download the Biome CLI if none is found. It is meant to replace the current strategy of bundling the CLI with the extension with every release.

Screen.Recording.2023-11-03.at.19.00.54.mov

Testing

  1. pnpm install
  2. F5
  3. Create a new folder with a biome.json file inside
  4. Open that folder
  5. Click on the biome.json file
  6. A notification stating that biome is not installed should appear. click download
  7. When biome is installed, try formatting a file
  8. Click on the biome status bar, downgrade the version, the version should change

Fair warning

The code is admittedly a bit spaghetti, but I think it will do fine for now. We'll have to overhaul the majority of the logic if we want to support testing and more features in the future.

@nhedger nhedger marked this pull request as ready for review November 3, 2023 16:34
@SuperchupuDev
Copy link
Member

SuperchupuDev commented Nov 3, 2023

does the node version used in the minimum supported vscode version support global fetch? if so we could use it and avoid adding an additional dependency, or use undici's fetch which node uses under the hood, or i might be wrong altogether as i havent ever worked on vscode extensions

@nhedger
Copy link
Member Author

nhedger commented Nov 3, 2023

I believe Node's fetch API was released with Node 18. The version of Node used by the minimum supported version is Node 16.

That being said, in reading your comment I realize that I haven't confirmed that it works with 1.80 either, so I'll do that.

@nhedger
Copy link
Member Author

nhedger commented Nov 3, 2023

As expected, it did not work. I was able to polyfill fetch with ofetch, so we'll keep the dependency anyway for now.

Copy link
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

package.json Outdated Show resolved Hide resolved
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good to me, and I think it's an excellent feature! I left some suggestions

src/downloader.ts Show resolved Hide resolved
src/downloader.ts Outdated Show resolved Hide resolved
src/downloader.ts Show resolved Hide resolved
src/downloader.ts Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
src/statusBar.ts Show resolved Hide resolved
@nhedger
Copy link
Member Author

nhedger commented Nov 5, 2023

I ended up adding the command for clearing the versions cache if only to be used by us while developing the extension.

@nhedger nhedger merged commit 7fbb70c into main Nov 5, 2023
3 checks passed
@nhedger nhedger deleted the feat/downloader branch November 5, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants