-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to pnpm #1071
Switch to pnpm #1071
Changes from all commits
36f0192
23e8689
2ba04aa
b2bff2d
2b4294d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
<p align="center"><img src="http://mxcube.github.io/mxcube/img/mxcube_logo20.png" width="125"/></p> | ||
|
||
# MXCuBE-Web | ||
|
||
MXCuBE-Web is the latest generation of the data acquisition software MXCuBE (Macromolecular Xtallography Customized Beamline Environment). The project started in 2005 at [ESRF](http://www.esrf.eu), and has since then been adopted by other institutes in Europe. In 2010, a collaboration agreement has been signed for the development of MXCuBE with the following partners: | ||
|
||
- ESRF | ||
|
@@ -26,12 +27,10 @@ MXCuBE-Web is developed as a web application and runs in any recent browser. The | |
|
||
The underlaying beamline control layer is implemented using the library [**mxcubecore**](https://github.com/mxcube/mxcubecore) previously known as [HardwareRepository](https://github.com/mxcube/HardwareRepository). The **mxcubecore** module is compatable with both MXCuBE-Web and the [MXCuBE-Qt application](https://github.com/mxcube/mxcubeqt). | ||
|
||
|
||
| Data collection | Sample grid | | ||
| :-------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | | ||
| ![datacollection-view](https://user-images.githubusercontent.com/4331447/42496925-d983bf3e-8427-11e8-890e-898dda649101.png) | ![samplegrid-view](https://user-images.githubusercontent.com/4331447/42496937-e8547b34-8427-11e8-9447-645e6d7f1dc5.png) | | ||
|
||
|
||
Latest information about the MXCuBE project can be found on the | ||
[project webpage](http://mxcube.github.io/mxcube/). | ||
|
||
|
@@ -62,6 +61,7 @@ Gabadinho, J. et al. (2010). MxCuBE: a synchrotron beamline control environment | |
We recommend using conda to create an isolated environment, conda can be downloaded [here](https://docs.conda.io/en/latest/miniconda.html#linux-installers). | ||
|
||
### 1. Create a folder that will contain both `mxcubeweb` and `mxcubecore` | ||
|
||
``` | ||
mkdir mxcube | ||
cd mxcube | ||
|
@@ -75,6 +75,7 @@ git clone https://github.com/mxcube/mxcubecore.git | |
``` | ||
|
||
### 3. Create Conda environment `mxcubeweb` | ||
|
||
We recommend using conda a convenience and create a seperate environemnt for libraries and python version. This, though, is not compulsory and one can use any other tool or configuration for installing the application and the necessary third party libraries. | ||
|
||
Create Conda environment `mxcubeweb` using the conda environment file in mxcubeweb. The installation of the dependencies in the environment takes a few minutes. | ||
|
@@ -98,45 +99,45 @@ conda activate mxcubeweb | |
|
||
``` | ||
poetry install | ||
npm install --global pnpm@8 | ||
``` | ||
|
||
### 6. Install front-end dependencies and build the UI | ||
|
||
``` | ||
npm install --legacy-peer-deps | ||
# (NB --legacy-peer-deps is for the moment needed for the testing library Cypress) | ||
npm run build | ||
pnpm --prefix ui install | ||
pnpm --prefix ui build | ||
``` | ||
|
||
### 7. Running the application (server) | ||
### 7. Starting the MXCuBE server | ||
|
||
``` | ||
# Start redis-server (if not already running) | ||
# Open a new terminal: | ||
# Activate the conda environement and start the Redis server (if not already running) | ||
conda activate mxcubeweb | ||
redis-server | ||
|
||
# In the previous terminal: | ||
# The paths passed below needs to be the full path (thats why there is an extra `$(pwd)` in the command below) | ||
# to the HardwareObjectsMockup.xml and build directories. | ||
mxcubeweb-server -r $(pwd)/mxcubeweb/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/mxcubeweb/ui/build/ -L debug | ||
# In a separate terminal, start the MXCuBE server (note the use of `$(pwd)` to specify absolute paths): | ||
mxcubeweb-server -r $(pwd)/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug | ||
``` | ||
|
||
_Running the above should give something similar to_ | ||
![mxcube-backend](https://github.com/mxcube/mxcubeweb/assets/4331447/33c01fd3-14fe-4437-a2d2-6525e739f9b3) | ||
|
||
### 8. Running the MXCuBE-WEB front-end | ||
### 8. Serving the MXCuBE-Web front-end application | ||
|
||
All that is needed to run the application is to start the server and point your browser to http://localhost:8081, which will serve the prebuilt client (if any). | ||
All that is needed to run the application is to start the server and point your browser to http://localhost:8081, which will serve the prebuilt client (if any). | ||
|
||
_The test username is `idtest0` and the password can be any string (except `wrong` and `ispybDown`, those are used to emulate different behaviors), you can use `test` as a password for example:_ | ||
![mxcube-login](https://github.com/mxcube/mxcubeweb/assets/4331447/a29f9c55-a4e1-474e-89cc-854f1c3c24d8) | ||
|
||
The client is not built if nothing appears or you get a "404 page not found" error when browsing localhost:8081. Follow the instructions in step 6 "Install front-end dependencies and build the UI" to build a client . | ||
|
||
### 9. Installing MXCUBE-WEB for development | ||
### 9. Installing MXCUBE-Web for development | ||
|
||
Please read the [contributing guidelines](https://github.com/mxcube/mxcubeweb/blob/develop/CONTRIBUTING.md) before getting started with the development. | ||
|
||
The additional tools for development are in the conda-environment-dev.yml file, the environment created above needs to be updated with this. | ||
|
||
``` | ||
# Make sure the environment created above is activated | ||
conda activate mxcubeweb | ||
|
@@ -145,7 +146,7 @@ conda activate mxcubeweb | |
conda env update --file conda-environment-dev.yml | ||
``` | ||
|
||
Its recommended to install mxcubeweb and mxcubecore as links to be able to add breakpoints and debug the application easier. | ||
It's recommended to install mxcubeweb and mxcubecore as links to be able to add breakpoints and debug the application more easily. | ||
This can be done with `pip`. | ||
|
||
``` | ||
|
@@ -156,55 +157,52 @@ pip install -e . | |
pip install -e . | ||
``` | ||
|
||
The above makes it possible to add break points directly in the "checked out code". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repeats what is said before the commands block. |
||
|
||
Before running any test, make sure that the local *Redis* server is running. For example with the `mxcubeweb` *conda* environment activated in a terminal, run the `redis-server` command. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to next section. |
||
|
||
#### 9.1 Running tests | ||
#### 9.1 Running the back-end tests | ||
|
||
The tests are located in the test folder and are executed with `pytest` | ||
The tests are located in the test folder and are executed with `pytest`. | ||
|
||
``` | ||
# Run pytest In the root of the mxcubeweb directory | ||
cd mxcubeweb | ||
# Make sure that the conda environment is activated and that the local Redis server is running: | ||
conda activate mxcubeweb | ||
redis-server | ||
|
||
# In a separate terminal, activate the environment again and run pytest from the project root of mxcubeweb: | ||
conda activate mxcubeweb | ||
pytest | ||
``` | ||
|
||
_The output should look something like the following:_ | ||
![image](https://github.com/mxcube/mxcubeweb/assets/4331447/379fa92e-566b-47e5-8522-cacfa9f8de2d) | ||
|
||
#### 9.2 Running the front-end development server | ||
The front end development server, webpack development server, listens to changes on the filesystem and builds (re-builds) the UI when a change are made. This makes it very easy and fast to see how a change effects the UI and makes debugging alot easier. The developmen server listens on port **3000** | ||
#### 9.2 Starting the front-end development server | ||
|
||
``` | ||
# The front-end needs the backend to run so before starting the | ||
# development server open a new terminal and run (as in step 7): | ||
The front-end development server listens to changes on the file system and re-builds the UI when changes are made. This makes it very easy and fast to see how changes affect the UI. The development server listens on port **3000**. | ||
|
||
``` | ||
# Activate the Conda environment and start the MXCuBE server (cf. step 7) | ||
conda activate mxcubeweb | ||
mxcubeweb-server -r $(pwd)/mxcubeweb/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/mxcubeweb/ui/build/ -L debug | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At this point, we're already in the |
||
mxcubeweb-server -r $(pwd)/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug | ||
|
||
# Enter the `ui` folder and issue: | ||
npm run start | ||
# Enter the `ui` folder and start the front-end developement server: | ||
cd ui | ||
pnpm start | ||
|
||
# Note that you can also run any pnpm script from the root folder with: | ||
pnpm --prefix ui <script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought it'd be a good place to explain this. |
||
``` | ||
|
||
The above will automatically open a browser with the URL: http://localhost:3000 | ||
Your default browser will open automatically at http://localhost:3000. | ||
|
||
#### 9.4 Running the end to end (e2e) tests | ||
#### 9.4 Running the end-to-end tests (E2E) | ||
|
||
``` | ||
# Keep the backend running, and issue in the mxcubeweb root: | ||
npm run --prefix ./ui e2e | ||
|
||
# With the MXCuBE server still running, run: | ||
pnpm e2e | ||
``` | ||
|
||
_This should give a result looking something like:_ | ||
![image](https://github.com/mxcube/mxcubeweb/assets/4331447/e3d0eda7-caa1-44c2-9791-05ef482b81ad) | ||
|
||
|
||
#### 9.5 Ready to develop | ||
Use your favorite editor to start working with the code. Read the [contributing guidelines](https://github.com/mxcube/mxcubeweb/blob/develop/CONTRIBUTING.md) and check that linting tools are setup correctly. There are settings [files](https://github.com/mxcube/mxcubeweb/tree/develop/.vscode) for visual studio code in the repository. | ||
|
||
|
||
|
||
|
||
|
||
Use your favorite editor to start working with the code. Read the [contributing guidelines](https://github.com/mxcube/mxcubeweb/blob/develop/CONTRIBUTING.md) and check that linting tools are setup correctly. There are settings [files](https://github.com/mxcube/mxcubeweb/tree/develop/.vscode) for visual studio code in the repository. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,15 +46,15 @@ mxcube_download() { | |
} | ||
|
||
init_conda() { | ||
command conda create --name mxcube-web | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for consistency with the docs |
||
command conda env update --name mxcube-web --file conda-environment.yml | ||
command conda activate mxcube-web | ||
command conda create --name mxcubeweb | ||
command conda env update --name mxcubeweb --file conda-environment.yml | ||
command conda activate mxcubeweb | ||
} | ||
|
||
|
||
install_node() { | ||
command conda install nodejs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't |
||
command npm install | ||
command npm install --global pnpm@8 | ||
command pnpm --prefix ui install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're still at the root of the project directory at this point so I'm adding |
||
} | ||
|
||
mxcube_download | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
/node_modules/ | ||
|
||
# testing | ||
/coverage | ||
/cypress/debug | ||
/coverage/ | ||
/cypress/debug/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
/build/ | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
# environment | ||
/.env.local | ||
/.env.*.local |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Enforce Node and pnpm versions as specified in `package.json` | ||
engine-strict=true | ||
|
||
# Save exact dependency versions in `package.json` | ||
save-prefix="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replicated the set-up of other front-end projects, but maybe there's a better way to install it in MXCuBE. 🤷