forked from tpd94/CDRM-Project
Enhance build process by adding OS-specific npm command handling, update README with clearer installation instructions and prerequisites
This commit is contained in:
parent
e84f43a702
commit
802fbdebd1
59
README.md
59
README.md
@ -1,34 +1,51 @@
|
|||||||
|
|
||||||
## CDRM-Project
|
# CDRM-Project
|
||||||
|
|
||||||
   
|
   
|
||||||
|
|
||||||
## Prerequisites (from source only)
|
## Prerequisites (from source only)
|
||||||
|
|
||||||
- [Python](https://www.python.org/downloads/) version [3.12](https://www.python.org/downloads/release/python-3120/)+ with PIP and VENV installed
|
- [Python](https://www.python.org/downloads/) version 3.12+ with PIP installed
|
||||||
|
|
||||||
> Python 3.13 was used at the time of writing
|
|
||||||
|
|
||||||
## Installation (Automatic) - Recommended
|
Python 3.13 was used at the time of writing
|
||||||
- Extract contents of CDRM-Project 2.0 git contents into a new folder
|
|
||||||
|
- [Node.js](https://nodejs.org/en/download/) v20+
|
||||||
|
|
||||||
|
## Installation (Automatic) - Recommended
|
||||||
|
|
||||||
|
- Extract contents of CDRM-Project into a new folder
|
||||||
- Open a terminal and change directory into the new folder
|
- Open a terminal and change directory into the new folder
|
||||||
- Run `python main.py`
|
- Run `python build.py && python main.py`
|
||||||
- Follow the on-screen prompts
|
- Follow the on-screen prompts
|
||||||
|
|
||||||
## Installation (From binary)
|
## Installation (From binary)
|
||||||
|
|
||||||
- Download the latest release from the [releases](https://cdm-project.com/tpd94/CDRM-Project/releases) page and run the `.exe`
|
- Download the latest release from the [releases](https://cdm-project.com/tpd94/CDRM-Project/releases) page and run the `.exe`
|
||||||
|
|
||||||
## Installation (Manual)
|
## Installation (Manual)
|
||||||
- Open your terminal and navigate to where you'd like to store the application
|
|
||||||
- Create a new python virtual environment using `python -m venv CDRM-Project`
|
- Open your terminal and navigate to where you'd like to store the application
|
||||||
- Change directory into the new `CDRM-Project` folder
|
- Clone the project with `git clone https://cdm-project.com/tpd94/CDRM-Project.git`
|
||||||
- Activate the virtual environment
|
- Navigate to the `CDRM-Project` folder
|
||||||
|
- Create a new python virtual environment using `python -m venv venv`
|
||||||
|
- Activate the virtual environment
|
||||||
|
|
||||||
|
- Windows:
|
||||||
|
|
||||||
> Windows - change directory into the `Scripts` directory then `activate.bat`
|
```bash
|
||||||
>
|
.\venv\Scripts\activate
|
||||||
> Linux - `source bin/activate`
|
```
|
||||||
|
|
||||||
|
- Linux:
|
||||||
|
|
||||||
- Extract CDRM-Project 2.0 git contents into the newly created `CDRM-Project` folder
|
```bash
|
||||||
- Install python dependencies `pip install -r requirements.txt`
|
source venv/bin/activate
|
||||||
- (Optional) Create the folder structure `/configs/CDMs/WV` and place your .WVD file into `/configs/CDMs/WV`
|
```
|
||||||
- (Optional) Create the folder structure `/config/CDMs/PR` and place your .PRD file into `/configs/CDMs/PR`
|
|
||||||
- Run the application with `python main.py`
|
Verify that the virtual environment is activated by seeing the `(venv)` prefix in your terminal
|
||||||
|
|
||||||
|
- Install python dependencies `pip install -r requirements.txt`
|
||||||
|
- (Optional) Create the folder structure `/configs/CDMs/WV` and place your .WVD file into `/configs/CDMs/WV`
|
||||||
|
- (Optional) Create the folder structure `/config/CDMs/PR` and place your .PRD file into `/configs/CDMs/PR`
|
||||||
|
- Build the frontend with `python build.py`
|
||||||
|
- And finally, run the application with `python main.py`
|
||||||
|
19
build.py
19
build.py
@ -3,18 +3,29 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def get_npm_command():
|
||||||
|
"""Get the appropriate npm command for the current OS."""
|
||||||
|
if sys.platform == "win32":
|
||||||
|
return "npm.cmd"
|
||||||
|
return "npm"
|
||||||
|
|
||||||
|
|
||||||
def build_frontend():
|
def build_frontend():
|
||||||
"""Build the frontend."""
|
"""Build the frontend."""
|
||||||
frontend_dir = "cdrm-frontend"
|
frontend_dir = "cdrm-frontend"
|
||||||
|
npm_cmd = get_npm_command()
|
||||||
|
|
||||||
# Check and run npm commands if needed
|
# Check and install dependencies if node_modules doesn't exist
|
||||||
if not os.path.exists(f"{frontend_dir}/node_modules"):
|
if not os.path.exists(f"{frontend_dir}/node_modules"):
|
||||||
subprocess.run(["npm", "install"], cwd=frontend_dir, check=False)
|
print("📦 Installing dependencies...")
|
||||||
|
subprocess.run([npm_cmd, "install"], cwd=frontend_dir, check=True)
|
||||||
|
|
||||||
if not os.path.exists(f"{frontend_dir}/dist"):
|
# Always build the frontend to ensure it's up to date
|
||||||
subprocess.run(["npm", "run", "build"], cwd=frontend_dir, check=False)
|
print("🔨 Building frontend...")
|
||||||
|
subprocess.run([npm_cmd, "run", "build"], cwd=frontend_dir, check=True)
|
||||||
|
|
||||||
# Move dist to frontend-dist
|
# Move dist to frontend-dist
|
||||||
if os.path.exists("frontend-dist"):
|
if os.path.exists("frontend-dist"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user