Skip to content

AlexeyPopovUA/check-weather-cli

Repository files navigation

check-weather-cli

Idea

Create a CLI app to display the weather for a place (temp, humidity, weather description).

  • Query city by a zip code or a city name
  • Return temperatures in C or F
  • Store the latest config and provide a flag to use it
  • The app can import a file to get the weather in max 10 cities. (Do not save configs for this use-case)

Installation

Pre-requisites:

  • install the latest LTS nodejs 16. (Use NVM manager or any other for convenience)
  • install all dependencies npm i
  • run single build npm run build
  • add .env file with API keys to the env/ directory. See env/.env.example

Build

npm run build # run the single build
npm run watch # run the build in the watch mode

Install, build, run tests demo:

install-build-test

Run

# cli commands with prompt
node . # cli with prompt
node . -g # cli with prompt without automatic geo location

# cli commands without prompt
node . -t F -z 75015,fr # get weather with temperature in F for the 75015,fr <zip code,country code>combination
node . -t F -c Amsterdam # get weather with temperature in F for the Amsterdam city
node . -c Amsterdam # get weather for the Amsterdam city
node . -l # run latest configuration (except imported file case) ~/.check-weather-cli/latest.json
node . --import ./examples/imp-example.json # import multiple configurations from the json file

Installation as a global cli tool and prompt scenarios demo:

global-help-version-prompt

Importing from file demo:

import

Basic error handling demo:

error

Pure basic cli demo:

pure basic cli

Selection of city OR zip demo:

city or zip

Run as a global cli tool (Optional)

npm i -g .
check-weather-cli -t C -c Paris,fr

Test

npm run test # unit and integration tests
npm run test:coverage # unit and integration tests with coverage reports

Linting

Run ESLint with rules copied from eslint-config-proton

npm run lint 

Extra

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published