- ๐ Table of Contents
- ๐ Overview
- โ๏ธ Features
- ๐ Project Structure
- ๐งฉ Modules
- ๐ Getting Started
- Uninstall
- ๐ค Contributing
- ๐ License
cliMate is a command-line weather application that provides current weather and forecast information based on a given city. It retrieves data from external APIs and displays it beautifully in the console. Additionally, the project includes a feature to generate ASCII art icons from PNG images and store them in a JSON file. The value proposition lies in the convenience and visually appealing presentation of weather data and the ability to enhance the user experience with custom icons.
Feature | Description |
---|---|
โ๏ธ Architecture | The codebase follows a modular architecture where the functionality is divided into several files or components. It has separate modules for installing dependencies, retrieving weather data, generating icons, and running an API server. The command-line weather application is separated into different modules for retrieving weather and forecasting data. Overall, the codebase exhibits a structured design using Node.js and various dependencies. |
๐ Documentation | The codebase contains comprehensive documentation in the form of comments and inline explanations. Each file has a brief summary of its functionality, clarifying its purpose and key considerations. |
๐ Dependencies | The project relies on external libraries such as Axios, Moment, Express, and Chalk. Axios is used for making HTTP requests to weather APIs, and Moment is used for working with timestamps and time-related calculations. Express is used to create the API server for handling weather and forecast requests. Chalk is used for styling the console output with colors. These dependencies enhance the functionality and efficiency of the project. |
๐งฉ Modularity | The codebase demonstrates a good level of modularity by separating concerns into different files/modules. Each file represents a specific aspect or feature of the weather application, such as retrieving weather data, getting forecasts, or generating icons. This modular design allows parts of the system to be easily modified or replaced without affecting the entire codebase, making it easier to maintain and extend. |
โก๏ธ Performance | The performance of the system depends on external APIs and data retrieval. The codebase efficiently handles HTTP requests using Axios and condenses the essential data for weather and forecasts. However, a detailed analysis of performance optimizations, data caching, and network route handling would be required to make further conclusions about performance-related aspects. |
๐ Security | The codebase does not reveal any specific security concerns. However, it is necessary to ensure that relevant security practices are implemented, such as proper data validation and handling, secure key storage, and protection against malicious input or attacks. Depending on the specific deployment environment, additional security measures may be required, such as encryption or API rate limiting. |
๐ Version Control | The codebase adopts Git as the version control system, using Github for hosting and collaboration. The repository demonstrates good practices by including meaningful commit messages, commit history, and code reviews through PRs (Pull Requests). These practices facilitate collaboration, code maintenance, and enable rollbacks or feature-based deployments, ensuring the integrity of the project's version history. |
๐ Integrations | The project integrates with external APIs, such as OpenWeatherMap, to retrieve the desired weather and forecast data. It utilizes the |
repo
โโโ api
โย ย โโโ server.js
โโโ bin
โย ย โโโ climate.js
โโโ icons
โย ย โโโ generator.js
โย ย โโโ icons.json
โย ย โโโ images
โย ย โโโ ....png
โโโ installer.sh
โโโ lib
โย ย โโโ getForecast.js
โย ย โโโ getWeather.js
โโโ package-lock.json
โโโ package.json
โโโ vercel.json
6 directories, 28 files
Root
File | Summary |
---|---|
installer.sh | This code snippet installs Node.js and npm using nvm (Node Version Manager), with the ability to specify a specific version. It also installs the cliMate package globally. |
Bin
File | Summary |
---|---|
climate.js | This code snippet is a command-line weather application. It retrieves the current weather and a weather forecast for a given city using external APIs. It displays the data beautifully in the console using colors and tables. The user can provide the city as a command-line argument or input it when prompted. |
Icons
File | Summary |
---|---|
generator.js | This code block: |
- Disables specific linting rules for console, imports, and file dependencies
- Requires the fs, path, and asciify-image modules3. Defines options for rendering icons4. Sets the filename for the JSON file5. Creates an asynchronous function-Initializes an empty icons object-Writes the initial JSON file-Reads and processes PNG files from the "images" directory-Converts each image into ASCII art and adds it to the icons object-Writes the updated JSON fileIn summary, the code generates ASCII art icons from PNG images and stores them in a JSON file. |
Lib
File | Summary |
---|---|
getWeather.js | This code snippet retrieves weather data for a city using Axios and Moment libraries. It makes an HTTP GET request to a weather API and transforms the response data into a structured format containing various weather information such as temperature, humidity, wind speed, precipitation, sunrise/sunset times, etc. |
getForecast.js | This code snippet is a function called "getForecast" which retrieves weather forecast data for a given city. It makes an HTTP GET request to an API endpoint, processes the response data, and returns a formatted forecast object. It uses external libraries such as axios, chalk, and moment for making the HTTP request, formatting the output, and manipulating timestamps. The function handles potential errors and rejects the promise with an appropriate error message. |
Api
File | Summary |
---|---|
server.js | This code snippet creates an Express server that provides two API endpoints: one for retrieving current weather information based on a city name, and the other for retrieving forecast information. The server makes requests to the OpenWeatherMap API using the provided API key, and returns the responses as JSON to the client. The server runs on a specified port, defaulting to 3000 if not provided. |
You need NodeJs 14 or later to run this tool.
npm install climatey -g
npm remove climatey -g
$ climate
โ City Name or Zip Code: ยท New York
11ttffffLLfffftt11
Weather : clear sky ttffLLLLLLLLLLLLLLLLLLfftt
Temperature : 21.55ยฐC 11ffLLLLLLLLLLLLLLLLLLLLLLLLLLff11
Humidity : 74% 11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
Visibility : 10000m 11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
Pressure : 1018 hPa ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff
Wind Speed : 3.6 m/s ttLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLtt
Wind Direction : 250deg ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff
Wind Gust : n\a 11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
Cloudiness : No ttLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLtt
Precipitation : No ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff
Rain : No LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
Snow : No LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
Sunrise : 2:12:08 PM LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
Sunset : 3:46:41 AM ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff
TimeZone : -14400 ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff
City : New York ttLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLtt
Latitude : 40.7143 11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
Longitude : -74.006 ttLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLtt
Time : Monday, 21st August 2023, 2:47:30 PM 11ffLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLff11
11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
11LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL11
11ffLLLLLLLLLLLLLLLLLLLLLLLLLLff11
11ttLLLLLLLLLLLLLLLLLLLLLLtt11
11ttffffLLLLLLfffftt11
Weather Forecast ๐ฎ:
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโฌโโโโโโโ
โ Time โ Temperature โ Weather โ Humidity โ Visibility โ Wind โ Cloud โ Rain โ snow โ
โโโโโโโโโโโโโโฌโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Morning โ 24.04ยฐC โ overcast clouds โ 59% โ 10000m โ 5.68m/s โ 100% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Noon โ 19.84ยฐC โ overcast clouds โ 53% โ 10000m โ 6.41m/s โ 100% โ No โ no โ
โ Tue 22 Aug โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Evening โ 23.26ยฐC โ scattered clouds โ 43% โ 10000m โ 5.52m/s โ 46% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Night โ 26.20ยฐC โ broken clouds โ 35% โ 10000m โ 3.78m/s โ 66% โ No โ no โ
โโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Morning โ 23.19ยฐC โ overcast clouds โ 44% โ 10000m โ 1.63m/s โ 94% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Noon โ 19.91ยฐC โ few clouds โ 49% โ 10000m โ 4.24m/s โ 11% โ No โ no โ
โ Wed 23 Aug โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Evening โ 23.56ยฐC โ clear sky โ 34% โ 10000m โ 3.02m/s โ 3% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Night โ 26.18ยฐC โ clear sky โ 29% โ 10000m โ 2.11m/s โ 2% โ No โ no โ
โโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Morning โ 21.84ยฐC โ few clouds โ 50% โ 10000m โ 3.47m/s โ 15% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Noon โ 19.98ยฐC โ few clouds โ 56% โ 10000m โ 1.65m/s โ 12% โ No โ no โ
โ Thu 24 Aug โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Evening โ 21.66ยฐC โ overcast clouds โ 56% โ 10000m โ 3.32m/s โ 100% โ No โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Night โ 23.19ยฐC โ overcast clouds โ 52% โ 10000m โ 5.95m/s โ 99% โ No โ no โ
โโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Morning โ 21.58ยฐC โ light rain โ 68% โ 10000m โ 6.94m/s โ 99% โ 0.85mm โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Noon โ 20.45ยฐC โ moderate rain โ 87% โ 10000m โ 7.46m/s โ 100% โ 6.81mm โ no โ
โ Fri 25 Aug โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Evening โ 23.03ยฐC โ light rain โ 82% โ 10000m โ 5.07m/s โ 100% โ 1.69mm โ no โ
โ โโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโผโโโโโโโโโผโโโโโโโค
โ โ Night โ 25.12ยฐC โ light rain โ 73% โ 10000m โ 3.27m/s โ 100% โ 0.28mm โ no โ
โโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโดโโโโโโโโโดโโโโโโโ
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.
This project is licensed under the โน๏ธ GNU
License. See the LICENSE file for additional info.