diff --git a/frontend/.nvmrc b/frontend/.nvmrc new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/frontend/.nvmrc @@ -0,0 +1 @@ +1 diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..0e8001e --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,68 @@ +# Frontend for Embedded Weather Sensor + +This frontend application is part of the embedded weather sensor project. It provides a web interface to interact with the weather data collected by the device. The current version of this frontend is outdated and requires modernization to be compatible with the latest Node.js and browser features. + +# Project Overview + +* __Current Status:__ The frontend is outdated and needs updates to function with modern Node.js versions and browser features. +* __Development Workflow:__ A sandbox server is used to simulate the device running the frontend, allowing for testing and development in a controlled environment. +* __Deployment:__ Once compiled, the frontend is included in the device's filesystem, which is uploaded during the firmware deployment process. + +# Getting Started + +## Prerequisites + +* __Node.js:__ Use Node.js version 14.x, as specified in the package.json. Ensure you have Node Version Manager (nvm) installed to manage Node.js versions easily. +* __npm:__ Ensure npm is installed (comes bundled with Node.js). +* __Python 2.7:__ Required for some dependencies during the build process. + +## Installation + +1. Clone the Repository: +```bash +git clone +cd /frontend +``` + +2. Set Node.js Version: + +Use the correct Node.js version: + +```bash +nvm use 14 +``` + +3. Install Dependencies: + +Install all required npm packages: + +```bash +npm install +``` + +4. Running the Sandbox Server + +To simulate the device environment, start the sandbox server: + +```bash +npm run sandbox +``` + +This will launch a local server simulating the device, allowing you to develop and test the frontend in an environment that mimics the actual hardware. +Building the Frontend + +5. To compile the frontend and prepare it for deployment: + +```bash +npm run build +``` + +This command will generate the necessary files to be included in the device's filesystem. + +# Modernization Goals + + Upgrade Dependencies: Update outdated npm packages to their latest stable versions. + Migrate to Modern JavaScript: Refactor code to use modern JavaScript (ES6+) features where applicable. + Optimize for Performance: Enhance the performance of the frontend to ensure smooth operation on limited device hardware. + Improve Compatibility: Ensure the frontend is compatible with the latest versions of popular browsers. + diff --git a/frontend/package.json b/frontend/package.json index 4c99dc8..65499bf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,9 @@ }, "author": "", "license": "ISC", + "engines": { + "node": "14.x" + }, "devDependencies": { "@babel/core": "^7.10.4", "@babel/plugin-transform-react-jsx": "^7.10.4",