# node_runtime: Use \`semver::Version\` to represent package versions \(\#44342\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c0b3422941bbc2a110c1999ff288ff99aa77aeca)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c0b3422941bbc2a110c1999ff288ff99aa77aeca

Requested commit: c0b3422941bbc2a110c1999ff288ff99aa77aeca

Commit: c0b3422941bbc2a110c1999ff288ff99aa77aeca

Tree: 81af2be442b7971e8cf3348b42d69eb821b64f43

Author: tidely

Committer: GitHub

## Message

```
node_runtime: Use `semver::Version` to represent package versions (#44342)

Closes #ISSUE

This PR is rather a nice to have change than anything critical, so
review priority should remain low.

Switch to using `semver::Version` for representing node binary and npm
package versions. This is in an effort to root out implicit behavior and
improve type safety when interacting with the `node_runtime` crate by
catching invalid versions where they appear. Currently Zed may
implicitly assume the current version is correct, or always install the
newest version when a invalid version is passed. `semver::Version` also
doesn't require the heap, which is probably more of a fun fact than
anything useful.

`npm_install_packages` still takes versions as a `&str`, because
`latest` can be used to fetch the latest version on npm. This could
likely be made into an enum as well, but would make the PR even larger.

I tested changes with some node based language servers and external
agents, which all worked fine. It would be nice to have some e2e tests
for node. To be safe I'd put it on nightly after a Wednesday release.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
```

## Parents

- [010b871a8e94d50f1ae33cb60819b46a9334e332](https://git.cafe/gitcafe/zed/commit/010b871a8e94d50f1ae33cb60819b46a9334e332?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c0b3422941bbc2a110c1999ff288ff99aa77aeca?format=markdown)
