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

Node.js upgrade to v18 along with dependency upgrades and linting fixes #645

Open
wants to merge 11 commits into
base: release-v4
Choose a base branch
from

Conversation

bjester
Copy link
Member

@bjester bjester commented May 22, 2024

Description

Upgrades Node.js to v18, along with Kolibri-Tools to v0.16, Jest to v29 and Nuxt to v2.15. Additionally, this pins dependencies in order to maintain compatibility between Nuxt and kolibri-tools, applies fixes for new linting errors, and cleans up testing output through better error handling.

Issue addressed

Addresses #439

Changelog

Steps to test

  1. Run yarn run test
  2. Verify tests pass
  3. Run yarn run dev
  4. Verify documentation

(optional) Implementation notes

At a high level, how did you implement this?

  • Upgraded Node.js
  • Upgraded dependencies to highest version we could support
  • Cleaned up test output throwing warnings and other errors
  • Pinned dependency resolutions as needed

Does this introduce any tech-debt items?

Yes #646

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change is described in the changelog section above

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

After review

  • The changelog item has been pasted to the CHANGELOG.md

Comments

@bjester bjester changed the title Nodejs upgrade Node.js upgrade to v18 along with dependency upgrades and linting fixes May 23, 2024
@bjester bjester marked this pull request as ready for review May 23, 2024 16:57
@bjester bjester requested review from MisRob and rtibbles May 23, 2024 16:57
@bjester
Copy link
Member Author

bjester commented May 23, 2024

Before I actually update the changelog file, please let me know how my notes look in the PR.

@bjester bjester requested a review from AlexVelezLl May 23, 2024 17:57
@bjester bjester changed the base branch from develop to release-v4 May 23, 2024 18:45
@bjester
Copy link
Member Author

bjester commented May 23, 2024

Noting we must update the Node.js version in Netlify before merging

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

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

Thank you @bjester! This looks great to me 👐, I left just some questions. And just a small note: Could you add your changelog items to CHANGELOG.md please?

