kodadot / nft-gallery

Generative Art Marketplace
https://koda.art
MIT License
636 stars 360 forks source link

How we've migrated from yarn to pnpm #2671

Open yangwao opened 2 years ago

yangwao commented 2 years ago

tested in:

improvements:

  yarn pnpm
Netlify Deployment 5m

Screen Shot 2022-03-25 at 2 57 18 PM
3m

Screen Shot 2022-03-25 at 2 54 50 PM
Install Deps in Actions 1m 25s 28s

impressive time savings. Curious if you would be keen to write an article on how we've migrated from yarn to pnpm? Some people might find it interesting as we are still early! This morning found friends deciding between npm and yarn πŸ˜….

We are usually publishing at https://medium.com/kodadot :)

Issue is reserved for @preschian

Originally posted by @yangwao in https://github.com/kodadot/nft-gallery/issues/2643#issuecomment-1078864547

Ref

preschian commented 2 years ago

noted, time to sharpen my writing skill πŸ™ˆ

yangwao commented 2 years ago

hey @preschian how it's going πŸ‘€

preschian commented 2 years ago

Hi @yangwao, hopefully, I can give you the draft blog post in 2 weeks

Currently, I'm still curious about issues related to pnpm, especially after this issue https://github.com/kodadot/nft-gallery/issues/2830#issuecomment-1096666746. To ensure there is no major issue after migration to pnpm. At least I can list down the issue. so far, it seems like the issue occurs on yarn also

Screen Shot 2022-04-28 at 17 37 52
yangwao commented 2 years ago

Seems loads of fun 😁
Thank for letting us know, let's keep this issue posted :)

yangwao commented 2 years ago

@preschian any progress on this?:)

preschian commented 2 years ago

@preschian any progress on this?:)

hi so sorry, still no major progress on this πŸ™πŸ»

preschian commented 2 years ago

the downside of using node-linker=hoisted . we face error several times :(

why so brittle...

yangwao commented 2 years ago

πŸ‘€πŸ˜„

preschian commented 2 years ago

πŸ™ˆπŸ™ˆπŸ™ˆ

poppyseedDev commented 1 year ago

Browsing issues, whats up with this one?

poppyseedDev commented 1 year ago

πŸ‘‹

kodabot commented 1 year ago

ASSIGNED - @poppyseedDev πŸ”’ LOCKED -> Wednesday, May 17th 2023, 20:22:14 UTC -> 48 hours

poppyseedDev commented 1 year ago

Provide comments on writing style of article:


Why KodaDot Switched From Yarn to PNPM: A Strategic Shift

KodaDot, an open-source NFT marketplace flourishing on the Dotsama (Kusama/Polkadot) network, has always been known for its commitment to collaboration, inclusivity, and trust. With a thriving community of creators, developers, and members continuously working together to shape the platform, KodaDot is making significant strides in the blockchain and NFT space. However, behind the platform's innovative features and enticing rewards system, there's a team of dedicated developers constantly making decisions and adjustments to ensure the platform's smooth operation and scalability. One such recent decision was the transition from using yarn to pnpm in their development workflow.

The Doppelganger Problem

To understand why KodaDot made this switch, we first need to understand the underlying problem with yarn and npm that pnpm solves - the doppelganger issue.

In JavaScript projects, especially large, complex ones like monorepos, there's a common issue known as the "doppelganger problem." It arises when multiple copies (or "doppelgangers") of the same package exist in a project, leading to inconsistencies, bugs, and confusion. This problem is particularly prominent in monorepos, where a single repository may contain multiple packages or projects, and it's not uncommon for different projects to depend on different versions of the same package.

Yarn and npm, while excellent package managers, can potentially lead to doppelganger packages in monorepos. This occurrence can cause unexpected and hard-to-debug problems, which can slow down development and lead to unstable builds.

The PNPM Solution

Enter pnpm, a fast, disk-efficient package manager for JavaScript that solves the doppelganger problem by design. Instead of installing multiple copies of the same package, pnpm uses a shared store and creates hard links or symlinks from there to the node_modules directories where the packages are used. This approach ensures that a single package version exists in the store, eliminating the possibility of doppelgangers.

Moreover, pnpm's approach conserves disk space and speeds up installation, particularly valuable in large projects. It also offers strict package isolation, meaning packages are sandboxed and can access only their dependencies, not arbitrary packages in the project. This isolation enhances the project's security and predictability.

Why KodaDot Made the Switch

KodaDot's switch to pnpm was a strategic move towards enhancing their development workflow's efficiency, predictability, and security. Being an open-source project with numerous contributors, KodaDot needed a solution that could handle the complexities of their monorepo and provide a reliable environment for their developers.

By choosing pnpm, KodaDot not only solved the doppelganger problem but also improved the speed and disk efficiency of their development process. This improvement allows the platform to scale effectively, accommodating more contributors, more features, and ultimately, more community members.

Moreover, pnpm's strict package isolation aligns with KodaDot's commitment to trust and security. The enhanced predictability of the development environment results in fewer bugs and a more stable platform, benefiting both the developers and the end users.

Final Thoughts

KodaDot's switch from yarn to pnpm underscores their commitment to scalability, efficiency, and sustainability. This strategic decision not only enhances their development workflow, but also invites greater open-source contribution and promotes greener practices. The move illustrates how the selection of development tools can profoundly influence a project's growth, stability, and broader impact.

poppyseedDev commented 1 year ago

Where do I publish? Link to draft: https://medium.com/@poppyseedDev/cd3e34e7e6

JustLuuuu commented 1 year ago

Where do I publish? Link to the draft: https://medium.com/@poppyseedDev/cd3e34e7e6

I gave you access and instructions πŸ₯° happy to see your article.

poppyseedDev commented 1 year ago

article submitted for publication

kodabot commented 1 year ago

ASSIGNMENT EXPIRED - @poppyseedDev has been unassigned.

poppyseedDev commented 1 year ago

https://kodadot.xyz/rmrk/transfer?target=HsvQ55ffgH5o4pfMVFAvNR835PVrFjR1W7jisn6gD7F7jFu&usdamount=0&donation=true