@kevin_jivani/agriculture-portal
v1.0.1
Published
Agriculture Portal for precision farming and crop monitoring
Downloads
11
Readme
Agriculture Portal
Project Description
The Agriculture Portal is a TypeScript project designed to monitor and manage crop health, irrigation systems, and other aspects of precision farming using IoT-driven sensors and automation. It consists of several modules, including Sensor Management, Crop Monitoring, and Precision Irrigation, with test cases provided for each module.
Prerequisites
Make sure you have the following installed:
- Node.js: Download and install Node.js.
- TypeScript: Install TypeScript globally using npm:
npm install -g typescript
Project Setup
- Clone the Repository First, clone the repository to your local machine:
git clone https://github.com/kevinjivani/agriculture-portal.gitcd agriculture-portal- Install Dependencies If the project has any external dependencies (listed in package.json), install them:
npm install- Initialize TypeScript Configuration If there's no tsconfig.json file, create it by running the following command:
tsc --initThis will generate a basic tsconfig.json file for TypeScript compilation settings.
Compiling TypeScript Files
To compile the TypeScript files into JavaScript, run the following command:
tscThis will generate JavaScript files from your TypeScript source files into a specified directory (e.g., dist/).
Running the Application
After compiling the TypeScript files, you can run the JavaScript output using Node.js:
node main.jsAlternatively, you can run the TypeScript files directly using ts-node without having to compile:
ts-node src/main.tsRunning Test Cases The project includes test cases for each module, located in the tests/ directory. Compile the tests:
tscRun the test cases: After compiling, run the test cases for individual modules:
node tests/sensor.test.js
node tests/cropMonitor.test.js
node tests/precisionIrrigation.test.jsOr, if using ts-node, directly run the TypeScript test files:
ts-node tests/sensor.test.ts
ts-node tests/cropMonitor.test.ts
ts-node tests/precisionIrrigation.test.tsExpected Output
Sensor Moisture: 50
Crop health is good!
Irrigation ON: Soil moisture is low.To run all the tests:
npm testGitHub CLI Setup
To use GitHub CLI, after installation, run the following command to authenticate with your GitHub account:
gh auth loginGitHub Actions Setup
Create the Workflow Directory: In your repository, create a .github/workflows directory in the root of your project.
Create a Workflow File: Inside the .github/workflows directory, create a workflow YAML file
git add .github/workflows/ci.yml
git commit -m "Add GitHub Actions workflow for CI"
git push origin mainI have three yml files:
1). ci.yml 2). newci.yml 3). test.yml
Screenshots of Workflow Logs and Console Output
License
This project is licensed under the MIT License. See the LICENSE file for details.
