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

front: import osrd-ui #10711

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from
Draft

front: import osrd-ui #10711

wants to merge 9 commits into from

Conversation

emersion
Copy link
Member

@emersion emersion commented Feb 6, 2025

See individual commits.

TODO:

  • Basic NPM workspace setup
  • Build system
  • Docker integration
    • Base flavor
    • Front flavor
  • Storybook publishing
  • Releases
  • Add scripts to work on osrd-ui alone
  • Adjust docs

Closes: OpenRailAssociation/osrd-ui#451

Design decisions

Why move front/ui/package.json to front/ui/base/package.json?

NPM doesn't correctly handle nested sub-packages (front/ui/ and front/ui/storybook/, for instance). It doesn't install dev dependencies of nested sub-packages (storybook dependencies are missing).

Why keep front/ui/base/package.json?

front/ui/ contains config files for rollup, ESLint, postcss used by all ui-* sub-packages. We need to specify dependencies for these somewhere.

We could specify them in front/package.json, but that would mix up osrd and osrd-ui deps. Keeping shared osrd-ui deps inside front/ui/base/package.json makes it clearer what's required by osrd itself and what's required by osrd-ui.

Should we build osrd-ui when running npm run build?

Another possible solution would've been to only build osrd when running npm run build, and require users to run npm run build --workspaces to build osrd-ui. The upside would be that less work is performed when only touching osrd.

However, this would make it so npm run build would fail if osrd-ui hasn't been built before, or has an outdated build. Also, building osrd-ui requires less changes to the CI and tooling.

There are ESLint errors when I start the front flavor of the Compose setup

This is due to osrd-ui and osrd being built in parallel when the container starts, and ESLint doesn't notice when osrd-ui has been built. Indeed, ESLint doesn't install a watcher on files in node_modules/, which osrd-ui deps point to.

To fix, run npm run build --workspaces before starting the container, or restart the container (either should work).

Why front/ui/ instead of front/osrd-ui/?

Because "osrd" is already in the name of this repo ¯\_(ツ)_/¯

@github-actions github-actions bot added the area:front Work on Standard OSRD Interface modules label Feb 6, 2025
@emersion emersion force-pushed the emr/monorepo branch 5 times, most recently from 98352b2 to baf5d24 Compare February 18, 2025 15:14
@github-actions github-actions bot added area:ci Work on Continous Integration Pipeline Service area:gateway and removed area:gateway labels Feb 18, 2025
@emersion emersion force-pushed the emr/monorepo branch 4 times, most recently from 808b7bd to 04562bb Compare February 24, 2025 16:31
@emersion emersion force-pushed the emr/monorepo branch 4 times, most recently from f951b2c to 0fca49a Compare February 28, 2025 09:49
@emersion emersion force-pushed the emr/monorepo branch 2 times, most recently from f8cb817 to ffe56e1 Compare March 14, 2025 15:35
Otherwise these will blow up with out-of-memory errors when a new
ui/ directory is imported in the next commit.

Signed-off-by: Simon Ser <[email protected]>
emersion and others added 3 commits March 14, 2025 17:15
This is the osrd-ui tree imported from tag 0.0.68, without any
change:

    git clone --branch 0.0.68 https://github.com/OpenRailAssociation/osrd-ui.git ui
    rm -rf ui/.git

Git history up to this state is available at:
https://github.com/OpenRailAssociation/osrd-ui/

The author list has been generated with:

    git log --format='%aN <%aE>' | sort | uniq

With the following .mailmap file:
https://paste.sr.ht/~emersion/8b0f2b6c3384cbcb60236c272ea26ad212f077c5

Signed-off-by: Simon Ser <[email protected]>
Co-authored-by: Achraf Mohyeddine <[email protected]>
Co-authored-by: Alexis Jacomy <[email protected]>
Co-authored-by: Alice Khoudli <[email protected]>
Co-authored-by: Benoit Simard <[email protected]>
Co-authored-by: Chaka NGAMENI NJINEH <[email protected]>
Co-authored-by: Clara Ni <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Egor Berezovskiy <[email protected]>
Co-authored-by: Élyse Viard <[email protected]>
Co-authored-by: Ethan Perruzza <[email protected]>
Co-authored-by: Florian Amsallem <[email protected]>
Co-authored-by: Gaël Haméon <[email protected]>
Co-authored-by: Ian Turner <[email protected]>
Co-authored-by: Mathieu <[email protected]>
Co-authored-by: Math_R_ <[email protected]>
Co-authored-by: Nicolas Wurtz <[email protected]>
Co-authored-by: nncluzu <[email protected]>
Co-authored-by: romainvalls <[email protected]>
Co-authored-by: SarahBellaha <[email protected]>
Co-authored-by: Serge Croisé <[email protected]>
Co-authored-by: SharglutDev <[email protected]>
Co-authored-by: Simon Ser <[email protected]>
Co-authored-by: theocrsb <[email protected]>
Co-authored-by: Theo Macron <[email protected]>
Co-authored-by: thibautsailly <[email protected]>
Co-authored-by: Uriel-Sautron <[email protected]>
Co-authored-by: Valentin Chanas <[email protected]>
Co-authored-by: Victor "multun" Collod <[email protected]>
Co-authored-by: Yohh <[email protected]>
Co-authored-by: Younes Khoudli <[email protected]>
osrd-ui's root package.json is moved to ui/base/ because nested
workspaces don't work with NPM:
npm/cli#4774

rollup-base.config.js needs to be adjusted because node_modules
now lives one directory higher and dist directories live one
directory deeper.

The build, test and lint scripts are adjusted to execute tasks for
both osrd and osrd-ui.

The full front source code is copied over in the Dockerfile before
installing dependencies, because NPM needs to look at all workspace's
package.json files to install dependencies.

eslint-plugin-storybook's TypeScript version needs to be overridden
because osrd uses 5.8 an the plugin asks for <5.8:
storybookjs/eslint-plugin-storybook#193

Signed-off-by: Simon Ser <[email protected]>
Since front includes osrd-ui via NPM workspaces, dependabot will
upgrade osrd-ui dependencies. We only need to slightly adjust
group patterns to include everything missing from osrd-ui's
configuration file.

Signed-off-by: Simon Ser <[email protected]>
File paths need to be slightly adjusted.

requirements.txt is moved to the root of ui-icons so that it can
more easily be run locally.

Signed-off-by: Simon Ser <[email protected]>
We need to strip the "v" prefix from Git tag names, and adjust file
paths a bit.

Signed-off-by: Simon Ser <[email protected]>
The build script is run for all workspaces, but not the root
workspace.

The deployment repository now needs to be explicitly specified.

Signed-off-by: Simon Ser <[email protected]>
All of these are already covered by the osrd monorepo.

Signed-off-by: Simon Ser <[email protected]>
When starting the front dev container, osrd-ui may not have been
built yet, or might be outdated. Start a build of osrd-ui
components which are used in osrd in parallel with vite.

Avoid building osrd-ui's storybook, because it takes quite a while
and it's unnecessary.

Signed-off-by: Simon Ser <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ci Work on Continous Integration Pipeline Service area:front Work on Standard OSRD Interface modules area:gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move osrd-ui into main osrd repository
1 participant