Giter Site home page Giter Site logo

ardavankhalij / npm-packages-dependencies Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 61 KB

This project is the first assignment of software architecture in Vrije Universiteit Brussel, and it is under the supervision of Dr. Coen De Roover, Mr. Camilo Velazquez, and Mr. Ahmed Zerouali.

Scala 100.00%
scala akka akka-stream graphdsl vrije-universiteit-brussel

npm-packages-dependencies's Introduction

NPM-Packages-Dependencies

This project is the first assignment of software architecture in Vrije Universiteit Brussel, and it is under the supervision of Dr. Coen De Roover, Mr. Camilo Velazquez, and Mr. Ahmed Zerouali.

In this project, I got help from solutions of the WPO exercises and also AKKA Stream documentations.

I comment as much as possible to be clear in the code, and I hope this report and the comments would be enough explanation.

At first, I made an object and extended it with App to put the main code in it. Then I started with preparing the resource to be ready for the process. The resource file was zipped, so the first step was to unzip the file. After that, I converted the Bytestring type to string, and then because there was a NPM package name in every single line, I separated the main string and put each line in an Item of a list.

After making the source to a suitable format, I created a case class called Package. Package has for fields:

  1. Name (A String).
  2. Version (A ListBuffer of String).
  3. Dependencies (A ListBuffer of Int).
  4. DevDependencies (A ListBuffer of Int).

This case class also contains three methods:

  1. get_json_and_versions: Gets all of the versions of a NPM package.
  2. get_dependencies: Gets the number of dependencies of each version of a NPM package.
  3. get_dev_dependencies: Gets the number of devDependencies of each version of a NPM package.

After defining the case class, I converted the String type to Package type and instantiated it with the Package's name.

After that, I use a flow to get the versions with the get_json_and_versions method and two other separate flows for getting dependencies and devDependencies with get_dependencies get_dev_dependencies methods.

Two other flows are buffer and request limiter. Buffer is obvious, and request limiter is for sending a request every 3 seconds. After having all the flows, I made the graph the way it was in the picture in the assignment:

  1. Making a pipeline by using Broadcast and Zip. I made them as a flow as well to use them in the runnableGraph part.
  2. Making two parallel pipelines with Balance and Merge. I made them as a flow as well to use them in the runnableGraph part.

In the end, I use these flows to have a result in my Sink flow. The input of Sink flow is a duple of Packages, so I make the printing format in a way that has a suitable output. After that, I run the runnableGraph.

I should mention that prepareDataForTheNextSteps flow is a flow that is doing everything before getting the dependencies.

You can see the diagram of my code down below:

Untitled Diagram drawio-2

npm-packages-dependencies's People

Contributors

ardavankhalij avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.