-
Notifications
You must be signed in to change notification settings - Fork 284
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
Migrate Project from npm to Yarn #5106
Migrate Project from npm to Yarn #5106
Conversation
ca88d33
to
3c5c59d
Compare
I requested 3 reviewers to get good coverage on this change. It would be best if we were able to get this through without any noted regressions in our supported development platforms. Let me know if you have any questions, comments, or concerns. |
Not ready to do the big review button yet. This looks straightforward, but I definitely can't be the only reviewer here. Some notes:
I need to test this on Windows as well, in a VM. I'm concerned about our setup scripts on Windows, and the readme. The We should have a goal that someone who later joins the project doesn't have to be aware that we once used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my bigger comment...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything wrong with the current changes. I tested everything I can think of, and it all works. However:
-
README.md is missing instructions on how to install
yarn
for all three platforms. This is particularly important because we are usingyarn
classic, which is not obvious. -
npm
still appears in many places in the repo (bats tests and README.md are the most prominent ones). I think at least some of these cases should be replaced byyarn
. I won't list them here - you can see them withgit grep npm
. -
When switching to
yarn
, I had to do ayarn global add node-gyp
to getyarn install
to work. Maybe we should add this to the Linux developer docs? It's odd that I never had to do this withnpm
though.
This is interesting and requires more testing. I'm working in Linux (openSUSE Tumbleweed) and have not needed to do the same. I think that we should investigate more closely to understand why you would need this requirement and I wouldn't. |
@adamkpickering I'm not able to repro the scenario you outlined above with the following repro steps
This succeeds without any failure in my VM. I don't think that the installation of yarn should interfere with the original Footnotes |
@adamkpickering @ericpromislow I think this is ready for another review. Since our last review, I've update the installation instructions to include yarn and reviewed the remaining usages of I think the remaining instances of npm used throughout look appropriate. This is what I used to review
A majority of the matches for bats come from |
f42b780
to
1e38e55
Compare
@adamkpickering I made the changes to BATS, this is ready for another review when you are ready. |
The BATS changes look fine to me; I won't be reviewing the rest of the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ git grep -n using_npm_run_dev bats
bats/tests/containers/auto-start.bats:34: if using_npm_run_dev; then
bats/tests/containers/auto-start.bats:60: if using_npm_run_dev; then
These two instances need to be changed to using_dev_mode
I didn't run all of bats. yarn dev
worked fine, trying build... package
now.
I see that some of our identifiers/strings that contain the npm
substring are coming
from node_modules/
and they're out of our control -- that's fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Let's do it.
I will be waiting for #5162 to merge before this so that we can rebase and resolve the Windows issues described above. |
8ed1104
to
07b6272
Compare
@adamkpickering @ericpromislow rebased and ready for one more review. Like @ericpromislow mentioned, there were a few more instances of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything is working as far as I can tell.
Update lockfile Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This resolves `TS18022` that arose as a result of pinning typescript to `4.5.4` ``` ERROR ERROR in pkg/rancher-desktop/backend/backendHelper.ts:24:10 11:08:03 TS18022: A method cannot be named with a private identifier. 22 | * preceded by an odd number of backslashes. 23 | */ > 24 | static #escapeChar(match: any, slashes: string, char: string) { | ^^^^^^^^^^^ 25 | if (slashes.length % 2 === 0) { 26 | slashes += '\\'; 27 | } ``` Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Resolves TS7006: Parameter 'x' implicitly has an 'any' type ``` ERROR in pkg/rancher-desktop/components/MountTypeSelector.vue:95:15 TS7006: Parameter 'x' implicitly has an 'any' type. 93 | 94 | return items > 95 | .map((x) => { | ^ 96 | return { 97 | label: this.t(`virtualMachine.mount.type.options.9p.options.${ setting }.options.${ x.replace('.', '') }`), 98 | value: x, ``` Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
``` ERROR in pkg/rancher-desktop/main/extensions/extensions.ts:292:11 TS2532: Object is possibly 'undefined'. 290 | await this.client.copyFile( 291 | this.image, > 292 | data.root, | ^^^^ 293 | path.join(uiDir, name), 294 | { namespace: this.extensionNamespace }); 295 | } catch (ex: any) { ``` Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Co-authored-by: Mark Yen <3977982+mook-as@users.noreply.github.com> Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Replace `npm ci` with `yarn install --frozen-lockfile` Install yarn globally for cirrus Package with python Remove yarn upgrade step change yarn registry Increase timeout duration Update yarn commands Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
- BATS: Update `using_dev` to `using_dev_mode` - Replace remaining instances of `using_npm_run_dev` Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
07b6272
to
9269200
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UI Console Errors at startup :
./node_modules/@formatjs/icu-messageformat-parser/node_modules/tslib/tslib.es6.js
Module build failed: Error: ENOENT: no such file or directory, open '/Users/ericp/workspace/rancher/desktop/node_modules/@formatjs/icu-messageformat-parser/node_modules/tslib/tslib.es6.js'
./node_modules/@formatjs/icu-skeleton-parser/node_modules/tslib/tslib.es6.js
Module build failed: Error: ENOENT: no such file or directory, open '/Users/ericp/workspace/rancher/desktop/node_modules/@formatjs/icu-skeleton-parser/node_modules/tslib/tslib.es6.js'
./node_modules/intl-messageformat/node_modules/tslib/tslib.es6.js
Module build failed: Error: ENOENT: no such file or directory, open '/Users/ericp/workspace/rancher/desktop/node_modules/intl-messageformat/node_modules/tslib/tslib.es6.js'
npm run build | ||
npm run package --publish=never | ||
yarn build | ||
yarn package --publish=never |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further down, at line 222, there's a reference to MacOS
. It should be macOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And line 308, of how its
should be of how it's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can follow up to fix that. I think it's unrelated to this PR.
I can't reproduce the problems I reported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good now. I can move from npm dev
to yarn dev
without needing to do a factory-reset on all three platforms.
This pull request aims to migrate our project from
npm
toyarn
for improved consistency and compatibility with Rancher Dashboard and Rancher Shell.This migration also allows for a better debugging and development experience when developing plugins for
@rancher/shell
viayarn link
.yarn link
has proven to be more reliable thannpm link
, making debugging@rancher/shell
a lot more easier.🗒️ Notes
Before working with this PR, make sure that you have yarn installed globally. This should be done via
npm install --global yarn
. See the yarn docs1 for more information.We are sticking to the "classic" version of Yarn for parity with Rancher Dashboard. We may want to consider upgrading to Yarn 2+ in the future2. Doing this will resolve at least one bug that I encountered with Windows CI3.
Ultimately, we should anticipate Rancher Desktop development to remain the same as it does today, albeit running commands with
yarn
instead ofnpm
.I encountered an error in Windows 11 that looked like this
To resolve this issue, I had to update go to version 1.20.5. I'm still unsure why this would fail on 1.20.3 and I'm interested if anybody has any feedback as to why.
Changes Made
closes #3723
Footnotes
https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable ↩
https://yarnpkg.com/getting-started/migration ↩
https://github.com/yarnpkg/yarn/issues/8242 ↩