osrd icon indicating copy to clipboard operation
osrd copied to clipboard

front: switch from yarn to npm

Open Yohh opened this issue 1 year ago • 2 comments

close #9143

Yohh avatar Oct 03 '24 09:10 Yohh

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.84%. Comparing base (c98d385) to head (8bef3dc). Report is 22 commits behind head on dev.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##              dev    #9169       +/-   ##
===========================================
+ Coverage   38.19%   79.84%   +41.64%     
===========================================
  Files         998     1053       +55     
  Lines       92197   105088    +12891     
  Branches     1192      757      -435     
===========================================
+ Hits        35219    83909    +48690     
+ Misses      56522    21138    -35384     
+ Partials      456       41      -415     
Flag Coverage Δ
editoast 73.35% <ø> (-0.04%) :arrow_down:
front 89.34% <ø> (+69.18%) :arrow_up:
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 87.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Oct 10 '24 15:10 codecov-commenter

I had success running https://github.com/imsnif/synp

I think we'd be less likely to run into issues if we can use this tool instead of crossing fingers.

emersion avatar Oct 15 '24 12:10 emersion

  • Running npm install before renaming resolutions to overrides in package.json makes npm use @rtk-query/oazapfts-patched instead of our fork.
  • Running npm install after renaming resolutions to overrides in package.json makes npm die with ".git can't be found" in husky install.
  • Trying to upgrade oazapfts to the latest version won't work because it uses a monorepo and Git repo dependencies can't target a subdir.

emersion avatar Nov 19 '24 09:11 emersion

[khoyo@odin osrd-hotfix]$ git grep yarn
front/README.md:- Install playwright dependencies `cd ./front/ && yarn playwright install --with-deps`
front/README.md:this script as you would to `yarn e2e-tests` or `yarn playwright test`.
front/docker/Dockerfile.playwright:COPY front/package.json front/yarn.lock /app/front/
front/docker/Dockerfile.playwright:RUN yarn install --frozen-lockfile
front/package-lock.json:        "yarn": "^1.7.0"
front/package-lock.json:        "yarn": ">=1"
front/package-lock.json:        "yarn": ">=1"
front/package-lock.json:        "yarn": "*"
front/package-lock.json:    "node_modules/yarn": {
front/package-lock.json:      "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.22.tgz",
front/package-lock.json:        "yarn": "bin/yarn.js",
front/package-lock.json:        "yarnpkg": "bin/yarn.js"
scripts/run-front-playwright-container.sh:VERSION=$(yarn list --pattern playwright --json | jq -r '.data.trees[].name | split("@")[-1]' | sort -u)
scripts/run-front-playwright-container.sh:    osrd-playwright:latest yarn playwright test "${args[@]}"

The dependency in the lockfile is probably valid, the rest probably isn't.

Khoyo avatar Nov 21 '24 10:11 Khoyo

[khoyo@odin osrd-hotfix]$ git grep yarn
front/README.md:- Install playwright dependencies `cd ./front/ && yarn playwright install --with-deps`
front/README.md:this script as you would to `yarn e2e-tests` or `yarn playwright test`.
front/docker/Dockerfile.playwright:COPY front/package.json front/yarn.lock /app/front/
front/docker/Dockerfile.playwright:RUN yarn install --frozen-lockfile
front/package-lock.json:        "yarn": "^1.7.0"
front/package-lock.json:        "yarn": ">=1"
front/package-lock.json:        "yarn": ">=1"
front/package-lock.json:        "yarn": "*"
front/package-lock.json:    "node_modules/yarn": {
front/package-lock.json:      "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.22.22.tgz",
front/package-lock.json:        "yarn": "bin/yarn.js",
front/package-lock.json:        "yarnpkg": "bin/yarn.js"
scripts/run-front-playwright-container.sh:VERSION=$(yarn list --pattern playwright --json | jq -r '.data.trees[].name | split("@")[-1]' | sort -u)
scripts/run-front-playwright-container.sh:    osrd-playwright:latest yarn playwright test "${args[@]}"

The dependency in the lockfile is probably valid, the rest probably isn't.

you're right, I removed the useless mentions in package-lock.json and updated the playwright script, thank you

Yohh avatar Nov 21 '24 11:11 Yohh

The package-lock.json references should be retained. In general this file shouldn't be edited by hand. It has "yarn" references because some of our dependencies depend on yarn.

emersion avatar Nov 21 '24 12:11 emersion

Some platform-specific optional dependencies were missing from package-lock.json due to https://github.com/npm/cli/issues/4828, causing breakage on platforms other than Linux amd64. To fix it, dependencies with platform-specific sub-packages need to be re-installed to force npm to not look at node_modules/. I did the following:

npm install --save-dev [email protected] @swc/[email protected]
git restore package.json
npm install

emersion avatar Dec 03 '24 11:12 emersion

everything works fine for me on macos and linux

Yohh avatar Dec 04 '24 10:12 Yohh