3
3
## How to launch project for development purpose?
4
4
5
5
- go inside ` /front/ ` from OSRD main project
6
- - you'll need [ ` npm ` ] ( https://nodejs.org/en/download/package-manager ) and
7
- [ ` yarn ` ] ( https://classic.yarnpkg.com/lang/en/docs/install/ )
8
- - exec ` yarn ` (hope you have a good connexion and a good cup of tea)
9
- - exec ` yarn start ` (perhaps you'll need ` NODE_OPTIONS="--openssl-legacy-provider" ` if your node
6
+ - you'll need [ ` npm ` ] ( https://nodejs.org/en/download/package-manager )
7
+ - exec ` npm install ` (hope you have a good connexion and a good cup of tea)
8
+ - exec ` npm start ` (perhaps you'll need ` NODE_OPTIONS="--openssl-legacy-provider" ` if your node
10
9
version is too new)
11
10
- enjoy
12
11
13
12
## Commands
14
13
15
- ### ` yarn start`
14
+ ### ` npm start`
16
15
17
16
Runs the app in a local development environment.
18
17
@@ -21,45 +20,46 @@ well.
21
20
22
21
See [ Main Readme] ( ../README.md ) if you need more information to run the docker.
23
22
24
- ### ` yarn test`
23
+ ### ` npm run test`
25
24
26
25
Launches the test runner in the interactive watch mode.
27
26
28
- ### ` yarn build`
27
+ ### ` npm run build`
29
28
30
29
Builds the app for production to the ` build ` folder.
31
30
32
- ### ` yarn generate-licenses`
31
+ ### ` npm run generate-licenses`
33
32
34
33
Update licenses attributions in /src/common/ReleaseInformations/json/
35
34
36
- ### ` yarn e2e-tests`
35
+ ### ` npm run e2e-tests`
37
36
38
37
Launches end to end tests.
39
38
40
39
It requires:
41
40
42
- - Install playwright dependencies ` cd ./front/ && yarn playwright install --with-deps `
43
- - Backend containers to be up: ` docker compose up --no-build --detach redis postgres gateway core editoast `
41
+ - Install playwright dependencies ` cd ./front/ && npm run playwright install --with-deps `
42
+ - Backend containers to be up:
43
+ ` docker compose up --no-build --detach redis postgres gateway core editoast `
44
44
- Running front with ` docker compose up --build --detach front `
45
45
46
- Now you can run the test with ` cd front/ && yarn e2e-tests ` .
46
+ Now you can run the test with ` cd front/ && npm run e2e-tests ` .
47
47
48
- > [ !CAUTION]
49
- > If you try to run ` yarn start ` instead of running it through docker, you'll notice it doesn't
50
- > work because the gateway can't access your local port from inside a container. 2 solutions:
48
+ > [ !CAUTION] If you try to run ` npm run start ` instead of running it through docker, you'll notice
49
+ > it doesn't work because the gateway can't access your local port from inside a container. 2
50
+ > solutions:
51
51
>
52
52
> - run all the components locally (you might keep Postgres and Redis in containers)
53
53
> - if on Linux, you can also launch all the containers on the host network: you can replace the
54
- > ` docker compose <something> ` above with ` osrd/scripts/osrd-compose.sh <something> `
54
+ > ` docker compose <something> ` above with ` osrd/scripts/osrd-compose.sh <something> `
55
55
56
56
If the tests fail, you'll find a ` front/test-results ` folder that will contain videos of the fail
57
57
test executions. They might be of help to understand what's going on. Note that the CI also exports
58
58
these videos as artifacts.
59
59
60
- You may also want to explore the documentation of the test framework [ Playwright ] ( https://playwright.dev/ ) .
61
- For example, try launching each test independently using ` yarn playwright test --ui ` , or debug a
62
- test with ` yarn playwright test --debug` .
60
+ You may also want to explore the documentation of the test framework
61
+ [ Playwright ] ( https://playwright.dev/ ) . For example, try launching each test independently using
62
+ ` npm run playwright test --ui ` , or debug a test with ` npm run playwright test --debug` .
63
63
64
64
## Design rules
65
65
@@ -101,8 +101,8 @@ organized in folders.
101
101
** The components propose the main JS/TS file and eventually another folder with same name containing
102
102
some minor subcomponents linked to.**
103
103
104
- - components/
105
- - views/
104
+ - components/
105
+ - views/
106
106
- [ editor/] ( #infrastructure-editor-editor )
107
107
- components/
108
108
- [ opendata/] ( #opendata-importation-opendata )
@@ -205,8 +205,8 @@ All common code (and shared components) supposed to be in `common/`.
205
205
206
206
- ESLint is used as linter and prettier as formatter. Both are configured as devDependencies to
207
207
enforce default eslint configuration eventually overidden by
208
- [ airbnb rules] ( https://airbnb.io/javascript/ ) translation. A few rules (see eslintrc) has
209
- been disabled and will be re-enabled in the near future):
208
+ [ airbnb rules] ( https://airbnb.io/javascript/ ) translation. A few rules (see eslintrc) has been
209
+ disabled and will be re-enabled in the near future):
210
210
- 'no-named-as-default': 'off',
211
211
- 'react/jsx-props-no-spreading': 0,
212
212
- 'react/static-property-placement': 0,
@@ -220,7 +220,7 @@ All common code (and shared components) supposed to be in `common/`.
220
220
[ Prettier - Code Formatter Extension] ( https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode )
221
221
and follow instructions.
222
222
223
- You may also use ` yarn lint-fix` to format/lint.
223
+ You may also use ` npm run lint-fix` to format/lint.
224
224
225
225
## Dependencies
226
226
@@ -247,12 +247,15 @@ You may also use `yarn lint-fix` to format/lint.
247
247
- jsdocs
248
248
249
249
### Updating Dependencies
250
- When ` package.json ` changes (new packages or updated versions), developers may have issues running the app with Docker. New packages or versions might not be recognized by Docker.
250
+
251
+ When ` package.json ` changes (new packages or updated versions), developers may have issues running
252
+ the app with Docker. New packages or versions might not be recognized by Docker.
251
253
252
254
To fix this, follow these steps:
253
255
254
- 1 . After pulling new changes, run ` yarn install ` to update local dependencies.
255
- 2 . If issues persist, delete ` node_modules ` and run ` yarn install ` again.
256
- 3 . Run ` docker compose build --no-cache ` to rebuild Docker images from scratch with new dependencies.
256
+ 1 . After pulling new changes, run ` npm install ` to update local dependencies.
257
+ 2 . If issues persist, delete ` node_modules ` and run ` npm install ` again.
258
+ 3 . Run ` docker compose build --no-cache ` to rebuild Docker images from scratch with new
259
+ dependencies.
257
260
258
261
This ensures developers can run the app with the latest dependencies using Docker.
0 commit comments