Skip to content

Commit

Permalink
Merge branch 'main' into task/WG-237-Delete-Project-Modal-React
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-massie authored Oct 29, 2024
2 parents ec62b60 + 1fd38c9 commit ac4f7d0
Show file tree
Hide file tree
Showing 133 changed files with 18,385 additions and 14,759 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ Hazmapper is an application for creating, visualizing, and analyzing geospatial

See https://github.com/TACC-Cloud/geoapi which is an associated restful API.

## Local React Development (work-in-progress)
## Local React Development

`react/` has the React client
`react/` directory contains the React client

To get started, create a local secret file for local development:
```
cp react/src/secret_local.example.ts react/src/secret_local.ts
```

Get a JWT from someone on WMA-Geospatial subgroup and add the jwt to `react/src/secret_local.ts`.
The `geoapiBackend` setting in `react/src/secret_local.ts` ( see the example [react/src/secret_local.example.ts](react/src/secret_local.example.ts) ) controls which backend `GeoAPI` is used by Hazmapper during local development. You can choose from the following:

The `geoapiBackend` in ( see [react/src/secret_local.example.ts](react/src/secret_local.example.ts) ) can be used to select which backend `geoapi` is used by Hazmapper during local development (e.g. `EnvironmentType.Production`, `EnvironmentType.Staging`, `EnvironmentType.Dev`, * `EnvironmentType.Local`
* `EnvironmentType.Production`
* `EnvironmentType.Staging`
* `EnvironmentType.Dev`
* `EnvironmentType.Local`

See https://github.com/TACC-Cloud/geoapi for more details on running geoapi locally.
To run Hazmapper with the GeoAPI backend locally, configure `geoapiBackend` to use `GeoapiBackendEnvironment.Local` and see the [GeoAPI repository](https://github.com/TACC-Cloud/geoapi) for more detailed instructions.

#### Run

Expand All @@ -26,7 +29,7 @@ npm ci
npm run dev
```

Navigate to `http://localhost:4200/` or `http://hazmapper.local:4200/`. (Note that `hazmapper.local` needs to be added to your `/etc/hosts`)
Navigate to `http://localhost:4200/`.

#### Running unit tests

Expand Down
2 changes: 0 additions & 2 deletions react/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
dist/
build/
coverage/
src/core-components/
src/core-wrappers/
24 changes: 15 additions & 9 deletions react/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
* https://jestjs.io/docs/configuration
*/

// https://stackoverflow.com/questions/73504569/syntaxerror-unexpected-token-export-from-react-leaflet-while-using-jest
const esModules = ['@react-leaflet', 'react-leaflet'].join('|');
const esModules = [
'@react-leaflet',
'react-leaflet',
'@tacc/core-components',
].join('|');

module.exports = {
// All imported modules in your tests should be mocked automatically
Expand All @@ -28,7 +31,7 @@ module.exports = {
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['src/core-components/', 'src/core-wrappers'],
// coveragePathIgnorePatterns: ['src/some-components/', 'src/some-wrappers'],

// Indicates which provider should be used to instrument code for coverage
// coverageProvider: "babel",
Expand Down Expand Up @@ -85,6 +88,9 @@ module.exports = {
'^utils(.*)$': '<rootDir>/src/utils$1',
'^hooks(.*)$': '<rootDir>/src/hooks$1',
'^react-leaflet$': require.resolve('react-leaflet'),
'^@hazmapper/(.*)$': '<rootDir>/src/$1',
'^@core-components$': '<rootDir>/src/core-components/index.ts',
'^@core-components/(.*)$': '<rootDir>/src/core-components/$1',
},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
Expand Down Expand Up @@ -157,10 +163,10 @@ module.exports = {
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: [
'<rootDir>/src/core-components/',
'<rootDir>/src/core-wrappers/',
],
// testPathIgnorePatterns: [
// '<rootDir>/src/some-components/',
// '<rootDir>/src/some-wrappers/',
// ],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand All @@ -178,10 +184,10 @@ module.exports = {
// timers: "real",

// A map from regular expressions to paths to transformers
transform: { '^.+\\.(js|jsx)?$': 'babel-jest' },
transform: { '^.+\\.(js|jsx|mjs)?$': 'babel-jest' },

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
transformIgnorePatterns: [`/node_modules/(?!(${esModules}))`],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
Expand Down
Loading

0 comments on commit ac4f7d0

Please sign in to comment.