@@ -9,19 +9,18 @@ will help you set that up easily.
99### Basic Dependencies:
1010
1111* [ Node 18, 20 LTS] ( https://nodejs.org/ )
12- * [ yarn] ( https://yarnpkg.com/ )
13- * [ jq] ( https://stedolan.github.io/jq/ )
12+ * [ jq] ( https://jqlang.org/ )
1413* [ curl] ( https://curl.haxx.se/ )
1514
1615### Initial Setup
1716
18- 1 . Create a ` .env.development. local ` file and then look through ` .env ` at the
17+ 1 . Create a ` .env.local ` file and then look through ` .env ` at the
1918 available configuration options and override any desired settings in your
20- new ` .env.development. local `
19+ new ` .env.local `
2120
22- 2 . ` yarn ` to fetch and install NPM modules
21+ 2 . ` npm install ` to fetch and install NPM modules
2322
24- 3 . ` yarn run start` to fire up the front-end development server
23+ 3 . ` npm run start` to fire up the front-end development server
2524
2625A back-end server from the [ maproulette-backend] ( https://github.com/maproulette/maproulette-backend )
2726project is also required. You can either install and configure it locally or, if
@@ -33,15 +32,18 @@ key for that server.
3332To avoid platform specific issues, the UI can be built and run within a docker container.
3433Note that this will create the development build and not the 'production' build.
3534
36- 1 . First make the required ` .env.development. local ` file. A few overrides are required, like these:
35+ 1 . First make the required ` .env.local ` file. A few overrides are required, like these:
3736
3837 ```
3938 REACT_APP_URL='http://127.0.0.1:3000'
4039 REACT_APP_SERVER_OAUTH_URL='http://127.0.0.1:9000/auth/authenticate?redirect=http://127.0.0.1:3000'
4140 ```
4241
43422 . Build the image using ` docker build --pull -t maproulette-ui . `
44- 3 . Start a container from the image using ` docker run -itd -p 127.0.0.1:3000:3000 --name maproulette-ui maproulette-ui `
43+ 3 . Start a container from the image using ` docker run -d -p 127.0.0.1:3000:80 maproulette-ui `
44+
45+ Note that if you make changes to the code, you'll need to rebuild the image and restart
46+ the container to see them reflected in the application.
4547
4648#### Developing with a local back-end server
4749
@@ -81,7 +83,7 @@ Note that this will create the development build and not the 'production' build.
8183 on the command line. See the maproulette-backend docs for details on starting up
8284 the server
8385
84- 6 . Edit your ` .env.development. local ` file in your front-end project and set:
86+ 6 . Edit your ` .env.local ` file in your front-end project and set:
8587 ```
8688 REACT_APP_SERVER_OAUTH_URL='http://127.0.0.1:9000/auth/authenticate?redirect=http://127.0.0.1:3000'
8789 ```
@@ -99,7 +101,7 @@ a local one you have installed. **Please do not use the production API for devel
99101 Alternatively, you can use the server's ` super.key ` if it has been setup
100102 with one and you have access to it
101103
102- 2 . Edit your ` .env.development. local ` file and override the following config
104+ 2 . Edit your ` .env.local ` file and override the following config
103105 variables:
104106 ```
105107 REACT_APP_MAP_ROULETTE_SERVER_URL='https://yourserver.com'
@@ -108,7 +110,7 @@ a local one you have installed. **Please do not use the production API for devel
108110 REACT_APP_SERVER_API_KEY='your-api-key-for-that-server'
109111 ```
110112
111- 3 . Restart your front-end dev server if it's already running (ctrl-c then `yarn
113+ 3 . Restart your front-end dev server if it's already running (ctrl-c then `npm
112114 run start` again)
113115
1141164 . Point your browser directly at the front-end server, http://127.0.0.1:3000
@@ -122,24 +124,24 @@ a local one you have installed. **Please do not use the production API for devel
122124
1231251 . Stop your front-end server (ctrl-c) if it's running.
1241262 . Pull the latest code
125- 3 . ` yarn ` to install new or updated NPM packages
126- 4 . ` yarn run start` to restart the front-end server.
127+ 3 . ` npm install ` to install new or updated NPM packages
128+ 4 . ` npm run start` to restart the front-end server.
127129
128130## Staging/Production build:
129131
1301321 . Setup a ` .env.production ` file with the desired production setting overrides.
131- * set ` REACT_APP_URL='https://myserver .com' `
133+ * set ` REACT_APP_URL='https://example .com' `
132134 (substituting your domain, of course)
133- * set ` REACT_APP_MAP_ROULETTE_SERVER_URL='https://myserver .com' `
135+ * set ` REACT_APP_MAP_ROULETTE_SERVER_URL='https://example .com' `
134136 * if you wish to use [ Matomo/PIWIK] ( https://github.com/matomo-org/matomo ) for
135137 analytics, set ` REACT_APP_MATOMO_URL ` and ` REACT_APP_MATOMO_SITE_ID ` to your
136138 tracking url and site id, respectively (see ` .env ` file for example).
137139 * set feature flags to ` enabled ` or ` disabled ` as desired.
138140 * override any other settings from the ` .env ` file as needed or desired.
139141
140- 2 . ` yarn ` to install and update NPM packages.
142+ 2 . ` npm install ` to install and update NPM packages.
141143
142- 3 . ` yarn run build` to create a minified front-end build in the ` build/ `
144+ 3 . ` npm run build` to create a minified front-end build in the ` build/ `
143145 directory.
144146
145147## Adding Additional and Custom Map Layers
@@ -187,14 +189,24 @@ Release versions follow [Semantic Versioning](https://semver.org/).
187189
188190## Unit Tests
189191
190- Unit tests are built with [ Jest] ( https://facebook.github.io/jest/ ) +
191- [ Enzyme] ( https://github.com/airbnb/enzyme ) .
192+ Unit tests are built with [ Vitest] ( https://vitest.dev/ ) ,
193+ [ React Testing Library] ( https://testing-library.com/docs/react-testing-library/intro ) ,
194+ and [ Enzyme] ( https://github.com/airbnb/enzyme ) .
192195
193- ` yarn test` to run them in watch mode.
196+ Use ` npm run test` to run them in watch mode.
194197
195198## Linting and formatting
196199
197- Run ` yarn format ` to format your code. Run ` yarn lint ` to check for lint errors.
200+ Run ` npm run format ` to format your code. Run ` npm run lint ` to check for lint
201+ errors (` npm run lint -- --fix ` will fix any lint errors that can be corrected
202+ automatically).
203+
204+ Pull requests are run through a CI (Continuous Integration) process that checks
205+ to make sure that code is formatted correctly and that there are no linting
206+ errors. You can run ` npm run check ` to apply these same checks locally. This
207+ will check to make sure your code is formatted correctly and passes the linter,
208+ but won't make any changes in the event that it isn't (it will just report an
209+ error).
198210
199211If you want, you can enable a pre-commit hook to check for linting and formatting
200212issues automatically when you run ` git commit ` . To enable the check, run this
@@ -204,6 +216,10 @@ command in the root of the repository:
204216git config core.hooksPath hooks
205217```
206218
219+ This configures Git to use the hook scripts in the ` hooks/ ` directory. The
220+ ` pre-commit ` script there is run when Git prepares a commit. That script runs
221+ ` npm run check ` to ensure there are no linting or formatting errors.
222+
207223If you want to skip the check for a particular commit (for work-in-progress commits
208224for example), run ` git commit --no-verify ` .
209225
@@ -221,8 +237,8 @@ Internationalization and localization is performed via
221237co-located Messages.js files that contain messages intended for display,
222238along with default (U.S. English) versions of each message.
223239
224- A fresh en-US.json file can be built from the latest messages using `yarn run
225- build-intl` , which is also run automatically as part of the ` yarn build` script
240+ A fresh en-US.json file can be built from the latest messages using `npm run
241+ build-intl` , which is also run automatically as part of the ` npm run build` script
226242used for creating production builds.
227243
228244Translations for other locales are managed through
0 commit comments