Skip to content

Commit

Permalink
Massively improve build
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonhs committed Sep 17, 2024
1 parent 303975c commit 432a483
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ pip-selfcheck.json
release
release.tar.gz
**/device_settings.json
.env
.env
1 change: 1 addition & 0 deletions backend_py/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
rm -rf build || true
rm -rf src/__pycache__ || true
rm -rf src/devices/__pycache__ || true
rm -rf src/lights/__pycache__ || true
rm -f device_settings.json || true
3 changes: 3 additions & 0 deletions create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ echo "Successfully packaged system backend"

echo "Packaging frontend"

# Update the version string for packaging
python3 update_versioning.py
cd frontend
# Build the frontend
npm run build

cd ..
Expand Down
8 changes: 8 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ release
*.njsproj
*.sln
*.sw?

version.json

**.js
**.d.ts
**.mjs
**.d.mts
**.tsbuildinfo
10 changes: 0 additions & 10 deletions frontend/build_frontend.sh

This file was deleted.

7 changes: 3 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@deepwaterexploration/dwe-controls",
"version": "2.2.4",
"description": "Web Based UVC Control Driver for the DeepWater Exploration exploreHD and HDCam",
"main": "lib/main.tsx",
"main": "src/main.tsx",
"keywords": [
"linux",
"explorehd",
Expand All @@ -15,7 +15,7 @@
"homepage": "https://github.com/DeepwaterExploration/DWE_OS#readme",
"scripts": {
"dev": "npx vite --host",
"build": "chmod +x ./build_frontend.sh && ./build_frontend.sh",
"build": "npx tsc --build && npx vite build",
"preview": "vite preview --host",
"format": "npx prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"lint": "npx eslint \"src/**/*.{js,jsx,ts,tsx}\" --report-unused-disable-directives --max-warnings 0",
Expand Down Expand Up @@ -77,7 +77,6 @@
"vitest": "^2.0.1"
},
"contributors": [
"Brandon Stevens <brandon@dwe.ai> (https://github.com/brandonhs)",
"Miguel Villa Floran <miguel@dwe.ai> (https://github.com/Kaweees)"
"Brandon Stevens <brandon@dwe.ai> (https://github.com/brandonhs)"
]
}
4 changes: 3 additions & 1 deletion frontend/src/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import NavigationItems from "../utils/getNavigationItems";
import NavigationRoutes from "../utils/getRoutes";
import dweTheme from "../utils/themes";

import { VERSION } from "../../version.json";

const drawerWidth = 240;

const openedMixin = (theme: Theme): CSSObject => ({
Expand Down Expand Up @@ -239,7 +241,7 @@ const NavigationBar = () => {
</Tooltip>
</div>
}
secondary={"Version: 0.1.5"}
secondary={`Version: ${VERSION}`}
/>
<IconButton onClick={toggleDrawer}>
{theme.direction === "rtl" ? (
Expand Down
1 change: 1 addition & 0 deletions frontend/src/layouts/wifi/NetworkDetailsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Card, CardHeader, Typography } from "@mui/material";
import { WifiStatus } from "./types";
import React from "react";

export interface NetworkDetailsCardProps {
ip_address: string;
Expand Down
42 changes: 42 additions & 0 deletions update_versioning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import requests
import json
import re

# Github repo information
GITHUB_API_URL = "https://api.github.com/repos/DeepWaterExploration/DWE_OS_2/tags"
VERSION_FILE_PATH = "frontend/version.json"

def get_latest_tag():
# Fetch the latest tags from GitHub API
response = requests.get(GITHUB_API_URL)

if response.status_code == 200:
tags = response.json()
if tags:
return tags[0]['name'] # The latest tag is the first one
return None

def update_version_json(new_version):
# Load the current version.json file
with open(VERSION_FILE_PATH, 'r') as f:
data = json.load(f)

# Update the version string
data['version'] = new_version

# Write the new version back to the json file
with open(VERSION_FILE_PATH, 'w') as f:
json.dump(data, f, indent=4)

if __name__ == "__main__":
# Get the latest tag from GitHub
latest_tag = get_latest_tag()

if latest_tag:
print(f"Latest tag found: {latest_tag}")

# Update the version.json file
update_version_json(latest_tag)
print("version.json updated successfully.")
else:
print("No tags found or failed to fetch the latest tag.")

0 comments on commit 432a483

Please sign in to comment.