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
41
README.md
41
README.md
@ -1,34 +1,51 @@
|
||||
|
||||
## CDRM-Project
|
||||
# CDRM-Project
|
||||
|
||||
   
|
||||
|
||||
## 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
|
||||
Python 3.13 was used at the time of writing
|
||||
|
||||
- [Node.js](https://nodejs.org/en/download/) v20+
|
||||
|
||||
## Installation (Automatic) - Recommended
|
||||
- Extract contents of CDRM-Project 2.0 git contents into a new folder
|
||||
|
||||
- Extract contents of CDRM-Project into a 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
|
||||
|
||||
## Installation (From binary)
|
||||
|
||||
- Download the latest release from the [releases](https://cdm-project.com/tpd94/CDRM-Project/releases) page and run the `.exe`
|
||||
|
||||
## 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`
|
||||
- Change directory into the new `CDRM-Project` folder
|
||||
- Clone the project with `git clone https://cdm-project.com/tpd94/CDRM-Project.git`
|
||||
- Navigate to the `CDRM-Project` folder
|
||||
- Create a new python virtual environment using `python -m venv venv`
|
||||
- Activate the virtual environment
|
||||
|
||||
> Windows - change directory into the `Scripts` directory then `activate.bat`
|
||||
>
|
||||
> Linux - `source bin/activate`
|
||||
- Windows:
|
||||
|
||||
```bash
|
||||
.\venv\Scripts\activate
|
||||
```
|
||||
|
||||
- Linux:
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
Verify that the virtual environment is activated by seeing the `(venv)` prefix in your terminal
|
||||
|
||||
- Extract CDRM-Project 2.0 git contents into the newly created `CDRM-Project` folder
|
||||
- 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`
|
||||
- Run the application with `python main.py`
|
||||
- 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 subprocess
|
||||
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():
|
||||
"""Build the 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"):
|
||||
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"):
|
||||
subprocess.run(["npm", "run", "build"], cwd=frontend_dir, check=False)
|
||||
# Always build the frontend to ensure it's up to date
|
||||
print("🔨 Building frontend...")
|
||||
subprocess.run([npm_cmd, "run", "build"], cwd=frontend_dir, check=True)
|
||||
|
||||
# Move dist to frontend-dist
|
||||
if os.path.exists("frontend-dist"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user