lib/KImg/index.vue Show resolved Hide resolved
lib/KImg/index.vue Show resolved Hide resolved
lib/tabs/__tests__/KTabsList.spec.js Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved
- Node.js 10.x (see [Node Version Manager](https://github.com/nvm-sh/nvm))
- Yarn 1.x
- Node.js 18.x (see [Node Version Manager](https://github.com/nvm-sh/nvm))
- Yarn >=1.22.22
Copy link
Member

Choose a reason for hiding this comment

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

Now when I run yarn lint, yarn dev I get this error because I dont have pnpm installed:

> yarn lint
yarn run v1.22.22
$ kolibri-tools lint --pattern '**/*.{js,vue,scss,less,css}' --ignore '**/node_modules/**,**/.nuxt/**,**/dist/**,**/lib/KIcon/precompiled-icons/**,**/lib/keen/**,**/docs/environment.js,**/docs/jsdocs.js'

Kolibri CLI: Error: Command failed: "pnpm --version"

stderr:
Volta error: Could not find executable "pnpm"

Use `volta install` to add a package to your toolchain (see `volta help install` for more info).
Error details written to /home/alexvelezll/.volta/log/volta-error-2024-05-27_11_10_15.764.log


original error message:
Command failed: pnpm --version
Volta error: Could not find executable "pnpm"

Use `volta install` to add a package to your toolchain (see `volta help install` for more info).
Error details written to /home/alexvelezll/.volta/log/volta-error-2024-05-27_11_10_15.764.log


error Command failed with exit code 1.

Does the new version of kolibri-tools require pnpm to be installed? If so I think we need to add this to our prerequisites.

Copy link
Member Author

Choose a reason for hiding this comment

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

There should be no requirement on pnpm-- nothing in regards to that has changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have you previously run a corepack command on your system?

I don't think this will resolve the issue, but you could try adding export SKIP_YARN_COREPACK_CHECK=1 to your terminal env.

Copy link
Member

@AlexVelezLl AlexVelezLl May 28, 2024

Choose a reason for hiding this comment

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

Hmm, no, that didn't solve it. It's weird because I tried to run it on my Windows machine, where I also don't have Pnpm, and it worked there 🤔

In my Ubuntu machine I finally installed pnpm using volta install pnpm and then yarn lint worked.

@bjester
Copy link
Member Author

bjester commented May 28, 2024

Hmm linting was passing, but now it isn't 🤔 I'll take a look

@MisRob
Copy link
Member

MisRob commented May 30, 2024

Before I actually update the changelog file, please let me know how my notes look in the PR.

Thank you, @bjester, to me it looks well and clear, and I appreciate the guidance

@MisRob
Copy link
Member

MisRob commented Jun 5, 2024

Hi @bjester, thanks a lot - lots of work!

I've switched to this branch, then nvm use 18, then yarn install, and finally yarn dev. It seems the devserver initialization gets stuck and I can't access http://localhost:4000/ as usual

michaela@michaela:~/dev/kolibri-design-system$ yarn run dev
yarn run v1.22.17
$ npm-run-all --parallel dev-only _lint-watch-fix _api-watch pregenerate
$ yarn lint -w -m
$ chokidar "**/lib/**" -c "node utils/extractApi.js"
$ nuxt --port 4000
$ node utils/pregenerate.js
$ kolibri-tools lint --pattern '**/*.{js,vue,scss,less,css}' --ignore '**/node_modules/**,**/.nuxt/**,**/dist/**,**/lib/KIcon/precompiled-icons/**,**/lib/keen/**,**/docs/environment.js,**/docs/jsdocs.js' -w -m
ℹ  Netlify environment variables:                                     11:44:01
    NETLIFY:        undefined
    BRANCH:         undefined
    PULL_REQUEST:   undefined
    REPOSITORY_URL: undefined
ℹ Wrote environment to /home/michaela/dev/kolibri-design-system/docs/environment.js

 WARN  mode option is deprecated. You can safely remove it from nuxt.config

ℹ Wrote rst icon replacement strings to /home/michaela/dev/kolibri-design-system/docs/rstIconReplacements.txt

ℹ NuxtJS collects completely anonymous data about usage.          11:44:01 AM
  This will help us improve Nuxt developer experience over time.
  Read more on https://git.io/nuxt-telemetry

? Are you interested in participating? (Y/n) Kolibri Linter: Initializing watcher for the following patterns: **/*.{js,vue,scss,less,css}

 WARN  Could not extract docs from /home/michaela/dev/kolibri-design-system/lib/KThemePlugin.js

ℹ Wrote jsdocs to /home/michaela/dev/kolibri-design-system/docs/jsdocs.js
add:node_modules/.bin/acorn
add:node_modules/autoprefixer/node_modules/.bin/browserslist
add:node_modules/bonjour-service/node_modules/.bin/multicast-dns
...
add:node_modules/.bin/webpack-cli
add:node_modules/.bin/webpack-dev-server
Watching "**/lib/**" ..

 WARN  Could not extract docs from /home/michaela/dev/kolibri-design-system/lib/KThemePlugin.js

ℹ Wrote jsdocs to /home/michaela/dev/kolibri-design-system/docs/jsdocs.js

Can you see something problematic in the log above or have some recommendations on how to best proceed with debuggin?

@MisRob
Copy link
Member

MisRob commented Jun 5, 2024

I wonder if this is related to the problem with the devserver.

yarn generate gives me this error
Screenshot from 2024-06-05 11-50-49

@MisRob
Copy link
Member

MisRob commented Jun 5, 2024

Good news is that I could successfully run

  • yarn lint
  • yarn lint-fix
  • yarn lint-watch
  • yarn pregenerate
  • yarn dev-only
  • yarn precompile-svgs
  • yarn precompile-custom-svgs
  • yarn _lint-watch-fix
  • yarn test
  • yarn _api-watch

So it is only generate and dev causing trouble. I use Ubuntu.

import KTextBox from '../KTextbox';

let uuid = 0;
Copy link
Member

Choose a reason for hiding this comment

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

If we used the same approach from another component (instead of using uuid library), could there be any conflicts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only if the ID prefix wasn't already unique

};
return defaultValue;
}
// Avoid accessing unset indices through `this.ratio`
Copy link
Member

Choose a reason for hiding this comment

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

Nice

Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

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

Also just read the code and haven't noticed any issues, just have one question about uuid

@MisRob
Copy link
Member

MisRob commented Jun 5, 2024

@bjester Upgrading yarn to v1.22.22 as discussed helped me with yarn dev that works now. I still see problem with yarn generate. But we can have a look whether that's actually a regression or if it was present before (can try that out but later)

Screenshot from 2024-06-05 18-09-10

@bjester
Copy link
Member Author

bjester commented Jun 6, 2024

I have replicated @MisRob's issue. It seems to stem from incompatibility with hoisted postcss packages. I will look at fixing it

@MisRob MisRob self-assigned this Jun 7, 2024
@MisRob MisRob removed their assignment Jun 19, 2024
@MisRob
Copy link
Member

MisRob commented Jun 19, 2024

I will unassign myself from the asigned reviewer role for now since everything is reviewed at this point. So that I don't block another round of review as I will be away for two weeks, back on July 8. If it's still open when I'm back and I can help, please ping me :)! Thanks.

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.

None yet

4 participants