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: upgrade to yarn v4 #666

Closed
wants to merge 11 commits into from
Closed

Conversation

jaredallard
Copy link
Contributor

@jaredallard jaredallard commented Sep 21, 2023

Upgrades to yarn v4. Changes the installation method from npm to
corepack, which is the recommended way to install yarn1.

Migrates devbase to use v4 of yarn, changes some templates to
enable this:

Added a asdf_display_versions function to lib/asdf.sh that shows the
current tools and their relevant versions in use. This is displayed during
the setup_environment step of CI.

Footnotes

  1. https://yarnpkg.com/getting-started/install

@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from cb56150 to 7101975 Compare September 21, 2023 21:43
jaredallard added a commit to getoutreach/stencil-base that referenced this pull request Sep 21, 2023
Upgrades to using yarn v3. Relies on getoutreach/devbase#666
@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from 7101975 to e1f36d9 Compare September 21, 2023 22:17
Upgrades to `yarn` v3. Changes the installation method from `npm` to
`corepack`, which is the recommended way to install yarn[^1].

Migrates `devbase` to use v3 of `yarn`, a follow up PR to stencil-base
will change the `package.json` and `.gitignore`.

[^1]: https://yarnpkg.com/getting-started/install
@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from e1f36d9 to a864af5 Compare September 21, 2023 22:22
jaredallard added a commit to getoutreach/stencil-base that referenced this pull request Sep 21, 2023
Upgrades to using yarn v3. Relies on getoutreach/devbase#666
@getoutreach-ci-2

This comment was marked as outdated.

@getoutreach-ci-2

This comment was marked as outdated.

Checks the global npm registry for `yarn`, if it exists we uninstall
it.
@getoutreach-ci-1

This comment was marked as outdated.

@jaredallard
Copy link
Contributor Author

Not sure if I like the asdf versions display I added in this PR, I'll probably make it so it only runs on the setup environment step. Otherwise, it seems like it could pollute CI in other places (see logs)

@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from 7403ccc to 21b017a Compare September 22, 2023 01:55
@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from 21b017a to 0e7b492 Compare September 22, 2023 01:55
@@ -18,5 +18,5 @@ validate-orb: build-orb

.PHONY: publish-orb
publish-orb: validate-orb
circleci orb publish orb.yml getoutreach/shared@dev:first
circleci orb publish orb.yml getoutreach/shared@dev:jaredallard-feat-yarn-v3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reset before merge.

@getoutreach-ci-1

This comment was marked as outdated.

@getoutreach-ci-2

This comment was marked as outdated.

Updates cache paths to have better uniformity as well as use `yarn.lock`
to handle lockfile-only changes.
@jaredallard jaredallard force-pushed the jaredallard/feat/latest-yarn branch from 140d3d5 to af40bf0 Compare September 22, 2023 02:26
@getoutreach-ci-1

This comment was marked as outdated.

jaredallard added a commit to getoutreach/stencil-golang that referenced this pull request Sep 22, 2023
Upgrades the node client to use `yarn` v3. Depends on the following PRs:

* getoutreach/devbase#666
* getoutreach/stencil-base#139
@@ -2,7 +2,7 @@
# syntax, such as anchors, will be fixed automatically.
version: 2.1
orbs:
shared: getoutreach/shared@2.19.2
shared: getoutreach/shared@dev:jaredallard-feat-yarn-v3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change back to dev:first before merging (publish to dev:first before merging locally)

@@ -3,4 +3,4 @@ steps:
- run:
name: Build Node Client
working_directory: api/clients/node/
command: yarn --frozen-lockfile build
Copy link
Contributor Author

Choose a reason for hiding this comment

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

--frozen-lockfile isn't required when running scripts now.

- run:
name: Install semantic-release Dependencies
command: yarn --frozen-lockfile
command: yarn --immutable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

--frozen-lockfile was replaced by --immutable

@@ -7,15 +7,6 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/../lib/she
yarn_install_if_needed() {
local stateFile="node_modules/devbase.lock"

if ! yarn -v >/dev/null 2>&1; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duplicative code, we do this as part of setup_environment, which calls ensure_asdf, which is ran on local machines and CI.

@@ -15,12 +15,18 @@ if [[ -z $asdf_plugins_list ]]; then
asdf_plugins_list_regenerate
fi

# asdf_find_tool_versions returns all .tool-version files that could
# be used in the current repository.
asdf_find_tool_versions() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split out to enable asdf_display_versions

@@ -11,13 +11,13 @@ extensions=(yaml yml json md ts)

prettier_linter() {
yarn_install_if_needed >/dev/null
find_files_with_extensions "${extensions[@]}" | xargs -n40 "node_modules/.bin/prettier" -l --loglevel log
Copy link
Contributor Author

Choose a reason for hiding this comment

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

node_modules/.bin isn't a thing in pnpm linking. yarn run <script> has always supported doing this for us, so this is more clean this way anyways.

@jaredallard jaredallard marked this pull request as ready for review September 22, 2023 02:35
@jaredallard jaredallard requested review from a team as code owners September 22, 2023 02:35
@getoutreach-ci-1
Copy link
Contributor

Link to code coverage report (posted by coverbot 🤖)

jaredallard added a commit to getoutreach/stencil-golang that referenced this pull request Nov 2, 2023
Upgrades the node client to use `yarn` v4. Depends on the following PRs:

* getoutreach/devbase#666
* getoutreach/stencil-base#139
@getoutreach-ci-2
Copy link

Link to code coverage report (posted by coverbot 🤖)

jaredallard added a commit to getoutreach/stencil-base that referenced this pull request Nov 2, 2023
Upgrades to using yarn v4. Relies on getoutreach/devbase#666
jaredallard added a commit to getoutreach/stencil-base that referenced this pull request Nov 2, 2023
Upgrades to using yarn v4. Relies on getoutreach/devbase#666
@jaredallard jaredallard changed the title feat: upgrade to yarn v3 feat: upgrade to yarn v4 Nov 2, 2023
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.

1 participant