Skip to content

Demo application for weather forecasts. With Angular, ChartJS, Angular Material, animations.

Notifications You must be signed in to change notification settings

syrenly/weather-forecast

Repository files navigation

WeatherForecast

👋 Hi, I’m @syrenly and welcome to weather-forecast repo! It's a Demo application for weather forecasts and it was generated with Angular CLI, maintained to version 18.

Implementations

  • Angular 18 and standalone components only;
  • folders organized mainly in a "folder-by-type" way;
  • a router exposes 2 main components: HomeComponent and ForecastComponent; guard, resolver and animations implemented;
  • the folder ui-components contains the less architectural components, designed to show or search data;
  • theme.scss hosts the 2 themes (light and dark), that can be switched using the SwitchThemeComponent from ui-components; the component is always available on the upper right corner of the view;
  • HomeComponent is an entry point where search cities;
  • ForecastComponent is the core of the application, where data are displayed using charts, tabs and list;
  • Switch for themes and the license key are managed with injection tokens;

Main external dependencies

  • Angular Material for theme and UI Kit;
  • ChartJS for charts;

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test to execute the unit tests via Karma.

Last code coverage

Run npm run test:coverage to get stats about the code coverage. Current:

=============================== Coverage summary ===============================
Statements   : 95.36% ( 288/302 )
Branches     : 82.5% ( 66/80 )
Functions    : 89.88% ( 80/89 )
Lines        : 96.5% ( 276/286 )
================================================================================

Lint

Run ng lint to run the Angular lint.

Run npm run eslint to run the ES lint.

Run npm run eslint:fix to run the ES lint and apply fixes.

Docker

Install docker in your machine. From the root folder of this application, run

docker build . -t weather-forecast and docker run -p 4200:80 weather-forecast.

Navigate to http://localhost:4200/.

With this mode, the application will be built in production. Remember to update the license key for the OpenWeather API here with a full working one.

Attributions

The project depends on Open Weather Map, which provides an API with free license. The license is limited to small number of requests and few methods.

To change the license key, replace it here for development or here for production.

TODO List

Explore the TODO List to know what's next.

Branches

  • ng-17: implementation with Angular 17;
  • assignment-04-2024: the first implementation of the application. Updates are not planned.