diff --git a/README.md b/README.md index 8388f4e..8c224fb 100644 --- a/README.md +++ b/README.md @@ -1,163 +1,181 @@ -`#node.js` `#master-in-software-engineering` - + +
+

+ + Logo + + +

Command Line Application with Node.js

+ +

+ This project help us to understand nodeJs. +
+ Explore the docs » +
+
+ View Demo + · + Report Bug + · + Request Feature +

+

+ + + + +
+ Table of Contents +
    +
  1. + About The Project + +
  2. +
  3. + Getting Started + +
  4. +
  5. Usage
  6. +
  7. Roadmap
  8. +
  9. Contributing
  10. +
  11. License
  12. +
  13. Contact
  14. +
  15. Acknowledgements
  16. +
+
+ + + + +## About The Project + + +We will be building a CLI(command line) app that takes user input, which will be a page (or some other parameters), using a flag argument and uses this argument to make a http request to a REST API, the api we will be using is provided by [www.themoviedb.org](https://www.themoviedb.org) . The api provides information on a movie/person as requested using a parameter. We would consume this API to get the population of a country. + +To parse CL arguments we will use `Commander`, a node package. To make http requests we will use `Http` Node Module . + +Here's why: +* Learn more about the asyncronous workflow of Node.js +* Interact easily with 3rth APi's. +* Learn how to manipulate Tokens. + +### Built With + +This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples. -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) - - - -# Assembler School: Node.js MovieDB CLI App - -In this project you will learn how to create a cli app with Node.js. - -## Table of Contents - -- [Getting Started](#getting-started) -- [The Project](#the-project) -- [Project requirements](#project-requirements) -- [Project delivery](#project-delivery) -- [Resources](#resources) +- `Node.js` +- `Commander.Js` +- `Dotenv` +- `node-notifier` +- `ora` spinners +- `prettier` + ## Getting Started -These instructions will get you a copy of the project up and running on your -local machine for development and testing purposes. - -See deployment for notes on how to deploy the project on a live system. - -### The repository - -First, you will need to `clone` or `fork` the repository into your Github -account: - -Fork on GitHub - -``` -$ git clone https://github.com/assembler-school/node-moviedb-cli.git -``` - -## Contents and Branches Naming Strategy - -The repository is made up of several branches that include the contents of each -section. - -The branches follow a naming strategy like the following: +First of all you need to have installed node and git into your PC. -- `main`: includes the main contents and the instructions -- `assembler-solution`: includes the solution +### Prerequisites -### Fetching All the Branches +This is an example of how to list things you need to use the software and how to install them. -In order to fetch all the remote branches in the repository, you can use the -following command: +* npm + ```sh + npm install npm@latest -g + ``` -```sh -$ git fetch --all -``` +### Installation -### List Both Remote Tracking Branches and Local Branches +1. Get a free API Key at [https://www.themoviedb.org/](https://www.themoviedb.org/) +2. Clone the repo + ```sh + git clone https://github.com/bbenalia/node-moviedb-cli + ``` +3. Install NPM packages + ```sh + npm install + ``` +4. Enter your API in `.env` + ```JS + const API_KEY = 'ENTER YOUR API'; + ``` -```sh -$ git branch --all -``` + +## Usage -Then, you can create a local branch based on a remote branch with the following -command: +- `./moviedb.js command... ---options... --flags...` +- `./moviedb.js get-persons --page 1 --popular` +- `./moviedb.js get-persons --page 2 --popular` -```sh -$ git checkout -b -``` +- `./moviedb.js get-person --id XXXXXXXX` +- `./moviedb.js get-person --id 990393` -### Installing - -First, you will need to install the dependencies with: `npm install`. - -Run the following command in your terminal after cloning the main repo: - -```sh -$ npm install -``` - -### Running the Tests - -The tests that validate your solution can be executed by runing the following -command: - -``` -$ npm run test -``` - -### Git `precommit` and `prepush` Hooks - -In the `assembler-solution` branch you can see an implementation of these tools -if you'd like to use them. - -## Deployment - -In this pill we won't deploy the app. - -## Technologies used - -- `Node.js` -- `eslint` -- `prettier` -- `lint-staged` -- `husky` +- `./moviedb.js get-movies --popular --page 2` +- `./moviedb.js get-movies --now-playing --page 2` -## The Project +- `./moviedb.js get-movie --id movieId` +- `./moviedb.js get-movie --id 694919` -In this project you will build a cli app similar to the following screenshot. +If you want to save your data request use: - +`--save` +`--local` -## Project requirements -This is an overview of the main requirements of this project. The exact ones are -found in the doc that the academic team will provide you. +_For more examples, please refer to the [Documentation](https://example.com)_ -- You must follow all the instructions of the project step-by-step -- You should always try to solve them by yourself before asking for help -- You should always help your team members and fellow students of the master so - that you can all learn together and become better software developers and team - members -- You must finish all the steps that are marked as `Required` -- Once you are done, you can move on to the optional ones that are marked as - `Extra 💯` -## Project delivery + +## Roadmap -To deliver this project you must follow the steps indicated in the document: +See the [open issues](https://github.com/assembler-school/node-moviedb-cli/issues) for a list of proposed features (and known issues). -- [Submitting a solution](https://www.notion.so/Submitting-a-solution-524dab1a71dd4b96903f26385e24cdb6) + +## Contributing -## Resources +Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. -- See the document we provide +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request -## License + +## License -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file -for details +Distributed under the MIT License. See `LICENSE` for more information. -## Contributors ✨ + +## Team Contact -Thanks goes to these wonderful people -([emoji key](https://allcontributors.org/docs/en/emoji-key)): +Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - + +

Dani Lucaci

💻 📖 💡 🔧

haykbit

💻

imalovelyghost

