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

chore: upgrade to yarn 4 #2697

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ project {
"**/coverage/**",
"ui/desktop/electron-app/out/**",
"ui/desktop/electron-app/ember-dist/**",
"**/.yarn/**"
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ yarn-error.log
# Ignore all local history of files
.history
.ionide

#yarn
.yarn/*
!.yarn/releases
934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.6.0.cjs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.6.0.cjs
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree about not pushing for corepack if it's unlikely to be used with node in the future. Is this method of vendoring yarn preferred over a community github action? Vendoring could be a good approach approach, I'm just wondering how do we would go about updating (and verifying) the vendored file in the future?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm googling this feedback

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking of doing manual updates, the local installation says whenever there is a new yarn update and that can be a good indicator to update yarn. Are you thinking of other alternatives that we can use in place of corepack? I did not investigate other options but might be worth considering in the future

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ will not be accepted.

[git]: https://git-scm.com/
[node]: https://nodejs.org/
[yarn]: https://classic.yarnpkg.com/lang/en/
[yarn]: https://yarnpkg.com/
[chrome]: https://google.com/chrome/
[firefox]: https://firefox.com/
[yarn-workspaces]: https://classic.yarnpkg.com/en/docs/workspaces/
[yarn-workspaces]: https://yarnpkg.com/features/workspaces
[homebrew]: https://brew.sh
[warp]: https://www.warp.dev
[vscode]: https://code.visualstudio.com/
Expand Down
7 changes: 5 additions & 2 deletions addons/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"ember-cli-babel": "^8.2.0",
"ember-cli-htmlbars": "^6.2.0",
"ember-cli-mirage": "^3.0.3",
"miragejs": "^0.1.48",
"ember-data": "~4.12.0",
"miragejs": "^0.1.48",
"tracked-built-ins": "^3.1.1"
},
"devDependencies": {
Expand Down Expand Up @@ -82,7 +82,10 @@
"configPath": "tests/dummy/config"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.hbs": "ember-template-lint --fix",
"*.{scss,yaml}": "prettier --write"
}
Expand Down
5 changes: 4 additions & 1 deletion addons/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@
"configPath": "tests/dummy/config"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.hbs": "ember-template-lint --fix",
"*.{scss,yaml}": "prettier --write"
}
Expand Down
8 changes: 6 additions & 2 deletions addons/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
"ember-feature-flags": "^6.0.0",
"ember-intl": "^7.0.7",
"ember-loading": "^2.0.0",
"ember-truth-helpers": "^3.0.0",
"ember-truth-helpers": "^4.0.3",
"filesize": "^10.0.7",
"lodash": "^4.17.21",
"sass": "^1.69.5"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.21.3",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@ember/optional-features": "^2.0.0",
Expand Down Expand Up @@ -98,7 +99,10 @@
"configPath": "tests/dummy/config"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.hbs": "ember-template-lint --fix",
"*.{scss,yaml}": "prettier --write"
}
Expand Down
10 changes: 8 additions & 2 deletions addons/rose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,15 @@
"configPath": "tests/dummy/config"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.hbs": "ember-template-lint --fix",
"*.scss": ["stylelint --fix", "prettier --write"],
"*.scss": [
"stylelint --fix",
"prettier --write"
],
"*.{mdx,yaml}": "prettier --write"
}
}
5 changes: 4 additions & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
"node": "20.* || 22.*"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.{scss,yaml}": "prettier --write"
}
}
62 changes: 30 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,37 @@
"addons/*",
"ui/*",
"e2e-tests"
],
"nohoist": [
"**/electron**"
Comment on lines -12 to -13
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we still planning on no hoisting? I realize now that this probably wasn't even working correctly as I'm not sure that glob was accurate and I think some electron packages moved namespaces to @electron at some point which we never updated

I also don't have context as to why we needed to nohoist them in the first place so I'm guessing we might not even need it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it does not look like we need to do the equivalent of nohoist in yarn 4, I tested it with and without in both yarn 1 and yarn4 and did not see any issue so my guess is that it is not needed.

]
},
"scripts": {
"build": "yarn build:ui:admin",
"build:ui:admin": "yarn --cwd ui/admin build",
"build:ui:admin:oss": "yarn --cwd ui/admin build:oss",
"build:ui:admin:enterprise": "yarn --cwd ui/admin build:enterprise",
"build:ui:admin:hcp": "yarn --cwd ui/admin build:hcp",
"build:ui:desktop": "yarn --cwd ui/desktop build",
"build:ui:desktop:production": "yarn --cwd ui/desktop build:production",
"build:ui:desktop:app": "yarn --cwd ui/desktop build:desktop",
"build:ui:admin": "yarn workspace admin build",
"build:ui:admin:oss": "yarn workspace admin build:oss",
"build:ui:admin:enterprise": "yarn workspace admin build:enterprise",
"build:ui:admin:hcp": "yarn workspace admin build:hcp",
"build:ui:desktop": "yarn workspace desktop build",
"build:ui:desktop:production": "yarn workspace desktop build:production",
"build:ui:desktop:app": "yarn workspace desktop build:desktop",
"lint": "concurrently \"yarn:lint:*\" --names \"lint:\"",
"lint:addons-api": "yarn --cwd addons/api lint",
"lint:addons-auth": "yarn --cwd addons/auth lint",
"lint:addons-core": "yarn --cwd addons/core lint",
"lint:addons-rose": "yarn --cwd addons/rose lint",
"lint:ui-admin": "yarn --cwd ui/admin lint",
"lint:ui-desktop": "yarn --cwd ui/desktop lint",
"lint:addons-api": "yarn workspace api lint",
"lint:addons-auth": "yarn workspace auth lint",
"lint:addons-core": "yarn workspace core lint",
"lint:addons-rose": "yarn workspace rose lint",
"lint:ui-admin": "yarn workspace admin lint",
"lint:ui-desktop": "yarn workspace desktop lint",
"test": "concurrently \"yarn:test:*\" --names \"test:\"",
"test:addons-api": "yarn --cwd addons/api test",
"test:addons-auth": "yarn --cwd addons/auth test",
"test:addons-core": "yarn --cwd addons/core test",
"test:addons-rose": "yarn --cwd addons/rose test",
"test:ui-admin": "yarn --cwd ui/admin test",
"test:ui-desktop": "yarn --cwd ui/desktop test",
"compliance:licenses": "license-checker --onlyAllow 'Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;BUSL-1.1;Public Domain;Python-2.0;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'boundary-ui;[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];@hashicorp/[email protected];[email protected]'",
"test:addons-api": "yarn workspace api test",
"test:addons-auth": "yarn workspace auth test",
"test:addons-core": "yarn workspace core test",
"test:addons-rose": "yarn workspace rose test",
"test:ui-admin": "yarn workspace admin test",
"test:ui-desktop": "yarn workspace desktop test",
"compliance:licenses": "license-checker --onlyAllow 'Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;BUSL-1.1;Public Domain;Python-2.0;Unicode-TOU;Unlicense;WTFPL;BlueOak-1.0.0' --excludePackages 'boundary-ui;[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];@hashicorp/[email protected];[email protected]'",
"doc:toc": "doctoc README.md",
"prepare": "husky"
},
"devDependencies": {
"concurrently": "^9.1.0",
"cz-conventional-changelog": "^3.3.0",
"doctoc": "^2.2.0",
"git-cz": "^4.9.0",
Expand All @@ -49,20 +47,20 @@
"lint-staged": "^15.2.10"
},
"resolutions": {
"**/nomnom/underscore": "^1.12.1",
"**/core/ember-inline-svg/**/nth-check": "^2.0.1",
"**/ember-cli/**/ansi-html": "^0.0.9",
"**/ember-cli/testem/fireworm/async": "^2.6.4",
"**/@hashicorp/design-system-components/ember-stargate": "^0.6.0",
"micromatch": "^4.0.8"
"nomnom/underscore": "^1.12.1",
"@hashicorp/design-system-components/ember-stargate": "^0.6.0",
"micromatch": "^4.0.8",
"ember-inline-svg/nth-check": "^2.0.1",
"node-gyp": "^10.0.0",
"ember-cli/ansi-html": "^0.0.9",
"fireworm/async": "^2.6.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "git-cz"
}
},
"engines": {
"node": "20.* || 22.*"
},
"packageManager": "[email protected]+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
}
}
16 changes: 10 additions & 6 deletions ui/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"format:js": "prettier --write '{app,config,stories,tests}/**/*.js' *.js",
"format:sass": "prettier --write app/**/*.scss",
"start": "ember serve",
"clean:coverage": "rm -rf coverage_*",
"pretest": "yarn clean:coverage",
"test": "concurrently \"npm:test:*\" --names \"test:\"",
"clean:coverage": "rm -rf coverage_* || true",
"test": "yarn clean:coverage && concurrently \"npm:test:*\" --names \"test:\" && yarn test:finalize",
"test:ember": "COVERAGE=true ember exam --test-port 0 --split=4 --parallel=1 --random",
"posttest": "ember coverage-merge && yarn clean:coverage"
"test:finalize": "ember coverage-merge && yarn clean:coverage"
},
"dependencies": {
"@babel/runtime": "7.12.18",
"ember-named-blocks-polyfill": "^0.2.5",
"lodash": "^4.17.21",
"uuid": "^11.0.3"
Expand Down Expand Up @@ -76,7 +76,7 @@
"ember-load-initializers": "^2.1.2",
"ember-modifier": "^4.1.0",
"ember-page-title": "^7.0.0",
"ember-pollster": "https://github.com/hashicorp/ember-pollster.git#718db797382b04aca281216319885c5ff625f539",
"ember-pollster": "https://github.com/hashicorp/ember-pollster.git#605d82e986d829b098667e4a5e221877a4ee4ac8",
"ember-qunit": "^8.1.0",
"ember-resolver": "^10.0.0",
"ember-source": "~4.12.0",
Expand All @@ -89,6 +89,7 @@
"eslint-plugin-qunit": "^8.0.1",
"js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1",
"loader.js": "^4.7.0",
"postcss": "^8.4.31",
"prettier": "^3.0.0",
"qunit": "^2.22.0",
"qunit-dom": "^3.2.1",
Expand All @@ -107,7 +108,10 @@
"edition": "octane"
},
"lint-staged": {
"*.js": ["eslint --fix", "prettier --write"],
"*.js": [
"eslint --fix",
"prettier --write"
],
"*.hbs": "ember-template-lint --fix",
"*.{scss,yaml}": "prettier --write"
}
Expand Down
3 changes: 3 additions & 0 deletions ui/desktop/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@

