Skip to content

Upgrade lerna to version 6.5.1#2196

Merged
EltonGohJH merged 8 commits intoMarkBind:masterfrom
EltonGohJH:elton/update-lerna
Mar 25, 2023
Merged

Upgrade lerna to version 6.5.1#2196
EltonGohJH merged 8 commits intoMarkBind:masterfrom
EltonGohJH:elton/update-lerna

Conversation

@EltonGohJH
Copy link
Contributor

@EltonGohJH EltonGohJH commented Mar 5, 2023

What is the purpose of this pull request?
Resolves #1984 and fixes #2162

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • DevOps
  • Improve developer experience
  • Others, please explain:

Overview of changes:

  • Upgraded lerna 4 to lerna 6.5.1
  • Fixed js-beautify version to v1.14.3
  • Updated @types/node to 18.15.0
  • Set up npm workspaces, init new package lock for workspaces and remove deprecated lerna bootsrap command
  • Cached test results and run test/updatetest concurrently

Anything you'd like to highlight/discuss:
The main issue that I faced would be the failure to realise the latest version of js-beautify has issue with custom tag with dash.
So for instance <site-nav> would not indent correctly but in v1.14.3 which is the version we are using now it works perfectly fine. So, for now I fixed the version of js-beautify to v1.14.3 in package.json.
There is some issue with @types/node 17.0.22 on node 16 so I updated it.

A stretch goal for me would be to fix it and make a pr to js-beautify and then make a pr again on markbind to update js-beautify.

Testing instructions:
Can test the cached performance of test and updatetest by running those script.
I personally tested it and the speed of npm run test at least doubled.
Without caching, it takes around 50s. And after caching it takes around 20s. The caching would be significantly improve dev experience when debugging and running testcases.
Right now, it runs a lot faster locally but in pipeline performance gain is negligible due to cpu bottleneck.

@raysonkoh
In conclusion, I believe that it is worthwhile to keep using Lerna. Lerna simplifies versioning and publishing to npm. Furthermore, the performance improvements for running test cases are definitely welcomed.

Proposed commit message: (wrap lines at 72 characters)
Upgrade lerna to version 6.5.1

Our current version of lerna (version 4) is incompatible with
Node 19 due to an outdated dependency called node-gyp.
To ensure that we can support all versions of Node,
we need to upgrade to the latest version of lerna (version 6).

In addition to Node 19 compatibility,
upgrading to lerna 6 will allow us to take advantage of
new features like caching and concurrency.

During the upgrade process,

  • I also noticed some formatting issues
    caused by js-beautify v1.14.7 when using custom tag
    (specifically custom tag with dash eg. site-nav). To fix this,
    I fixed the version of js-beautify to be v1.14.3 in package.json.
  • I also realised there is some issue
    with @types/node 17.0.22 so I updated it to 18.15.0.

To achieve these improvements, I made the following changes:

  • Upgraded lerna 4 to lerna 6.5.1
  • Fixed js-beautify version to v1.14.3
  • Updated @types/node to 18.15.0
  • Set up npm workspaces, init new package lock for workspaces
    and remove deprecated lerna bootsrap command
  • Cached test results and run test/updatetest concurrently

This fixes the following issues:

  • #1984: Explore using Turborepo to improve build system
  • #2162: Node v19.6.0 incompatibility on Windows 10

These changes will enable users to
run our application on Node 19
and improve performance with caching and concurrency.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

@EltonGohJH EltonGohJH force-pushed the elton/update-lerna branch from b2df1c7 to 768d515 Compare March 5, 2023 16:32
@EltonGohJH EltonGohJH changed the title Upgrade lerna to version 6.5.1 for improved performance and Node 19 c… Upgrade lerna to version 6.5.1 Mar 5, 2023
@tlylt
Copy link
Contributor

tlylt commented Mar 6, 2023

Will details about lerna's usage in https://markbind-master.netlify.app/devguide/projectmanagement be affected? If so the docs should be updated.

@EltonGohJH
Copy link
Contributor Author

EltonGohJH commented Mar 20, 2023

Will details about lerna's usage in https://markbind-master.netlify.app/devguide/projectmanagement be affected? If so the docs should be updated.

Yes. I will update it :)

Edit: There is no need to update it as it is still working

@EltonGohJH EltonGohJH force-pushed the elton/update-lerna branch 2 times, most recently from e944307 to f1f4700 Compare March 20, 2023 15:00
@EltonGohJH
Copy link
Contributor Author

@yucheng11122017
Pipeline does not clear because node 14 does not support M1 natively which probably results in wrong package being installed in nx.

So, my PR would require node 16 update.

For your reference
nrwl/nx#9545

Copy link
Contributor

@tlylt tlylt left a comment

Choose a reason for hiding this comment

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

Thanks @EltonGohJH, looks good mostly. Have you tested (perhaps with a test repo) if the publishing flow is still working?

Will double check locally and get back.

@tlylt
Copy link
Contributor

tlylt commented Mar 21, 2023

@EltonGohJH I'm getting the following error when cloning and running npm run setup

image
image
Does node v18 not work?

@EltonGohJH
Copy link
Contributor Author

EltonGohJH commented Mar 21, 2023

@EltonGohJH I'm getting the following error when cloning and running npm run setup

@tlylt
Seems like there may be issue on windows too. Node 18 is working on my end. I will try to test windows on my end.

Edit:
I saw some similar issues on nx repo (3 weeks ago) and they are highly likely related to this. They did suggest some potential hacky fix such as adding the indirect dependencies into our package.json (not sure how comfortable I am with that hmmm).

Our current version of lerna (version 4) is incompatible with Node 19 due to an outdated dependency called node-gyp. To ensure that we can support all versions of Node, we need to upgrade to the latest version of lerna (version 6).

In addition to Node 19 compatibility, upgrading to lerna 6 will allow us to take advantage of new features like caching.

During the upgrade process, I also noticed some formatting issues caused by js-beautify v1.14.7 when using custom tag (specifically custom tag with dash eg. site-nav). To fix this, I fixed the version of js-beautify to be v1.14.3 in package.json.

To achieve these improvements, I made the following changes:
* Upgraded lerna 4 to lerna 6.5.1
* Fixed js-beautify version to v1.14.3
* Set up npm workspaces and remove deprecated lerna bootsrap command
* Cached test results and updated test scripts

This fixes the following issues:
* MarkBind#1984: Explore using Turborepo to improve build system
* MarkBind#2162: Node v19.6.0 incompatibility on Windows 10

These changes will enable users to run our application on Node 19 and improve performance with caching.
@EltonGohJH
Copy link
Contributor Author

EltonGohJH commented Mar 25, 2023

@tlylt
It seems like the dev managed to fix the issue for Nx recently. I updated the packages and it is working now even for macos.
So, this is ready for merge.

Publishing is working after I recreated a new package lock file.

Copy link
Contributor

@tlylt tlylt left a comment

Choose a reason for hiding this comment

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

LGTM @EltonGohJH , remember to update the description and try merging this, with squash-commit strategy.

@tlylt tlylt added this to the v4.1.1 milestone Mar 25, 2023
@jovyntls
Copy link
Contributor

@EltonGohJH Thanks for the commit message! Do remember to wrap the commit message at 72 characters :)

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.

Node v19.6.0 incompatibility on Windows 10 Explore using Turborepo to improve build system

3 participants