pldn / LDWizard

🧙 LDWizard: A generic framework for simplifying the creation of linked data. Supported by the PLDN community.
European Union Public License 1.2
13 stars 7 forks source link

Replace the now broken `yarn` by `npm` or `pnpm` 👋 #158

Closed vemonet closed 7 months ago

vemonet commented 11 months ago

I have been using yarn for years to manage all my JS projects, and I loved it. But after its v1 yarn has evolved in directions that makes it completely unusable

They are now at version 4, but everyone are still using version 1. Because v2, v3 and v4 are just plain bad and unusable.

All the new features of yarn v2+ are useless and really poorly implemented. Running a yarn install now generated tons of useless files in the root of your repo: .yarn folder, and other stuff for their "PnP" features (plug n play). It's really really bad (all we need is a lock file and good caching after first install, we don't need them to add cache files to our git repo that's complete non-sense)

Today I reinstalled yarn on a fresh ubuntu install following their recommendations: https://yarnpkg.com/getting-started/install

And tried to run yarn install on the LDWizard but I am getting:

➤ YN0065: Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry
➤ YN0065: Run yarn config set --home enableTelemetry 0 to disable

➤ YN0000: · Yarn 4.0.1
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: xpath-iterator@https://abc@github.com/ThibaultGerrier/XpathIterator#commit=647ba7c2973b3feadcc010f83f7086fe043e0810: xpath-iterator@https://abc@github.com/ThibaultGerrier/XpathIterator#commit=647ba7c2973b3feadcc010f83f7086fe043e0810 isn't supported by any available resolver
    at Bd.getResolverByLocator (/home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:141:1980)
    at Bd.resolve (/home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:141:1462)
    at /home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:210:7182
    at Yy (/home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:140:53922)
    at ne (/home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:210:7162)
    at /home/vemonet/.cache/node/corepack/yarn/4.0.1/yarn.js:210:7788
➤ YN0000: └ Completed in 9s 213ms
➤ YN0000: · Failed with errors in 9s 231ms

Many things to unpack, but globally it just does not work, and provide unclear error messages that does not help fixing the issue.

Here the problem seems to come that we are using a github URL as dependencies.... If yarn can't handle this basic feature, better let it go

Also note the free gathering of data without my explicit permission obviously

So to fix that only one solution: we need to go to the classic page to install the old v1: https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable

Since yarn was released npm has improved a lot, and there is also pnpm (performant npm) that is getting quite popular

I tried to install the project with pnpm: took 40s with no errors, and a readable output

It would be the same for npm.

Unfortunately, yarn has been killed by bad development, we can't continue to use their v1 for years

It's time to move to something that works and is maintained by people who understand the needs of JS packaging! Yarn v1 is not going to be maintained forever

I am myself hesitating between pnpm and npm, anyone got a preference?

vemonet commented 11 months ago

Ok, so I did not wanted to install yarn v1 (because we should not accept downgrading ourselves!), it took me litterally 2min to make everything work with pnpm (I just replaced the yarn calls in the package.json scripts by pnpm). And for some reason I also needed to add sparqljs to the dependencies

First install without cache it took 40.9s

Also cool thing is that you can call scripts without adding run like npm requires it, e.g.:

pnpm dev

To install pnpm use corepack (included when installing nodejs):

corepack enable
corepack prepare pnpm@latest --activate
vemonet commented 11 months ago

Trying installing with npm: getting error related to cache:

npm ERR! Cannot read properties of null (reading 'matches')

npm ERR! A complete log of this run can be found in: /home/vemonet/.npm/_logs/2023-11-08T13_39_03_585Z-debug-0.log

Still getting it after cache cleaning. With an error message even worst than yarn v4!

So I guess that settles it: pnpm is the only one able to package the LDWizard as it stands

GerwinBosch commented 8 months ago

I did some cleanup of dependencies, I think npm might be an option again (at least when https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/800 is resolved) Or we should revert webpack server back to v4