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
@@ -100,8 +100,8 @@ organized in folders.
100
100
** The components propose the main JS/TS file and eventually another folder with same name containing
101
101
some minor subcomponents linked to.**
102
102
103
- - components/
104
- - views/
103
+ - components/
104
+ - views/
105
105
- [ editor/] ( #infrastructure-editor-editor )
106
106
- components/
107
107
- [ opendata/] ( #opendata-importation-opendata )
@@ -204,8 +204,8 @@ All common code (and shared components) supposed to be in `common/`.
204
204
205
205
- ESLint is used as linter and prettier as formatter. Both are configured as devDependencies to
206
206
enforce default eslint configuration eventually overidden by
207
- [ airbnb rules] ( https://airbnb.io/javascript/ ) translation. A few rules (see eslintrc) has
208
- been disabled and will be re-enabled in the near future):
207
+ [ airbnb rules] ( https://airbnb.io/javascript/ ) translation. A few rules (see eslintrc) has been
208
+ disabled and will be re-enabled in the near future):
209
209
- 'no-named-as-default': 'off',
210
210
- 'react/jsx-props-no-spreading': 0,
211
211
- 'react/static-property-placement': 0,
@@ -219,7 +219,7 @@ All common code (and shared components) supposed to be in `common/`.
219
219
[ Prettier - Code Formatter Extension] ( https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode )
220
220
and follow instructions.
221
221
222
- You may also use ` yarn lint-fix` to format/lint.
222
+ You may also use ` npm run lint-fix` to format/lint.
223
223
224
224
## Dependencies
225
225
@@ -246,12 +246,15 @@ You may also use `yarn lint-fix` to format/lint.
246
246
- jsdocs
247
247
248
248
### Updating Dependencies
249
- 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.
249
+
250
+ When ` package.json ` changes (new packages or updated versions), developers may have issues running
251
+ the app with Docker. New packages or versions might not be recognized by Docker.
250
252
251
253
To fix this, follow these steps:
252
254
253
- 1 . After pulling new changes, run ` yarn install ` to update local dependencies.
254
- 2 . If issues persist, delete ` node_modules ` and run ` yarn install ` again.
255
- 3 . Run ` docker compose build --no-cache ` to rebuild Docker images from scratch with new dependencies.
255
+ 1 . After pulling new changes, run ` npm install ` to update local dependencies.
256
+ 2 . If issues persist, delete ` node_modules ` and run ` npm install ` again.
257
+ 3 . Run ` docker compose build --no-cache ` to rebuild Docker images from scratch with new
258
+ dependencies.
256
259
257
260
This ensures developers can run the app with the latest dependencies using Docker.
0 commit comments