💻
- - +Project Link: [https://github.com/your_username/repo_name](https://github.com/your_username/repo_name) - -This project follows the -[all-contributors](https://github.com/all-contributors/all-contributors) -specification. Contributions of any kind welcome! + + +[contributors-shield]: https://github.com/bbenalia/node-moviedb-cli +[contributors-url]: https://github.com/othneildrew/Best-README-Template/graphs/contributors +[forks-shield]: https://github.com/assembler-school/node-moviedb-cli +[forks-url]: https://github.com/othneildrew/Best-README-Template/network/members +[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=for-the-badge +[linkedin-shield]: https://www.linkedin.com/feed/ +[product-screenshot]: /src/img/project.png diff --git a/package-lock.json b/package-lock.json index fcf3619..218d380 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,79 +1,620 @@ { "name": "node-moviedb-cli", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, - "dependencies": { - "chalk": { + "packages": { + "": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "commander": "^6.1.0", + "dotenv": "^8.2.0", + "node-notifier": "^8.0.0", + "ora": "^5.1.0" + }, + "bin": { + "moviedb": "src/moviedb.js" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bl": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "requires": { + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dependencies": { - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", + "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dependencies": { + "clone": "^1.0.2" + } + }, + "node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } + { + "type": "patreon", + "url": "https://www.patreon.com/feross" }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/node-notifier": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.2.tgz", + "integrity": "sha512-oJP/9NAdd9+x2Q+rfphB2RJCHjod70RcRLjosiPMMu5gjIfwVnOUGq2nbTjTUbmy0DJ/tFIVT30+Qe3nzl4TJg==", + "dependencies": { + "growly": "^1.3.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.2", + "shellwords": "^0.1.1", + "uuid": "^8.3.0", + "which": "^2.0.2" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + { + "type": "patreon", + "url": "https://www.patreon.com/feross" }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "requires": { - "has-flag": "^4.0.0" - } + { + "type": "consulting", + "url": "https://feross.org/support" } + ] + }, + "node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", + "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==" + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "commander": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", - "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "requires": { + "clone": "^1.0.2" + } }, "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==" }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, "is-docker": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", - "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==" + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" }, "is-wsl": { "version": "2.2.0", @@ -88,10 +629,32 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, "node-notifier": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.0.tgz", - "integrity": "sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.2.tgz", + "integrity": "sha512-oJP/9NAdd9+x2Q+rfphB2RJCHjod70RcRLjosiPMMu5gjIfwVnOUGq2nbTjTUbmy0DJ/tFIVT30+Qe3nzl4TJg==", "requires": { "growly": "^1.3.0", "is-wsl": "^2.2.0", @@ -101,178 +664,113 @@ "which": "^2.0.2" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, "ora": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-5.1.0.tgz", - "integrity": "sha512-9tXIMPvjZ7hPTbk8DFq1f7Kow/HU/pQYB60JbNq+QnGwcyhWVZaQ4hM9zQDEsPxw/muLpgiHSaumUZxCAmod/w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "requires": { + "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", - "cli-spinners": "^2.4.0", + "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", - "log-symbols": "^4.0.0", - "mute-stream": "0.0.8", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" - }, - "dependencies": { - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" - }, - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-spinners": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.4.0.tgz", - "integrity": "sha512-sJAofoarcm76ZGpuooaO0eDy8saEy+YoZBLjC4h8srt4jeBnkYeOgqxgsJQTpyt2LjI5PTfLJHSL+41Yu4fEJA==" - }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "requires": { - "clone": "^1.0.2" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, - "is-interactive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" - }, - "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", - "requires": { - "chalk": "^4.0.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "requires": { - "has-flag": "^4.0.0" - } - }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "requires": { - "defaults": "^1.0.3" - } - } } }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } }, "shellwords": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, "uuid": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", - "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "requires": { + "defaults": "^1.0.3" + } }, "which": { "version": "2.0.2", @@ -281,6 +779,11 @@ "requires": { "isexe": "^2.0.0" } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/package.json b/package.json index f20c9c6..64c9103 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,9 @@ "url": "https://github.com/assembler-school/node-moviedb-cli.git" }, "scripts": {}, + "bin": { + "moviedb.js": "./src/moviedb.js" + }, "dependencies": { "chalk": "^4.1.0", "commander": "^6.1.0", diff --git a/src/img/nodejs.png b/src/img/nodejs.png new file mode 100644 index 0000000..2651e1c Binary files /dev/null and b/src/img/nodejs.png differ diff --git a/src/moviedb.js b/src/moviedb.js index dd5591a..b0a9769 100755 --- a/src/moviedb.js +++ b/src/moviedb.js @@ -1,38 +1,66 @@ #!/usr/bin/env node +/** @format */ const { Command } = require("commander"); +const get = require("./utils/getMethods.js"); +const dotenv = require("dotenv").config(); + const program = new Command(); program.version("0.0.1"); program .command("get-persons") .description("Make a network request to fetch most popular persons") - .action(function handleAction() { - console.log("hello-world"); + .requiredOption("--page ", "The page of data results to fetch") + .requiredOption("-p, --popular", "Fetch the popular persons") + .option("-s, --save", "The page of data to JSON file") + .option("-l, --local", "Read data from local JSON") + .action(function handleAction(opt) { + if (!opt.local) get.PersonsByPage(opt); + + if (opt.local) { + if (opt.save) { + get.PersonsByPage(opt, (page) => get.JsonPersonByPage(page)); + return; + } + + get.JsonPersonByPage(opt.page); + } }); program .command("get-person") .description("Make a network request to fetch the data of a single person") - .action(function handleAction() { - console.log("hello-world"); + .requiredOption("-i, --id ", "The id of the person") + .action(function handleAction(option) { + get.PersonById(option.id); }); program .command("get-movies") .description("Make a network request to fetch movies") - .action(function handleAction() { - console.log("hello-world"); + .requiredOption("--page ", "The page of movies data results to fetch") + .option("-p, --popular", "Fetch the popular movies") + .option("-n, --now-playing", "Fetch the movies that are playing now") + .option("-s, --save", "The page of data to JSON file") + .option("-l, --local", "Read data from local JSON") + .action(function handleAction(opt) { + if (!opt.local) get.MoviesByPage(opt.page, opt.nowPlaying, opt.save); + if (opt.local) { + if (opt.save) get.MoviesByPage(opt.page, opt.nowPlaying, opt.save); + get.JsonMoviesByPage(opt.page, opt.nowPlaying); + } }); program .command("get-movie") .description("Make a network request to fetch the data of a single person") - .action(function handleAction() { - console.log("hello-world"); + .requiredOption("-i,--id ", "The id of the movie") + .option("-r, --reviews", "Fetch the reviews of the movie") + .action(function handleAction(opt) { + get.SingleMovie(opt.id, opt.reviews); }); // error on unknown commands - program.parse(process.argv); diff --git a/src/utils/chalks.js b/src/utils/chalks.js new file mode 100644 index 0000000..ef2ad13 --- /dev/null +++ b/src/utils/chalks.js @@ -0,0 +1,93 @@ +const Person = require("./entities/Person.js"); +const Movie = require("./entities/Movie.js"); +const Review = require("./entities/Review.js"); + +/** + * Render People in command line + * @param page : Response object of type person + * @param spinner : a Spinner to render + */ +function chalkPeople(page, spinner) { + try { + setTimeout(() => { + page.results.forEach((person, index, array) => { + const chalkPerson = new Person(person); + chalkPerson.renderPopular(); + + if (index == array.length - 1) + chalkPerson.renderPages(page.page, page.total_pages); + }); + + spinner.succeed("Popular Persons data loaded\n"); + }, 1000); + } catch (error) { + spinner.fail(error.message); + } +} + +function chalkPersonId(person, spinner) { + try { + setTimeout(() => { + const chalkPerson = new Person(person); + chalkPerson.renderPersonById(); + + spinner.succeed("Person data loaded\n"); + }, 1000); + } catch (error) { + spinner.fail(error.message); + } +} + +/** + * Render Movie in command line + * @param page : Response object of type movie + * @param spinner : a Spinner to render + */ +function chalkMovie(page, spinner, nowPlaying) { + try { + setTimeout(() => { + page.results.forEach((movie, index, array) => { + const chalkMovie = new Movie(movie); + chalkMovie.renderPopular(); + + if (index == array.length - 1) + chalkMovie.renderPages(page.page, page.total_pages); + }); + + if (nowPlaying) spinner.succeed("Movies playing now data loaded\n"); + else { + spinner.succeed("Popular Movies data loaded\n"); + } + }, 1000); + } catch (error) { + spinner.fail(error.message); + } +} + +/** + * Render Movie in command line + * @param movie : Response object of type movie or reviews + * @param spinner : a Spinner to render + * @param reviews : reviews of the movie + */ +function chalkSingleMovie(body, spinner, reviews) { + try { + setTimeout(() => { + if (reviews) { + const chalkReviews = new Review(body); + chalkReviews.renderMovieReviews(); + + spinner.succeed("Movie reviews data loaded\n"); + } else { + const chalkMovie = new Movie(body); + chalkMovie.renderSingleMovie(); + + spinner.succeed("Movie data loaded\n"); + } + }, 1000); + } catch (error) { + spinner.fail(error.message); + } +} + +module.exports = { chalkPeople, chalkMovie, chalkPersonId, chalkSingleMovie }; diff --git a/src/utils/entities/Movie.js b/src/utils/entities/Movie.js new file mode 100644 index 0000000..0ee203f --- /dev/null +++ b/src/utils/entities/Movie.js @@ -0,0 +1,74 @@ +const chalk = require("chalk"); +const log = console.log; + +class Movie { + constructor(movie) { + this.id = movie.id; + this.title = movie.title; + this.release_date = movie.release_date; + this.release_date = movie.release_date; + this.runtime = movie.runtime; + this.vote_count = movie.vote_count; + this.overview = movie.overview; + this.genres = movie.genres; + this.spoken_languages = movie.spoken_languages; + } + + renderPopular() { + log("\n"); + log("Movie: \n"); + log(`ID: ${chalk.white(this.id)}`); + log(`Title: ${chalk.blue.bold(this.title)}`); + log(`Release Date: ${chalk.white.bold(this.release_date)}`); + log(chalk.white("_________________________")); + + log("\n"); + } + + renderSingleMovie() { + log(chalk.white("\n_________________________")); + log("\n"); + + log("Movie: \n"); + log(`ID: ${chalk.white(this.id)}`); + log(`Title: ${chalk.blue.bold(this.title)}`); + log(`Release Date: ${chalk.white(this.release_date)}`); + + log(`Runtime: ${chalk.white(this.runtime)}`); + log(`Vote Count: ${chalk.white(this.vote_count)}`); + log(`Overview: ${chalk.white(this.overview)}`); + log("\n"); + + log(`Genres:\n`); + if (this.genres.length) + this.genres.map((genre) => log(chalk.white(`\t${genre.name}`))); + else log("The movie doesn’t have a declared genre"); + log("\n"); + + log(`Spoken languages:\n`); + if (this.spoken_languages.length) + this.spoken_languages.map((lang) => log(chalk.white(`\t${lang.name}`))); + else log(`The movie: ${movie.id} doesn’t have any declared languages`); + log("\n"); + } + + renderMovieReviews() { + log(chalk.white("\n_________________________")); + log("\n"); + + if (this.spoken_languages.length) + this.spoken_languages.map((lang) => log(chalk.white(`\t${lang.name}`))); + else log(`The movie: ${movie.id} doesn’t have any declared languages`); + + log(`Author: ${chalk.blue.bold(this.author)}`); + log(`content: ${chalk.white(this.content)}`); + } + + renderPages(page, total_pages) { + log(chalk.white("________________________________________________")); + log(chalk.white(`Page: ${page} of: ${total_pages}`)); + log("\n"); + } +} + +module.exports = Movie; diff --git a/src/utils/entities/Person.js b/src/utils/entities/Person.js new file mode 100644 index 0000000..f5b0b33 --- /dev/null +++ b/src/utils/entities/Person.js @@ -0,0 +1,77 @@ +const chalk = require("chalk"); +const log = console.log; + +class Person { + constructor(person) { + this.id = person.id; + this.name = person.name; + this.known_for_department = person.known_for_department; + this.known_for = person.known_for; + this.birthday = person.birthday; + this.place_of_birth = person.place_of_birth; + this.biography = person.biography; + this.also_known_as = person.also_known_as; + } + + renderPopular() { + log("\n"); + log("Person: \n"); + log(`ID: ${chalk.white(this.id)}`); + log(`Name: ${chalk.blue.bold(this.name)}`); + + // If department is Acting + if (this.known_for_department == "Acting") + log(`Department: ${chalk.magenta(this.known_for_department)}`); + + // if no titles + const titles = this.known_for.filter((movie) => movie.title); + if (!titles.length) { + log(chalk.bgYellow.red(`\n\t${this.name} doesn’t appear in any movie\n`)); + return; + } + + this.known_for.forEach((movie) => { + if (movie.title) { + log("\n"); + log(`\tMovie:`); + log(`\tRelease date: ${chalk.white(movie.release_date)}`); + log(`\tTitle: ${chalk.white(movie.title)}`); + } + }); + + log(chalk.white("_________________________")); + log("\n"); + } + + renderPersonById() { + log("____________________________________\nPerson:\n"); + log( + `ID: ${this.id} \nName: ${chalk.cyanBright(this.name)} \nBirthday: ${ + this.birthday + } ${chalk.gray("|")} ${this.place_of_birth}` + ); + if (this.known_for_department != null) + log(`Department: ${chalk.magentaBright(this.known_for_department)}`); + + log(`Biography: ${chalk.cyanBright(chalk.bold(this.biography))} \n`); + + if (this.also_known_as) { + log(`Also known as: \n`); + this.also_known_as.forEach((element) => { + log(element); + }); + } else { + log(`${chalk.yellow(this.name)} doesn’t have any alternate names`); + } + + log("\n"); + } + + renderPages(page, total_pages) { + log(chalk.white("________________________________________________")); + log(chalk.white(`Page: ${page} of: ${total_pages}`)); + log("\n"); + } +} + +module.exports = Person; diff --git a/src/utils/entities/Review.js b/src/utils/entities/Review.js new file mode 100644 index 0000000..2a4435b --- /dev/null +++ b/src/utils/entities/Review.js @@ -0,0 +1,36 @@ +const chalk = require("chalk"); +const log = console.log; + +class Review { + constructor(movie) { + this.id = movie.id; + this.page = movie.page; + this.total_pages = movie.total_pages; + this.reviews = movie.results; + } + + renderMovieReviews() { + log(chalk.white("\n_________________________")); + log("\n"); + + if (this.reviews.length) { + this.reviews.map((review) => { + log(`Author: ${chalk.blue.bold(review.author)}`); + log(`content: ${chalk.white(this.sliceString(review.content))}`); + }); + + log(chalk.white("________________________________________________")); + log(chalk.white(`Page: ${this.page} of: ${this.total_pages}`)); + } else log(`The movie: ${this.id} doesn’t have any reviews`); + + log("\n"); + } + + sliceString(text = "", max = 400) { + if (text.length > max) { + return text.slice(0, max) + "..."; + } + } +} + +module.exports = Review; diff --git a/src/utils/fileReader.js b/src/utils/fileReader.js new file mode 100644 index 0000000..f347b90 --- /dev/null +++ b/src/utils/fileReader.js @@ -0,0 +1,23 @@ +const fs = require("fs"); + +function savePeople(page) { + const path = "./src/utils/persons/popular-persons.json"; + const dir = "./src/utils/persons"; + + if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); + + fs.writeFileSync(path, JSON.stringify(page), "utf-8"); +} + +function saveMovies(page, flag) { + const dir = "./src/utils/movies"; + let path = "./src/utils/movies/popular-movies.json"; + + if (flag) path = "./src/utils/movies/now-popular-movies.json"; + + if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); + + fs.writeFileSync(path, JSON.stringify(page), "utf-8"); +} + +module.exports = { savePeople, saveMovies }; diff --git a/src/utils/getMethods.js b/src/utils/getMethods.js new file mode 100644 index 0000000..a13f3a7 --- /dev/null +++ b/src/utils/getMethods.js @@ -0,0 +1,213 @@ +/** @format */ + +const https = require("https"); +const ora = require("ora"); +const fs = require("fs"); +const file = require("./fileReader.js"); +const notify = require("./notifier.js"); + +const httpConstants = require("./httpConstants.js"); +const { + chalkMovie, + chalkPeople, + chalkPersonId, + chalkSingleMovie, +} = require("./chalks.js"); + +/** + * get People by Pages + * @param commandOpt: command options to render + * @param callback: a callback function to execute with --save flag + */ +function PersonsByPage(commandOpt, callback) { + const options = { + ...httpConstants, + path: `/3/person/popular?page=${commandOpt.page}&api_key=${process.env.API_KEY}`, + }; + + const spinner = ora("Loading popular people").start(); + const req = https.request(options, (res) => { + let body = ""; + + res.on("data", (chunk) => (body += chunk)); + res.on("end", () => { + if (commandOpt.save) { + file.savePeople(JSON.parse(body)); + spinner.succeed("Popular Persons - Loaded"); + notify("Popular person data loaded to JSON"); + + if (callback) callback(commandOpt.page); + } else { + chalkPeople(JSON.parse(body), spinner); + } + }); + }); + + req.on("error", (e) => spinner.fail(e.message)); + req.end(); +} + +/** + * Person by ID functions + * @param id: id of the person + */ +function PersonById(id) { + const options = { + ...httpConstants, + path: `/3/person/${id}?&api_key=${process.env.API_KEY}`, + }; + + const spinner = ora("Fetching the person data...\n").start(); + const req = https.request(options, (res) => { + let body = ""; + + res.on("data", (chunk) => (body += chunk)); + res.on("end", () => chalkPersonId(JSON.parse(body), spinner)); + }); + + req.on("error", (e) => spinner.fail(e.message)); + req.end(); +} + +/** + * Movies functions - Movies Pagination + * @param page: number of page to render + * @param nowPlaying: bool, movies that are playing npw + * @param option: bool, save option + * */ +function MoviesByPage(page = 1, nowPlaying, option) { + let path = `/3/movie/popular?page=${page}&api_key=${process.env.API_KEY}`; + + if (nowPlaying) { + path = `/3/movie/now_playing?page=${page}&api_key=${process.env.API_KEY}`; + } + + const options = { + ...httpConstants, + path: path, + }; + + const spinner = ora("Loading popular movies").start(); + + const req = https.request(options, (res) => { + let body = ""; + + res.on("data", (chunk) => (body += chunk)); + res.on("end", () => { + if (option && nowPlaying) { + file.saveMovies(JSON.parse(body), nowPlaying); + spinner.succeed("Now playing movies data loaded"); + notify("Now playing movies data loaded to JSON"); + } else if (option) { + file.saveMovies(JSON.parse(body), nowPlaying); + spinner.succeed("Popular movies data loaded"); + notify("Popular movies data loaded to JSON"); + } else { + chalkMovie(JSON.parse(body), spinner, nowPlaying); + } + }); + }); + + req.on("error", (e) => spinner.fail(e.message)); + req.end(); +} + +/** + * Movies functions - Movies Pagination + * @param id: id of movie + * @param reviews: user reviews for a movie. + * */ +function SingleMovie(id, reviews) { + let path = `/3/movie/${id}?api_key=${process.env.API_KEY}`; + + if (reviews) { + path = `/3/movie/${id}/reviews?api_key=${process.env.API_KEY}`; + } + + const options = { + ...httpConstants, + path: path, + }; + + const spinner = ora("Fetching the movie data...").start(); + const req = https.request(options, (res) => { + let body = ""; + + res.on("data", (chunk) => (body += chunk)); + res.on("end", () => chalkSingleMovie(JSON.parse(body), spinner, reviews)); + }); + + req.on("error", (e) => spinner.fail(e.message)); + req.end(); +} + +/** + * get People by Pages from JSON + * @param page: number of page to render + */ +function JsonPersonByPage(page) { + const spinner = ora("Reading people JSON file").start(); + const path = "./src/utils/persons/popular-persons.json"; + + try { + if (fs.existsSync(path)) { + fs.readFile(path, "utf-8", (err, data) => { + const user = JSON.parse(data.toString(), null, 4); + + if (user.page == page) { + chalkPeople(user, spinner); + notify("Popular people data loaded from JSON"); + } else + spinner.fail( + "The page you want to load doesn't exist - Existing Page: " + + user.page + ); + }); + } else { + spinner.fail("File doesn't exist"); + } + } catch (err) { + console.log(err.message); + } +} + +/** + * get Movies by Pages from JSON + * @param page: number of page to render + * @param nowPlaying: bool, movies that are playing npw + */ +function JsonMoviesByPage(page, nowPlaying) { + const spinner = ora("Reading movies JSON file").start(); + let path = "./src/utils/movies/popular-movies.json"; + + if (nowPlaying) path = "./src/utils/movies/now-popular-movies.json"; + + try { + if (fs.existsSync(path)) { + fs.readFile(path, "utf-8", (err, data) => { + const user = JSON.parse(data.toString(), null, 4); + if (user.page == page) { + chalkMovie(user, spinner, nowPlaying); + notify("Movies data loaded from JSON"); + } else + spinner.fail( + "The page you want to load doesn't exist - Existing Page: " + + user.page + ); + }); + } else { + spinner.fail("File doesn't exist"); + } + } catch (err) { + console.log(err.message); + } +} + +module.exports = { + PersonById, + PersonsByPage, + MoviesByPage, + SingleMovie, + JsonPersonByPage, + JsonMoviesByPage, +}; diff --git a/src/utils/httpConstants.js b/src/utils/httpConstants.js new file mode 100644 index 0000000..808245b --- /dev/null +++ b/src/utils/httpConstants.js @@ -0,0 +1,9 @@ +module.exports = { + host: "api.themoviedb.org", + protocol: "https:", + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${process.env.API_KEY}`, + }, +}; diff --git a/src/utils/movies/now-popular-movies.json b/src/utils/movies/now-popular-movies.json new file mode 100644 index 0000000..5e6b6b7 --- /dev/null +++ b/src/utils/movies/now-popular-movies.json @@ -0,0 +1,5 @@ +<<<<<<< HEAD +{"dates":{"maximum":"2021-07-31","minimum":"2021-06-13"},"page":1,"results":[{"adult":false,"backdrop_path":"/4epzcO9HGbfc8BUJT0oNkL3rmCO.jpg","genre_ids":[28,80,53],"id":385128,"original_language":"en","original_title":"F9","overview":"Dominic Toretto and his crew battle the most skilled assassin and high-performance driver they've ever encountered: his forsaken brother.","popularity":5860.581,"poster_path":"/bOFaAXmWWXC3Rbv4u4uM9ZSzRXP.jpg","release_date":"2021-05-19","title":"F9","video":false,"vote_average":7.8,"vote_count":1728},{"adult":false,"backdrop_path":"/8s4h9friP6Ci3adRGahHARVd76E.jpg","genre_ids":[16,35,10751,878],"id":379686,"original_language":"en","original_title":"Space Jam: A New Legacy","overview":"When LeBron and his young son Dom are trapped in a digital space by a rogue A.I., LeBron must get them home safe by leading Bugs, Lola Bunny and the whole gang of notoriously undisciplined Looney Tunes to victory over the A.I.'s digitized champions on the court. It's Tunes versus Goons in the highest-stakes challenge of his life.","popularity":4781.639,"poster_path":"/5bFK5d3mVTAvBCXi5NPWH0tYjKl.jpg","release_date":"2021-07-08","title":"Space Jam: A New Legacy","video":false,"vote_average":7.7,"vote_count":1419},{"adult":false,"backdrop_path":"/dq18nCTTLpy9PmtzZI6Y2yAgdw5.jpg","genre_ids":[28,12,53,878],"id":497698,"original_language":"en","original_title":"Black Widow","overview":"Natasha Romanoff, also known as Black Widow, confronts the darker parts of her ledger when a dangerous conspiracy with ties to her past arises. Pursued by a force that will stop at nothing to bring her down, Natasha must deal with her history as a spy and the broken relationships left in her wake long before she became an Avenger.","popularity":4627.772,"poster_path":"/qAZ0pzat24kLdO3o8ejmbLxyOac.jpg","release_date":"2021-07-07","title":"Black Widow","video":false,"vote_average":7.9,"vote_count":3662},{"adult":false,"backdrop_path":"/tehpKMsls621GT9WUQie2Ft6LmP.jpg","genre_ids":[12,53,28,27,37],"id":602223,"original_language":"en","original_title":"The Forever Purge","overview":"All the rules are broken as a sect of lawless marauders decides that the annual Purge does not stop at daybreak and instead should never end as they chase a group of immigrants who they want to punish because of their harsh historical past.","popularity":3702.294,"poster_path":"/uHA5COgDzcxjpYSHHulrKVl6ByL.jpg","release_date":"2021-06-30","title":"The Forever Purge","video":false,"vote_average":7.8,"vote_count":726},{"adult":false,"backdrop_path":"/gX5UrH1TLVVBwI7WxplW43BD6Z1.jpg","genre_ids":[16,35,12,10751],"id":459151,"original_language":"en","original_title":"The Boss Baby: Family Business","overview":"The Templeton brothers — Tim and his Boss Baby little bro Ted — have become adults and drifted away from each other. But a new boss baby with a cutting-edge approach and a can-do attitude is about to bring them together again … and inspire a new family business.","popularity":3444.216,"poster_path":"/5dExO5G2iaaTxYnLIFKLWofDzyI.jpg","release_date":"2021-07-01","title":"The Boss Baby: Family Business","video":false,"vote_average":7.9,"vote_count":992},{"adult":false,"backdrop_path":"/620hnMVLu6RSZW6a5rwO8gqpt0t.jpg","genre_ids":[16,35,10751,14],"id":508943,"original_language":"en","original_title":"Luca","overview":"Luca and his best friend Alberto experience an unforgettable summer on the Italian Riviera. But all the fun is threatened by a deeply-held secret: they are sea monsters from another world just below the water’s surface.","popularity":3019.966,"poster_path":"/jTswp6KyDYKtvC52GbHagrZbGvD.jpg","release_date":"2021-06-17","title":"Luca","video":false,"vote_average":8.1,"vote_count":3426},{"adult":false,"backdrop_path":"/7WJjFviFBffEJvkAms4uWwbcVUk.jpg","genre_ids":[12,14,35,28],"id":451048,"original_language":"en","original_title":"Jungle Cruise","overview":"Dr. Lily Houghton enlists the aid of wisecracking skipper Frank Wolff to take her down the Amazon in his dilapidated boat. Together, they search for an ancient tree that holds the power to heal – a discovery that will change the future of medicine.","popularity":1946.942,"poster_path":"/9dKCd55IuTT5QRs989m9Qlb7d2B.jpg","release_date":"2021-07-28","title":"Jungle Cruise","video":false,"vote_average":8.2,"vote_count":645},{"adult":false,"backdrop_path":"/zm2kMjiz0u6qdn2XKbEbQkDiltN.jpg","genre_ids":[27],"id":675024,"original_language":"es","original_title":"El exorcismo de Carmen Farías","overview":"Carmen, a brave journalist, discovers soon after her mother's death that she has inherited her grandma's house. She decides to move there without knowing it hides dark secrets.","popularity":2581.669,"poster_path":"/uoTPjx07dxTrC1g3dYeaS2WNVGL.jpg","release_date":"2021-07-05","title":"The Exorcism of Carmen Farias","video":false,"vote_average":6.6,"vote_count":36},{"adult":false,"backdrop_path":"/6MKr3KgOLmzOP6MSuZERO41Lpkt.jpg","genre_ids":[35,80],"id":337404,"original_language":"en","original_title":"Cruella","overview":"In 1970s London amidst the punk rock revolution, a young grifter named Estella is determined to make a name for herself with her designs. She befriends a pair of young thieves who appreciate her appetite for mischief, and together they are able to build a life for themselves on the London streets. One day, Estella’s flair for fashion catches the eye of the Baroness von Hellman, a fashion legend who is devastatingly chic and terrifyingly haute. But their relationship sets in motion a course of events and revelations that will cause Estella to embrace her wicked side and become the raucous, fashionable and revenge-bent Cruella.","popularity":1635.546,"poster_path":"/rTh4K5uw9HypmpGslcKd4QfHl93.jpg","release_date":"2021-05-26","title":"Cruella","video":false,"vote_average":8.4,"vote_count":4478},{"adult":false,"backdrop_path":"/AsqUSUqXrK8JfH8WEQnCXVbIAv6.jpg","genre_ids":[878,53,27],"id":520763,"original_language":"en","original_title":"A Quiet Place Part II","overview":"Following the events at home, the Abbott family now face the terrors of the outside world. Forced to venture into the unknown, they realize that the creatures that hunt by sound are not the only threats that lurk beyond the sand path.","popularity":1436.462,"poster_path":"/4q2hz2m8hubgvijz8Ez0T2Os2Yv.jpg","release_date":"2021-05-21","title":"A Quiet Place Part II","video":false,"vote_average":7.7,"vote_count":2303},{"adult":false,"backdrop_path":"/5HjzYTihkH7EvOWSE7KcsF6pBMM.jpg","genre_ids":[10751,35,12,16,14],"id":522478,"original_language":"en","original_title":"Peter Rabbit 2: The Runaway","overview":"Bea, Thomas, and the rabbits have created a makeshift family, but despite his best efforts, Peter can’t seem to shake his mischievous reputation. Adventuring out of the garden, Peter finds himself in a world where his mischief is appreciated, but when his family risks everything to come looking for him, Peter must figure out what kind of bunny he wants to be.","popularity":1481.849,"poster_path":"/cycDz68DtTjJrDJ1fV8EBq2Xdpb.jpg","release_date":"2021-03-25","title":"Peter Rabbit 2: The Runaway","video":false,"vote_average":7.4,"vote_count":223},{"adult":false,"backdrop_path":"/70AV2Xx5FQYj20labp0EGdbjI6E.jpg","genre_ids":[80,28,53],"id":637649,"original_language":"en","original_title":"Wrath of Man","overview":"A cold and mysterious new security guard for a Los Angeles cash truck company surprises his co-workers when he unleashes precision skills during a heist. The crew is left wondering who he is and where he came from. Soon, the marksman's ultimate motive becomes clear as he takes dramatic and irrevocable steps to settle a score.","popularity":1558.624,"poster_path":"/M7SUK85sKjaStg4TKhlAVyGlz3.jpg","release_date":"2021-04-22","title":"Wrath of Man","video":false,"vote_average":7.9,"vote_count":1672},{"adult":false,"backdrop_path":"/6FzuNrApEc71aJ3CwwkpadbNled.jpg","genre_ids":[28,35,80],"id":581644,"original_language":"en","original_title":"The Misfits","overview":"After being recruited by a group of unconventional thieves, renowned criminal Richard Pace finds himself caught up in an elaborate gold heist that promises to have far-reaching implications on his life and the lives of countless others.","popularity":1460.728,"poster_path":"/dPOyYnCkRbWAEem85N3VFpQODf5.jpg","release_date":"2021-06-10","title":"The Misfits","video":false,"vote_average":5.4,"vote_count":85},{"adult":false,"backdrop_path":"/ok7RdHhVngnwkvKj09tvtOvypG.jpg","genre_ids":[80,18,53,9648],"id":649409,"original_language":"en","original_title":"No Sudden Move","overview":"A group of criminals are brought together under mysterious circumstances and have to work together to uncover what's really going on when their simple job goes completely sideways.","popularity":1054.1,"poster_path":"/34BmdJkdvRweC3xJJFlOFQ2IbYc.jpg","release_date":"2021-06-24","title":"No Sudden Move","video":false,"vote_average":6.6,"vote_count":145},{"adult":false,"backdrop_path":"/qi6Edc1OPcyENecGtz8TF0DUr9e.jpg","genre_ids":[27,9648,53],"id":423108,"original_language":"en","original_title":"The Conjuring: The Devil Made Me Do It","overview":"Paranormal investigators Ed and Lorraine Warren encounter what would become one of the most sensational cases from their files. The fight for the soul of a young boy takes them beyond anything they'd ever seen before, to mark the first time in U.S. history that a murder suspect would claim demonic possession as a defense.","popularity":1156.593,"poster_path":"/xbSuFiJbbBWCkyCCKIMfuDCA4yV.jpg","release_date":"2021-05-25","title":"The Conjuring: The Devil Made Me Do It","video":false,"vote_average":7.9,"vote_count":3279},{"adult":false,"backdrop_path":"/9yBVqNruk6Ykrwc32qrK2TIE5xw.jpg","genre_ids":[28,14,12],"id":460465,"original_language":"en","original_title":"Mortal Kombat","overview":"Washed-up MMA fighter Cole Young, unaware of his heritage, and hunted by Emperor Shang Tsung's best warrior, Sub-Zero, seeks out and trains with Earth's greatest champions as he prepares to stand against the enemies of Outworld in a high stakes battle for the universe.","popularity":1009.889,"poster_path":"/nkayOAUBUu4mMvyNf9iHSUiPjF1.jpg","release_date":"2021-04-07","title":"Mortal Kombat","video":false,"vote_average":7.4,"vote_count":3422},{"adult":false,"backdrop_path":"/q2mtFwvQQbun4nM9p16gA3Hqb0H.jpg","genre_ids":[9648,53,27],"id":631843,"original_language":"en","original_title":"Old","overview":"A group of families on a tropical holiday discover that the secluded beach where they are staying is somehow causing them to age rapidly – reducing their entire lives into a single day.","popularity":806.465,"poster_path":"/cGLL4SY6jFjjUZkz2eFxgtCtGgK.jpg","release_date":"2021-07-21","title":"Old","video":false,"vote_average":6.4,"vote_count":238},{"adult":false,"backdrop_path":"/xPpXYnCWfjkt3zzE0dpCNME1pXF.jpg","genre_ids":[16,28,12,14],"id":635302,"original_language":"ja","original_title":"劇場版「鬼滅の刃」無限列車編","overview":"Tanjirō Kamado, joined with Inosuke Hashibira, a boy raised by boars who wears a boar's head, and Zenitsu Agatsuma, a scared boy who reveals his true power when he sleeps, boards the Infinity Train on a new mission with the Fire Hashira, Kyōjurō Rengoku, to defeat a demon who has been tormenting the people and killing the demon slayers who oppose it!","popularity":885.572,"poster_path":"/h8Rb9gBr48ODIwYUttZNYeMWeUU.jpg","release_date":"2020-10-16","title":"Demon Slayer -Kimetsu no Yaiba- The Movie: Mugen Train","video":false,"vote_average":8.4,"vote_count":1444},{"adult":false,"backdrop_path":"/A0xW7GgeFQoQmPOn7HcHkBQ5nlb.jpg","genre_ids":[53,28],"id":817451,"original_language":"en","original_title":"Endangered Species","overview":"Jack Halsey takes his wife, their adult kids, and a friend for a dream vacation in Kenya. But as they venture off alone into a wilderness park, their safari van is flipped over by an angry rhino, leaving them injured and desperate. Then, as two of them go in search of rescue, a bloody, vicious encounter with a leopard and a clan of hyenas incites a desperate fight for survival.","popularity":793.01,"poster_path":"/ccsSqbpEqr2KK9eMvoeF8ERFCd5.jpg","release_date":"2021-05-27","title":"Endangered Species","video":false,"vote_average":6.3,"vote_count":74},{"adult":false,"backdrop_path":"/rAgsOIhqRS6tUthmHoqnqh9PIAE.jpg","genre_ids":[28,12,35,878],"id":436969,"original_language":"en","original_title":"The Suicide Squad","overview":"Supervillains Harley Quinn, Bloodsport, Peacemaker and a collection of nutty cons at Belle Reve prison join the super-secret, super-shady Task Force X as they are dropped off at the remote, enemy-infused island of Corto Maltese.","popularity":666.854,"poster_path":"/464N3J1i6L5SsazPmX9m3q1GiZ3.jpg","release_date":"2021-07-28","title":"The Suicide Squad","video":false,"vote_average":8.3,"vote_count":64}],"total_pages":56,"total_results":1112} +======= +{"page":2,"results":[{"adult":false,"backdrop_path":"/3RMbkXS4ocMmoJyAD3ZsWbm32Kx.jpg","genre_ids":[18,878,53],"id":615658,"original_language":"en","original_title":"Awake","overview":"After a sudden global event wipes out all electronics and takes away humankind’s ability to sleep, chaos quickly begins to consume the world. Only Jill, an ex-soldier with a troubled past, may hold the key to a cure in the form of her own daughter. The question is, can Jill safely deliver her daughter and save the world before she herself loses her mind.","popularity":1136.254,"poster_path":"/uZkNbB8isWXHMDNoIbqXvmslBMC.jpg","release_date":"2021-06-09","title":"Awake","video":false,"vote_average":6.1,"vote_count":570},{"adult":false,"backdrop_path":"/s15olg5LwRqTjgDd5KIfVXhcoqs.jpg","genre_ids":[27,53,28],"id":760883,"original_language":"de","original_title":"Blood Red Sky","overview":"A woman with a mysterious illness is forced into action when a group of terrorists attempt to hijack a transatlantic overnight flight. In order to protect her son she will have to reveal a dark secret, and unleash the inner monster she has fought to hide.","popularity":1427.675,"poster_path":"/ky8Fua6PD7FyyOA7JACh3GDETli.jpg","release_date":"2021-07-23","title":"Blood Red Sky","video":false,"vote_average":7.4,"vote_count":473},{"adult":false,"backdrop_path":"/c0izdYdnTe4uMRifHgvTA85wPz0.jpg","genre_ids":[28,12,27,80],"id":503736,"original_language":"en","original_title":"Army of the Dead","overview":"Following a zombie outbreak in Las Vegas, a group of mercenaries take the ultimate gamble: venturing into the quarantine zone to pull off the greatest heist ever attempted.","popularity":1140.14,"poster_path":"/z8CExJekGrEThbpMXAmCFvvgoJR.jpg","release_date":"2021-05-14","title":"Army of the Dead","video":false,"vote_average":6.4,"vote_count":2055},{"adult":false,"backdrop_path":"/ok7RdHhVngnwkvKj09tvtOvypG.jpg","genre_ids":[80,18,53,9648],"id":649409,"original_language":"en","original_title":"No Sudden Move","overview":"A group of criminals are brought together under mysterious circumstances and have to work together to uncover what's really going on when their simple job goes completely sideways.","popularity":1054.1,"poster_path":"/34BmdJkdvRweC3xJJFlOFQ2IbYc.jpg","release_date":"2021-06-24","title":"No Sudden Move","video":false,"vote_average":6.6,"vote_count":145},{"adult":false,"backdrop_path":"/qi6Edc1OPcyENecGtz8TF0DUr9e.jpg","genre_ids":[27,9648,53],"id":423108,"original_language":"en","original_title":"The Conjuring: The Devil Made Me Do It","overview":"Paranormal investigators Ed and Lorraine Warren encounter what would become one of the most sensational cases from their files. The fight for the soul of a young boy takes them beyond anything they'd ever seen before, to mark the first time in U.S. history that a murder suspect would claim demonic possession as a defense.","popularity":1156.593,"poster_path":"/xbSuFiJbbBWCkyCCKIMfuDCA4yV.jpg","release_date":"2021-05-25","title":"The Conjuring: The Devil Made Me Do It","video":false,"vote_average":7.9,"vote_count":3279},{"adult":false,"backdrop_path":"/9yBVqNruk6Ykrwc32qrK2TIE5xw.jpg","genre_ids":[28,14,12],"id":460465,"original_language":"en","original_title":"Mortal Kombat","overview":"Washed-up MMA fighter Cole Young, unaware of his heritage, and hunted by Emperor Shang Tsung's best warrior, Sub-Zero, seeks out and trains with Earth's greatest champions as he prepares to stand against the enemies of Outworld in a high stakes battle for the universe.","popularity":1009.889,"poster_path":"/nkayOAUBUu4mMvyNf9iHSUiPjF1.jpg","release_date":"2021-04-07","title":"Mortal Kombat","video":false,"vote_average":7.4,"vote_count":3422},{"adult":false,"backdrop_path":"/inJjDhCjfhh3RtrJWBmmDqeuSYC.jpg","genre_ids":[28,12,14],"id":399566,"original_language":"en","original_title":"Godzilla vs. Kong","overview":"In a time when monsters walk the Earth, humanity’s fight for its future sets Godzilla and Kong on a collision course that will see the two most powerful forces of nature on the planet collide in a spectacular battle for the ages.","popularity":992.262,"poster_path":"/pgqgaUx1cJb5oZQQ5v0tNARCeBp.jpg","release_date":"2021-03-24","title":"Godzilla vs. Kong","video":false,"vote_average":8,"vote_count":6564},{"adult":false,"backdrop_path":"/pfcj8IYB5bK8RTWiHwOCGfIzVw6.jpg","genre_ids":[18,14,53],"id":845222,"original_language":"ko","original_title":"킹덤: 아신전","overview":"Tragedy, betrayal and a mysterious discovery fuel a woman's vengeance for the loss of her tribe and family in this special episode of \"Kingdom.\"","popularity":807.065,"poster_path":"/cE9SBjWMUK0HFxmT1cVFDtu5CLT.jpg","release_date":"2021-07-23","title":"Kingdom: Ashin of the North","video":false,"vote_average":7.7,"vote_count":194},{"adult":false,"backdrop_path":"/q2mtFwvQQbun4nM9p16gA3Hqb0H.jpg","genre_ids":[9648,53,27],"id":631843,"original_language":"en","original_title":"Old","overview":"A group of families on a tropical holiday discover that the secluded beach where they are staying is somehow causing them to age rapidly – reducing their entire lives into a single day.","popularity":806.465,"poster_path":"/cGLL4SY6jFjjUZkz2eFxgtCtGgK.jpg","release_date":"2021-07-21","title":"Old","video":false,"vote_average":6.4,"vote_count":238},{"adult":false,"backdrop_path":"/xPpXYnCWfjkt3zzE0dpCNME1pXF.jpg","genre_ids":[16,28,12,14],"id":635302,"original_language":"ja","original_title":"劇場版「鬼滅の刃」無限列車編","overview":"Tanjirō Kamado, joined with Inosuke Hashibira, a boy raised by boars who wears a boar's head, and Zenitsu Agatsuma, a scared boy who reveals his true power when he sleeps, boards the Infinity Train on a new mission with the Fire Hashira, Kyōjurō Rengoku, to defeat a demon who has been tormenting the people and killing the demon slayers who oppose it!","popularity":885.572,"poster_path":"/h8Rb9gBr48ODIwYUttZNYeMWeUU.jpg","release_date":"2020-10-16","title":"Demon Slayer -Kimetsu no Yaiba- The Movie: Mugen Train","video":false,"vote_average":8.4,"vote_count":1444},{"adult":false,"backdrop_path":"/syjh4WJARo5gwjyUYxOPOElWGWh.jpg","genre_ids":[27,53],"id":698320,"original_language":"en","original_title":"The Mad Hatter","overview":"An eccentric professor takes four of his students to the mansion of the “Mad Hatter”, an urban legend driven insane by mercury poisoning and grief. He says that there’s nothing to worry about now: the strange, shambling “caretakers” that haunt the home are merely servants that have fallen to inbreeding, and the Hatter himself has been dead for years. But as the students start disappearing one by one, those that remain start to question if the professor’s experiment is truly scientific...and if the Hatter didn’t just succumb to his madness, but decided to spread it...","popularity":940.814,"poster_path":"/lTUfalNirpq7SBASa6lnzs27iam.jpg","release_date":"2021-01-29","title":"The Mad Hatter","video":false,"vote_average":6.3,"vote_count":34},{"adult":false,"backdrop_path":"/5C8bfwglg91uZhc2fbfpSjNGamV.jpg","genre_ids":[27,9648],"id":591273,"original_language":"en","original_title":"Fear Street: 1994","overview":"In 1994, a group of teenagers discovers that the terrifying events which have haunted their town for generations ​are all connected — and that they may be the next targets.","popularity":761.372,"poster_path":"/9J9Wy39ZjrVmfk7yMkulpcI5sy0.jpg","release_date":"2021-06-28","title":"Fear Street: 1994","video":false,"vote_average":6.8,"vote_count":855},{"adult":false,"backdrop_path":"/yC4DRg5aGgNpkHpUDpLtBqzownS.jpg","genre_ids":[878,28],"id":586047,"original_language":"ko","original_title":"서복","overview":"A former intelligence agent gets involved with the first human clone, Seo Bok, who others seek, causing trouble.","popularity":752.875,"poster_path":"/nxxuWC32Y6TULj4VnVwMPUFLIpK.jpg","release_date":"2021-04-12","title":"Seobok","video":false,"vote_average":7.6,"vote_count":69},{"adult":false,"backdrop_path":"/pVNXmfZvQKFdUKVYNJxZAiy69DC.jpg","genre_ids":[28,12],"id":529106,"original_language":"ru","original_title":"Майор Гром: Чумной Доктор","overview":"Igor Grom is a skilled policeman from St. Petersburg, known for his daring nature and uncompromising attitude towards the criminals of all kinds. Incredible strength, analytical mind and integrity – these qualities make Major Grom the perfect policeman. Working tirelessly, he always pushes through, and meets the challenges standing in the way.","popularity":830.05,"poster_path":"/wnesEmcq7xdw1Rm1Bn6XEFTkenR.jpg","release_date":"2021-04-01","title":"Major Grom: Plague Doctor","video":false,"vote_average":7,"vote_count":223},{"adult":false,"backdrop_path":"/7jpj6ek9dftr3IXm7Pnq2pkhir3.jpg","genre_ids":[27,9648],"id":591274,"original_language":"en","original_title":"Fear Street: 1978","overview":"In 1978, two rival groups at Camp Nightwing must band together to solve a terrifying mystery when horrors from their towns' history come alive.","popularity":695.095,"poster_path":"/5dNTxhoGDTHHGqUTdxcr4H1dqlU.jpg","release_date":"2021-07-08","title":"Fear Street: 1978","video":false,"vote_average":7.4,"vote_count":683},{"adult":false,"backdrop_path":"/rlNnwObbMu5G2FaOUlacnUIdIIA.jpg","genre_ids":[16,35,10751,12],"id":726684,"original_language":"fr","original_title":"Miraculous World : Shanghai, la légende de Ladydragon","overview":"On school break, Marinette heads to Shanghai to meet Adrien. But after arriving, Marinette loses all her stuff, including the Miraculous that allows her to turn into Ladybug!","popularity":703.442,"poster_path":"/qQ0VKsGRQ2ofAmswGNzZnvC1xPE.jpg","release_date":"2021-04-04","title":"Miraculous World: Shanghai – The Legend of Ladydragon","video":false,"vote_average":7.9,"vote_count":521},{"adult":false,"backdrop_path":"/A0xW7GgeFQoQmPOn7HcHkBQ5nlb.jpg","genre_ids":[53,28],"id":817451,"original_language":"en","original_title":"Endangered Species","overview":"Jack Halsey takes his wife, their adult kids, and a friend for a dream vacation in Kenya. But as they venture off alone into a wilderness park, their safari van is flipped over by an angry rhino, leaving them injured and desperate. Then, as two of them go in search of rescue, a bloody, vicious encounter with a leopard and a clan of hyenas incites a desperate fight for survival.","popularity":793.01,"poster_path":"/ccsSqbpEqr2KK9eMvoeF8ERFCd5.jpg","release_date":"2021-05-27","title":"Endangered Species","video":false,"vote_average":6.3,"vote_count":74},{"adult":false,"backdrop_path":"/rAgsOIhqRS6tUthmHoqnqh9PIAE.jpg","genre_ids":[28,12,35,878],"id":436969,"original_language":"en","original_title":"The Suicide Squad","overview":"Supervillains Harley Quinn, Bloodsport, Peacemaker and a collection of nutty cons at Belle Reve prison join the super-secret, super-shady Task Force X as they are dropped off at the remote, enemy-infused island of Corto Maltese.","popularity":666.854,"poster_path":"/464N3J1i6L5SsazPmX9m3q1GiZ3.jpg","release_date":"2021-07-28","title":"The Suicide Squad","video":false,"vote_average":8.3,"vote_count":64},{"adult":false,"backdrop_path":"/vqEjXzWdzPbV2DZ7bk29weDFiDl.jpg","genre_ids":[16,12,10751,37],"id":637693,"original_language":"en","original_title":"Spirit Untamed","overview":"Lucky Prescott's life is changed forever when she moves from her home in the city to a small frontier town and befriends a wild mustang named Spirit.","popularity":688.728,"poster_path":"/5cbGVDmRMYVzkq5cItZ7cYlDdDR.jpg","release_date":"2021-05-20","title":"Spirit Untamed","video":false,"vote_average":7.7,"vote_count":184},{"adult":false,"backdrop_path":"/uWeffFhprUohUL5GO3YfQqdsVrI.jpg","genre_ids":[18,80,28,53],"id":615457,"original_language":"en","original_title":"Nobody","overview":"Hutch Mansell, a suburban dad, overlooked husband, nothing neighbor — a \"nobody.\" When two thieves break into his home one night, Hutch's unknown long-simmering rage is ignited and propels him on a brutal path that will uncover dark secrets he fought to leave behind.","popularity":649.242,"poster_path":"/oBgWY00bEFeZ9N25wWVyuQddbAo.jpg","release_date":"2021-03-26","title":"Nobody","video":false,"vote_average":8.4,"vote_count":2878}],"total_pages":500,"total_results":10000} +>>>>>>> main diff --git a/src/utils/movies/popular-movies.json b/src/utils/movies/popular-movies.json new file mode 100644 index 0000000..f892adb --- /dev/null +++ b/src/utils/movies/popular-movies.json @@ -0,0 +1 @@ +{"page":1,"results":[{"adult":false,"backdrop_path":"/4epzcO9HGbfc8BUJT0oNkL3rmCO.jpg","genre_ids":[28,80,53],"id":385128,"original_language":"en","original_title":"F9","overview":"Dominic Toretto and his crew battle the most skilled assassin and high-performance driver they've ever encountered: his forsaken brother.","popularity":5860.581,"poster_path":"/bOFaAXmWWXC3Rbv4u4uM9ZSzRXP.jpg","release_date":"2021-05-19","title":"F9","video":false,"vote_average":7.8,"vote_count":1728},{"adult":false,"backdrop_path":"/8s4h9friP6Ci3adRGahHARVd76E.jpg","genre_ids":[16,35,10751,878],"id":379686,"original_language":"en","original_title":"Space Jam: A New Legacy","overview":"When LeBron and his young son Dom are trapped in a digital space by a rogue A.I., LeBron must get them home safe by leading Bugs, Lola Bunny and the whole gang of notoriously undisciplined Looney Tunes to victory over the A.I.'s digitized champions on the court. It's Tunes versus Goons in the highest-stakes challenge of his life.","popularity":4781.639,"poster_path":"/5bFK5d3mVTAvBCXi5NPWH0tYjKl.jpg","release_date":"2021-07-08","title":"Space Jam: A New Legacy","video":false,"vote_average":7.7,"vote_count":1419},{"adult":false,"backdrop_path":"/dq18nCTTLpy9PmtzZI6Y2yAgdw5.jpg","genre_ids":[28,12,53,878],"id":497698,"original_language":"en","original_title":"Black Widow","overview":"Natasha Romanoff, also known as Black Widow, confronts the darker parts of her ledger when a dangerous conspiracy with ties to her past arises. Pursued by a force that will stop at nothing to bring her down, Natasha must deal with her history as a spy and the broken relationships left in her wake long before she became an Avenger.","popularity":4627.772,"poster_path":"/qAZ0pzat24kLdO3o8ejmbLxyOac.jpg","release_date":"2021-07-07","title":"Black Widow","video":false,"vote_average":7.9,"vote_count":3662},{"adult":false,"backdrop_path":"/tehpKMsls621GT9WUQie2Ft6LmP.jpg","genre_ids":[12,53,28,27,37],"id":602223,"original_language":"en","original_title":"The Forever Purge","overview":"All the rules are broken as a sect of lawless marauders decides that the annual Purge does not stop at daybreak and instead should never end as they chase a group of immigrants who they want to punish because of their harsh historical past.","popularity":3702.294,"poster_path":"/uHA5COgDzcxjpYSHHulrKVl6ByL.jpg","release_date":"2021-06-30","title":"The Forever Purge","video":false,"vote_average":7.8,"vote_count":726},{"adult":false,"backdrop_path":"/gX5UrH1TLVVBwI7WxplW43BD6Z1.jpg","genre_ids":[16,35,12,10751],"id":459151,"original_language":"en","original_title":"The Boss Baby: Family Business","overview":"The Templeton brothers — Tim and his Boss Baby little bro Ted — have become adults and drifted away from each other. But a new boss baby with a cutting-edge approach and a can-do attitude is about to bring them together again … and inspire a new family business.","popularity":3444.216,"poster_path":"/5dExO5G2iaaTxYnLIFKLWofDzyI.jpg","release_date":"2021-07-01","title":"The Boss Baby: Family Business","video":false,"vote_average":7.9,"vote_count":992},{"adult":false,"backdrop_path":"/620hnMVLu6RSZW6a5rwO8gqpt0t.jpg","genre_ids":[16,35,10751,14],"id":508943,"original_language":"en","original_title":"Luca","overview":"Luca and his best friend Alberto experience an unforgettable summer on the Italian Riviera. But all the fun is threatened by a deeply-held secret: they are sea monsters from another world just below the water’s surface.","popularity":3019.966,"poster_path":"/jTswp6KyDYKtvC52GbHagrZbGvD.jpg","release_date":"2021-06-17","title":"Luca","video":false,"vote_average":8.1,"vote_count":3426},{"adult":false,"backdrop_path":"/yizL4cEKsVvl17Wc1mGEIrQtM2F.jpg","genre_ids":[28,878],"id":588228,"original_language":"en","original_title":"The Tomorrow War","overview":"The world is stunned when a group of time travelers arrive from the year 2051 to deliver an urgent message: Thirty years in the future, mankind is losing a global war against a deadly alien species. The only hope for survival is for soldiers and civilians from the present to be transported to the future and join the fight. Among those recruited is high school teacher and family man Dan Forester. Determined to save the world for his young daughter, Dan teams up with a brilliant scientist and his estranged father in a desperate quest to rewrite the fate of the planet.","popularity":2876.135,"poster_path":"/34nDCQZwaEvsy4CFO5hkGRFDCVU.jpg","release_date":"2021-06-30","title":"The Tomorrow War","video":false,"vote_average":8.2,"vote_count":3077},{"adult":false,"backdrop_path":"/7WJjFviFBffEJvkAms4uWwbcVUk.jpg","genre_ids":[12,14,35,28],"id":451048,"original_language":"en","original_title":"Jungle Cruise","overview":"Dr. Lily Houghton enlists the aid of wisecracking skipper Frank Wolff to take her down the Amazon in his dilapidated boat. Together, they search for an ancient tree that holds the power to heal – a discovery that will change the future of medicine.","popularity":1946.942,"poster_path":"/9dKCd55IuTT5QRs989m9Qlb7d2B.jpg","release_date":"2021-07-28","title":"Jungle Cruise","video":false,"vote_average":8.2,"vote_count":645},{"adult":false,"backdrop_path":"/zm2kMjiz0u6qdn2XKbEbQkDiltN.jpg","genre_ids":[27],"id":675024,"original_language":"es","original_title":"El exorcismo de Carmen Farías","overview":"Carmen, a brave journalist, discovers soon after her mother's death that she has inherited her grandma's house. She decides to move there without knowing it hides dark secrets.","popularity":2581.669,"poster_path":"/uoTPjx07dxTrC1g3dYeaS2WNVGL.jpg","release_date":"2021-07-05","title":"The Exorcism of Carmen Farias","video":false,"vote_average":6.6,"vote_count":36},{"adult":false,"backdrop_path":"/wjQXZTlFM3PVEUmKf1sUajjygqT.jpg","genre_ids":[878,28,53],"id":581726,"original_language":"en","original_title":"Infinite","overview":"Evan McCauley has skills he never learned and memories of places he has never visited. Self-medicated and on the brink of a mental breakdown, a secret group that call themselves “Infinites” come to his rescue, revealing that his memories are real.","popularity":2045.089,"poster_path":"/niw2AKHz6XmwiRMLWaoyAOAti0G.jpg","release_date":"2021-06-10","title":"Infinite","video":false,"vote_average":7.2,"vote_count":564},{"adult":false,"backdrop_path":"/3OwaKVZf3A2NdnarqKbwzFEhKir.jpg","genre_ids":[16,14,10751,28,12,878],"id":730840,"original_language":"en","original_title":"Trollhunters: Rise of the Titans","overview":"Arcadia may look like an ordinary town, but it lies at the center of magical and mystical lines that makes it a nexus for many battles among otherworldly creatures, including trolls, aliens, and wizards. Now, various heroes will team-up in an epic adventure where they must fight the Arcane Order for control over the magic that binds them all together.","popularity":1837.168,"poster_path":"/zvUNFeTz0Sssb210wSiIiHRjA4W.jpg","release_date":"2021-07-21","title":"Trollhunters: Rise of the Titans","video":false,"vote_average":7.9,"vote_count":108},{"adult":false,"backdrop_path":"/iJ2HVOZT9Kjayrhy21pbGIJs9ey.jpg","genre_ids":[28,12,14],"id":525660,"original_language":"cn","original_title":"真·三国无双","overview":"Warlords, warriors and statesmen wage a battle for supremacy in this fantasy tale based on the hit video games and the \"Romance of the Three Kingdoms.\"","popularity":1915.982,"poster_path":"/7BCTdek5LFHglcgl7shsm7igJAH.jpg","release_date":"2021-04-29","title":"Dynasty Warriors","video":false,"vote_average":6.6,"vote_count":46},{"adult":false,"backdrop_path":"/6MKr3KgOLmzOP6MSuZERO41Lpkt.jpg","genre_ids":[35,80],"id":337404,"original_language":"en","original_title":"Cruella","overview":"In 1970s London amidst the punk rock revolution, a young grifter named Estella is determined to make a name for herself with her designs. She befriends a pair of young thieves who appreciate her appetite for mischief, and together they are able to build a life for themselves on the London streets. One day, Estella’s flair for fashion catches the eye of the Baroness von Hellman, a fashion legend who is devastatingly chic and terrifyingly haute. But their relationship sets in motion a course of events and revelations that will cause Estella to embrace her wicked side and become the raucous, fashionable and revenge-bent Cruella.","popularity":1635.546,"poster_path":"/rTh4K5uw9HypmpGslcKd4QfHl93.jpg","release_date":"2021-05-26","title":"Cruella","video":false,"vote_average":8.4,"vote_count":4478},{"adult":false,"backdrop_path":"/AsqUSUqXrK8JfH8WEQnCXVbIAv6.jpg","genre_ids":[878,53,27],"id":520763,"original_language":"en","original_title":"A Quiet Place Part II","overview":"Following the events at home, the Abbott family now face the terrors of the outside world. Forced to venture into the unknown, they realize that the creatures that hunt by sound are not the only threats that lurk beyond the sand path.","popularity":1436.462,"poster_path":"/4q2hz2m8hubgvijz8Ez0T2Os2Yv.jpg","release_date":"2021-05-21","title":"A Quiet Place Part II","video":false,"vote_average":7.7,"vote_count":2303},{"adult":false,"backdrop_path":"/5HjzYTihkH7EvOWSE7KcsF6pBMM.jpg","genre_ids":[10751,35,12,16,14],"id":522478,"original_language":"en","original_title":"Peter Rabbit 2: The Runaway","overview":"Bea, Thomas, and the rabbits have created a makeshift family, but despite his best efforts, Peter can’t seem to shake his mischievous reputation. Adventuring out of the garden, Peter finds himself in a world where his mischief is appreciated, but when his family risks everything to come looking for him, Peter must figure out what kind of bunny he wants to be.","popularity":1481.849,"poster_path":"/cycDz68DtTjJrDJ1fV8EBq2Xdpb.jpg","release_date":"2021-03-25","title":"Peter Rabbit 2: The Runaway","video":false,"vote_average":7.4,"vote_count":223},{"adult":false,"backdrop_path":"/zsH3iW60T1t2HBTtrSKzzxJ406J.jpg","genre_ids":[16,35,10751],"id":846214,"original_language":"en","original_title":"The Simpsons: The Good, the Bart, and the Loki","overview":"Loki is banished from Asgard once again and must face his toughest opponents yet: the Simpsons and Springfield’s mightiest heroes. The God of Mischief teams up with Bart Simpson in the ultimate crossover event paying tribute to the Marvel Cinematic Universe of superheroes and villains.","popularity":1278.673,"poster_path":"/rtMdtzywcAGOrF6t8fbxJBqpdcq.jpg","release_date":"2021-07-07","title":"The Simpsons: The Good, the Bart, and the Loki","video":false,"vote_average":7.9,"vote_count":316},{"adult":false,"backdrop_path":"/x9p2syPxeK2OYCpz35fsg0EFjlG.jpg","genre_ids":[16,28,12,35,10751,14,878],"id":834404,"original_language":"en","original_title":"Teen Titans Go! See Space Jam","overview":"The Teen Titans are visited by the Nerdlucks, the Space Jam villains who tried to capture Michael Jordan and the Looney Tunes. Astonished to discover his fellow Titans have never seen Space Jam, Cyborg organizes an exclusive watch party. Of course, if the Titans are watching a movie, don't expect silence to be golden. Raven and Starfire provide the commentary, Cyborg presents the fun facts, Beast Boy points out the butt shots, and Robin, but Robin doesn't trust their new alien friends. Are the Nerdlucks here to attend an innocent watch party, or do they have more sinister motives up their sleeves?","popularity":1326.877,"poster_path":"/rMoVOCw6DF3zC6hS76ZhQMWiXNX.jpg","release_date":"2021-06-20","title":"Teen Titans Go! See Space Jam","video":false,"vote_average":7.2,"vote_count":76},{"adult":false,"backdrop_path":"/70AV2Xx5FQYj20labp0EGdbjI6E.jpg","genre_ids":[80,28,53],"id":637649,"original_language":"en","original_title":"Wrath of Man","overview":"A cold and mysterious new security guard for a Los Angeles cash truck company surprises his co-workers when he unleashes precision skills during a heist. The crew is left wondering who he is and where he came from. Soon, the marksman's ultimate motive becomes clear as he takes dramatic and irrevocable steps to settle a score.","popularity":1558.624,"poster_path":"/M7SUK85sKjaStg4TKhlAVyGlz3.jpg","release_date":"2021-04-22","title":"Wrath of Man","video":false,"vote_average":7.9,"vote_count":1672},{"adult":false,"backdrop_path":null,"genre_ids":[28,80],"id":385687,"original_language":"en","original_title":"Fast & Furious 10","overview":"The tenth installment in the Fast Saga.","popularity":1168.467,"poster_path":"/2DyEk84XnbJEdPlGF43crxfdtHH.jpg","title":"Fast & Furious 10","video":false,"vote_average":0,"vote_count":0},{"adult":false,"backdrop_path":"/6FzuNrApEc71aJ3CwwkpadbNled.jpg","genre_ids":[28,35,80],"id":581644,"original_language":"en","original_title":"The Misfits","overview":"After being recruited by a group of unconventional thieves, renowned criminal Richard Pace finds himself caught up in an elaborate gold heist that promises to have far-reaching implications on his life and the lives of countless others.","popularity":1460.728,"poster_path":"/dPOyYnCkRbWAEem85N3VFpQODf5.jpg","release_date":"2021-06-10","title":"The Misfits","video":false,"vote_average":5.4,"vote_count":85}],"total_pages":500,"total_results":10000} \ No newline at end of file diff --git a/src/utils/notifier.js b/src/utils/notifier.js new file mode 100644 index 0000000..6540d55 --- /dev/null +++ b/src/utils/notifier.js @@ -0,0 +1,14 @@ +const notifier = require("node-notifier"); +const path = require("path") + +function notify(message){ + const imgPath = path.resolve(__dirname, '..') + "/img/nodejs.png" + notifier.notify({ + title: "NodeDB-CLI Noti", + message: message, + icon: imgPath, + contentImage: undefined + }); +} + +module.exports = notify; \ No newline at end of file diff --git a/src/utils/src/utils/movies/now-popular-movies.json b/src/utils/src/utils/movies/now-popular-movies.json new file mode 100644 index 0000000..07655c0 --- /dev/null +++ b/src/utils/src/utils/movies/now-popular-movies.json @@ -0,0 +1 @@ +{"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false} \ No newline at end of file diff --git a/src/utils/src/utils/persons/popular-persons.json b/src/utils/src/utils/persons/popular-persons.json new file mode 100644 index 0000000..07655c0 --- /dev/null +++ b/src/utils/src/utils/persons/popular-persons.json @@ -0,0 +1 @@ +{"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false} \ No newline at end of file