-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #386 from transcom/bl-adr-use-asdf-for-node
ADR to use asdf for node as well as golang
- Loading branch information
Showing
16 changed files
with
187 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
16.15.0 | ||
18.13.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 18.13.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
brew 'nodenv' | ||
brew 'asdf' | ||
brew 'yarn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
docs/adrs/0081-use-asdf-to-manage-node-and-golang-versions-in-development.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: 0081 Use ASDF to Manage Node and Golang versions in Development | ||
--- | ||
|
||
# Use ASDF to Manage Node and Golang versions in Development | ||
|
||
:::info | ||
|
||
This ADR supersedes [ADR-0046](0046-use-nodenv.md) and [ADR-0056](0056-use-asdf-to-manage-golang-versions-in-development.md) | ||
|
||
::: | ||
|
||
## Considered Alternatives | ||
|
||
* Do nothing, keep using asdf for golang and nodenv for node | ||
* Use asdf to manage golang and node versions | ||
|
||
## Decision Outcome | ||
|
||
* Chosen Alternative: Use [asdf](https://asdf-vm.com/) to manage golang and node versions | ||
|
||
ADR-0056 notes that the original author would like to see asdf used for other tools (presumably such as node) | ||
|
||
> Admittedly we are not yet taking advantage of `asdf` for other tools, but I would like to see that happen. | ||
ADR-0056 also lists the following as a disadvantage of using asdf for golang and node: | ||
|
||
> installing node, yarn, or golang with asdf and another one of the similar tools can cause conflicts depending on which | ||
> of the version manager tools is first in a particular path. | ||
This is actually an advantage of using asdf, since one of the difficulties of managing asdf _and_ node is the obfuscation | ||
of which version will be shimmed by which tool. Picking and using _one_ tool is the solution. Since asdf is already required | ||
for managing go, and it is capable of managing node, it is the logical choice. | ||
|
||
If you have a capable tool, Alton Brown would recommend throwing the redundant "unitasker" out: | ||
> I have railed against unitaskers for 20 years. | ||
> | ||
> I've come around to liking them as strategic gifts for people you don't like. | ||
> - [Alton Brown on NPR's All Things Considered](https://www.npr.org/sections/thesalt/2015/12/23/460833325/the-unitasker-kitchen-gadgets-alton-brown-loves-to-loathe) | ||
## Pros and Cons of the Alternatives | ||
|
||
### Do nothing, keep using asdf for golang and nodenv for node | ||
|
||
* `+` requires no effort or decision energy | ||
* `+` has no impact on day-to-day operations of any onboarded engineers | ||
* `+` has no chance of introducing new issues because no changes would be made | ||
* `-` keeps relatively higher cognitive load around tooling | ||
* `-` Truss seems to prefer asdf on newer projects, so engineers onboarding from another project in the future will likely have to juggle multiple node version managers | ||
* `-` Provides no incentive to revisit onboarding instructions and scripting, which is [currently outdated or over-engineered, even for existing installation of golang via asdf](https://github.com/transcom/mymove/pull/11053/files#r1261749313) | ||
|
||
### Use asdf to manage golang and node versions | ||
|
||
* `+` asdf is already used for managing golang, so all engineers are familiar with the tool and are using it today | ||
* `+` simplifies environment setup | ||
* `+` reduces the number of tools required to maintain the project | ||
* `+` can be rolled out such that engineers can continue using nodenv until they choose to switch | ||
* `+` switching from nodenv to asdf is trivial | ||
* `+` Truss seems to prefer asdf on newer projects, so engineers onboarding from another project in the future will not likely have to juggle multiple node version managers | ||
* `-` without proper socialization and documentation updates, could add confusion | ||
* `-` changes core tooling that engineers have likely been using for some time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: How to Switch from nodenv to asdf for Managing Node Versions | ||
--- | ||
|
||
# How to Switch from [nodenv](https://github.com/nodenv/nodenv) to [asdf](https://asdf-vm.com/) for managing Node Versions | ||
|
||
[ADR-0081](../../../adrs/0081-use-asdf-to-manage-node-and-golang-versions-in-development.md) recommends using asdf for | ||
both Node and Go. Many folks are likely using nodenv today, and have the option to migrate at a time of their choosing. | ||
|
||
This guide assumes you already have asdf installed (for Go). If not, install asdf first. | ||
|
||
1. Uninstall nodenv | ||
|
||
``` | ||
$ brew uninstall nodenv | ||
``` | ||
|
||
2. Remove nodenv references from your shell profile file (e.g. `.zshrc`). You likely have a `eval "$(nodenv init -)"` there. | ||
|
||
3. Install the asdf nodejs plugin | ||
|
||
``` | ||
asdf plugin add nodejs | ||
``` | ||
|
||
4. Ensure project tool versions for the project are installed, by running the following from inside the project directory. | ||
|
||
``` | ||
asdf install | ||
``` | ||
|
||
Within mymove-docs, this will install the correct version of node. | ||
Within mymove, this will install the correct version of go and node. | ||
|
||
ASDF will automatically use the version(s) defined in `.tool-versions` whenever you are in a directory that has a `.tool-versions` file, so long as it has been installed, just like nodenv. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.