# broccoli-debug
/DEBUG/

#yarn
.yarn/*
3 changes: 3 additions & 0 deletions ui/desktop/electron-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@ ember-test/

# Autoupdate
nextVersion/

#yarn
.yarn/*
16 changes: 0 additions & 16 deletions ui/desktop/electron-app/config/forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,5 @@ module.exports = {
});
});
},
packageAfterPrune: async (_, buildPath) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

since we are pinning node-gyp v10, we don't need this workaround anymore, I tested it, but lmk if there's anything I missed

// This is needed to delete temporary sym links when creating an asar during
// building for native node modules.

// TODO: This issue was fixed and merged in a recent PR as noted here
// https://github.com/nodejs/node-gyp/issues/2713 so we should update node-gyp
// when it gets released and remove this workaround
const gypPath = path.join(
buildPath,
'node_modules',
'node-pty',
'build',
'node_gyp_bins',
);
await fs.promises.rm(gypPath, { recursive: true, force: true });
},
},
};
13 changes: 6 additions & 7 deletions ui/desktop/electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
"build:config": "node -e \"require('./config/desktop.js').setup()\"",
"start": "electron-forge start",
"package": "electron-forge package",
"premake": "yarn build:cli && yarn build:config",
"make": "electron-forge make",
"configure": "yarn build:cli && yarn build:config",
"make": "yarn configure && electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\"",
"postinstall": "patch-package"
"lint": "echo \"No linting configured\""
},
"keywords": [],
"config": {
Expand All @@ -43,11 +42,11 @@
"@electron-forge/maker-squirrel": "^7.2.0",
"@electron-forge/maker-zip": "^7.2.0",
"electron": "31.0.1",
"unzipper": "^0.11.5",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0"
"unzipper": "^0.11.5"
},
"resolutions": {
"highlight.js": "^10.4.1"
"highlight.js": "^10.4.1",
"node-gyp": "^10.0.0"
}
}
45 changes: 0 additions & 45 deletions ui/desktop/electron-app/patches/lodash.template+4.5.0.patch

This file was deleted.

Loading