Skip to content

Commit

Permalink
Merge branch 'stage' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett committed Feb 27, 2024
2 parents 3fd2efe + 7e18208 commit 6b1142c
Show file tree
Hide file tree
Showing 538 changed files with 934 additions and 2,820 deletions.
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

13 changes: 0 additions & 13 deletions .editorconfig

This file was deleted.

35 changes: 0 additions & 35 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/github-actions-PR-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 18
- name: Report runtime details
run: |
echo "Github runner OS: ${{ runner.os }}"
Expand Down
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ package-lock.json
/dist
/tmp
/out-tsc
/build

# dependencies
node_modules
/node_modules
/dist
/build
/src/dist
/public/sitemap.xml
/public/robots.txt
/public/main-sitemap.xml
/src/resourceDescriptors.js

# IDEs and editors
/.idea
Expand Down
3 changes: 0 additions & 3 deletions .nvm_install

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/fermium
lts/hydrogen
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

4 changes: 0 additions & 4 deletions .storybook/main.js

This file was deleted.

10 changes: 0 additions & 10 deletions .storybook/tsconfig.json

This file was deleted.

31 changes: 0 additions & 31 deletions .storybook/webpack.config.js

This file was deleted.

32 changes: 0 additions & 32 deletions Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions LICENSE.md

This file was deleted.

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ uirun:
uirunstage:
API_URL=https://stage.alliancegenome.org npm start

uiruntest:
API_URL=https://test.alliancegenome.org npm start

docker-build-nginx:
docker build -t ${REG}/agr_ui_server:${DOCKER_BUILD_TAG} --build-arg REG=${REG} --build-arg DOCKER_PULL_TAG=${DOCKER_PULL_TAG} .

Expand Down
101 changes: 23 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
![project logo](https://raw.githubusercontent.com/alliance-genome/agr_ui/master/src/containers/layout/agrLogo.png)

# Alliance of Genome Resources UI

Frontend code for the Alliance of Genome Resources website.

This repository uses [Nx](https://nx.dev/react) to facilitate development of multiple apps and libraries in a single [monorepo](https://nx.dev/latest/react/core-concepts/why-monorepos).

The [Nx CLI](https://nx.dev/latest/react/getting-started/cli-overview) or the interactive [Nx Console]() is used to build, run, test apps and libs, as well as generating library or application code with modern tooling enabled (such as ESLint/TSlint, Prettier, Jest, Cypress, Storybook).

## Folder structure

**If you developed in this repo before it was reorganizated, you will find that code moved to [apps/main-app/](apps/main-app/).**

`apps/` contains frontend sites that can be developed and deployed independently

`libs/` contains shared libraries across apps. These libaraies can be published for use outside of this repo. But publishing a library is not necessary for using it within the repo.

`package.json`, `package-lock.json` and `node_modules/` track the dependencies for by all apps and libs. This means that dependencies installation for any app or library should happend at the **root** of the project.

`workspace.json` is where configuration for apps and libs are defined.

## Prerequisites

nvm is used to manage Node.js versions. [Follow these instructions](https://github.com/nvm-sh/nvm#installing-and-updating) to install nvm.

It is not strictly required, but highly recommended that you have configured your development environment to use [EditorConfig](https://editorconfig.org/) and [ESLint](https://eslint.org/docs/user-guide/integrations).

## Installation

Ensure the correct version of Node.js is **installed**, if using the particular version of Node.js for the same time:
Ensure the correct version of Node.js is **installed**, if using the particular version of Node.js for the first time:

```bash
nvm install
Expand All @@ -51,100 +36,60 @@ npm install

_Note: the command uses **npm**, not nvm. NPM deals with package dependencies._

## Development

### Development of the [Main App](apps/main-app/)

[apps/main-app/](apps/main-app/) holds most of the AGR UI code written before the re-organization of this repo.

Development is done using a webpack development server, which is configured using [these configurations](apps/main-app/webpack.js).

To start the development server:

```
npm start
```

The development server will be started at [http://localhost:2992](http://localhost:2992).

When you edit source files, the changes will automatically be compiled and updated in your browser.

The development server proxies API requests to the API server. The API server can be specified using the `API_URL` environment variable. It is set to `https://build.alliancegenome.org` by default.
## Build

To change the API server host for the proxy, run:
To build an app or lib for production

```bash
export API_URL=https://stage.alliancegenome.org # to send proxied requests to the stage server.
npm run build
```

and re-start the development server.
## Development

### Development of Additional Apps
### Development of the [App](/src)

To start the development environment for other apps found in [apps](apps/), the command can be run with the respective app name.
[/src](/src) holds most of the AGR UI code written before the re-organization of this repo.

Take the [example-app](apps/example-app/) for example, to start the development server, run:
To start the development server:

```bash
npm start example-app
```

## Tests

To run linter on source files:

```bash
npm run lint # for the main-app
npm start
```

OR

```bash
npm run lint [app-name] # for other apps or libs
```
The development server will be started at [http://localhost:3000](http://localhost:3000).

Execute tests:
When you edit source files, the changes will automatically be compiled and updated in your browser.

```bash
npm run test # for the main-app
```
The development server proxies API requests to the API server. The API server can be specified using the `API_URL` environment variable.

OR
If need be the API_URL can be changed by setting it on the command line before running the UI:

```bash
npm run test [app-name] # for other apps or libs
> export API_URL=https://stage.alliancegenome.org; npm start # to send proxied requests to the stage server.
```

## Build

To build an app or lib for production
Additionally, there are two convenience commands that will proxy `/api` requests to either the stage or test environments

```bash
npm run build --prod # for the main-app
> make uirunstage
```

OR

```bash
npm run build [app-name] --prod # for other apps or libs
> make uiruntest
```

## Create a Shared Library
## Tests

To create a library interactively via CLI:
Execute tests:

```bash

npm run nx generate @nrwl/react:library [lib-name]
npm run test
```

Or using a graphical interface via the [Nx Console VSCode plugin](https://nx.dev/latest/react/getting-started/console).

## Frameworks & Tools

- [React](https://reactjs.org/) for routing and building user interface components
- [Nx](https://nx.dev/) for consistent code generation and execution, and managing multiple node modules in one repo
- [Redux](https://redux.js.org/) and [Immutable](https://immutable-js.github.io/immutable-js/) for state management
- [Redux](https://redux.js.org/), [Immutable](https://immutable-js.github.io/immutable-js/), and [React Query](https://tanstack.com/query/v3/docs/react/overview) for state management
- [Bootstrap](https://getbootstrap.com/), [reactstrap](https://reactstrap.github.io), [Sass](https://sass-lang.com/), [CSS Modules](https://github.com/css-modules/css-modules) for styling
- [Mocha](https://mochajs.org/) for testing
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) for testing
- [Webpack](https://webpack.js.org/) and [Babel](https://babeljs.io/) for compiling and bundling

9 changes: 4 additions & 5 deletions amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ frontend:
phases:
preBuild:
commands:
- mkdir dist
- nvm use
- npm install
- npm install --legacy-peer-deps
build:
commands:
- NODE_ENV=$BUILD_ENV npm run build
- npm run build
artifacts:
baseDirectory: dist/apps/main-app
baseDirectory: build
files:
- '**/*'
- "**/*"
4 changes: 0 additions & 4 deletions apps/main-app/.babelrc

This file was deleted.

16 changes: 0 additions & 16 deletions apps/main-app/.browserslistrc

This file was deleted.

Loading

0 comments on commit 6b1142c

Please sign in to comment.