-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guide
- Select a issue from the IMS issues.
- Pull the latest version of the
develop
branch - Create a branch from there called
#{insert label (e.g feature or bug)}/{insert general name of story}-#{story number}
- Put the issue into
In Progress
- Repeatedly during development:
- Develop code/write tests
- Ensure all tests pass
- Run linter and fix issues
- Commit - ideally, each commit message should have the issue number included, so that we can track the code related to resolving the issue
- (optionally) push to origin
- Merge
origin/develop
into your feature branch. - Run unit tests
- Check impact on coverage
- Run e2e tests
- Push to
origin
- Make a pull request - the PR description should also point to the relevant issue
- Put the issue into
In Review
- Get the pull request reviewed, if more work needs to be done go back to step 4.
- Wait for the automated build (if it exists, otherwise the reviewer should do these steps)
- Once a pull request is approved then it can be merged back into
origin/develop
- Wait for the automated build for the merge in to
develop
to pass. - Move the issue to
Done
and close the issue.
When working on a new feature the branch should follow the naming convention feature/{insert general name of story}-#{story number}
. This indicates it is new functionality as well as linking it to the story (for potential future requirement tracing)
If working on a bug from a previous story then the branch should follow the pattern bugfix/{general name of bug}-#{story/bug number}
.
To develop the Inventory management system you will need the following tools:
- Node.js (https://nodejs.org/en/) - (LTS version at the time of writing is 20.17.0)
- NPM (comes with the node.js installation)
- An IDE for developing with JavaScript (VS Code is a good cross-platform suggestion)
- Yarn
- Docker
- Docker Compose
Installation instructions are available on the sites for each tool and depend on your operating system, e.g. node can be installed as an msi on a windows machine
Note: if installing Node.js on Linux machines please read https://nodejs.org/en/download/package-manager/ as these detail how to ensure you are able to get the most recent version of Node.js on your machine, rather than an old version in the default package.
- React Dev Tools extension: Chrome Firefox
- Redux Dev Tools extension: http://extension.remotedev.io/
- Useful VSCode extensions:
- JavaScript development:
- ESLint - displays eslint errors in the editor
- npm Intellisense - autocompletes npm import statements
- npm - validates that dependencies are installed and adds NPM commands to command pallete
- Prettier - can format files using Prettier - I have it set to format on save ;)
- Git:
- GitLens - enhances VSCode git support
- General:
- Code Coverage - highlights uncovered lines of code in the editor
- JavaScript development:
Here's a list of useful tutorials to help new developers learn the technologies required:
- Javascript: Intro to Javascript, Async Javascript, JS Handbook
- ES6 Javascript: The ES6 Guide
- React: Official Tutorial, codecademy, React Handbook
- Redux: Official Tutorial, What is a Redux reducer?
- Typescript: Official Typescript docs, React & Redux in TypeScript - Static Typing Guide
- React/Redux, JavaScript, CSS (and more): freeCodeCamp Curriculum
First of all, you will need to clone the repository and navigate to the project directory:
git clone git@github.com:ral-facilities/inventory-management-system.git
cd inventory-management-system
Create a inventory-management-system-settings.json file
cp public/inventory-management-system-settings.example.json public/inventory-management-system-settings.json
Run install all the dependancies
yarn install
When switching branches you may need to run yarn install
if the branch you are on has installed extra dependencies
If you get errors about dependencies not being met, especially after switching branches, then this may be due to yarn having mismatching versions and getting stuck and unable to upgrade. This can usually be fixed by deleting the node_modules
folder and running yarn install
freshly
Start the website
yarn dev
Build and start the Docker containers:
docker-compose up
The website should now be running at http://localhost:3000.
Start IMS API (using docker-compose.yml)
- https://github.com/ral-facilities/inventory-management-system-api?tab=readme-ov-file#docker-setup
- Make sure to set
AUTHENTICATION__ENABLED
set tofalse
in the.env
file as Scigateway (the parent application) deals with authentication
IMS API should be running http://localhost:8000. To check if it is running correctly you access the open api docs.
Edit the apiUrl
in the inventory-management-system-settings.json
to be
'http://localhost:8000'
Start the website
yarn dev
Build and start the Docker containers:
docker-compose up
The website should now be running at http://localhost:3000.
Start IMS API (using docker-compose.yml)
- https://github.com/ral-facilities/inventory-management-system-api?tab=readme-ov-file#docker-setup
- Make sure to set
AUTHENTICATION__ENABLED
set totrue
in the.env
IMS API should be running http://localhost:8000.
Edit the apiUrl
in the inventory-management-system-settings.json
to be
'http://localhost:8000'
Start ldap-jwt-auth (using docker-compose.yml)
- https://github.com/ral-facilities/ldap-jwt-auth?tab=readme-ov-file#docker-setup
- For local setup you want to change port to 8001 so it doesn't clash with IMS API (change in docker-compose.yml)
ldap-jwt-auth should be running http://localhost:8001.
Start Scigateway(on react-18 branch react-18-#1205
)
- https://github.com/ral-facilities/scigateway/wiki/Setting-up-a-dev-environment/_edit#starting-parent-app-development
- Make sure to copy over the
inventory-management-system-settings.json
to the public folder in scigateway - In the
settings.json
change to these setting match the example below
{
"plugins": [
{
"name": "inventory-managment-system",
"src": "http://localhost:5001/main.js",
"enable": false,
"location": "main"
}
],
"auth-provider": "jwt",
"authUrl":"http://localhost:8001"
}
Starting IMS
Start the website
yarn bulid:preview
This should build the main.js
on http://localhost:5001.
-
Skip these step
Start ldap-jwt-auth (using docker-compose.yml)
-
Make sure that
AUTHENTICATION__ENABLED
set tofalse
in the.env
in IMS API -
The scigateway
setting.json
should look like this
{
"plugins": [
{
"name": "inventory-managment-system",
"src": "http://localhost:5001/main.js",
"enable": false,
"location": "main"
}
],
"auth-provider": null,
"authUrl":""
}
Here is a list of common commands used in development and a short description of what they do
-
yarn dev
- start the development server that does hot reloading -
yarn build
- build the final bundled javascript -
yarn test
- run the tests and calculate the coverage -
yarn lint
- lint (and fix as much as possible) the typescript/javascript code -
yarn e2e
- run the end-to-end tests in a headless mode with mock data (useful for CI systems) -
yarn e2e:interactive
- run the end-to-end tests interactively with mock data (useful for debugging e2e tests) -
yarn e2e:api
- run the end-to-end tests in a headless mode using the api (useful for CI systems) -
yarn e2e:interactive:api
- run the end-to-end tests interactively using the api (useful for debugging e2e tests)
More commands can be found in package.json
- specifically in the scripts
section