A reliable JavaScript development framework for creating single-page apps is called Angular. The program was created and is maintained by Google and others from around the world.
However, comparing React vs. Angular, Angular allows you to build various front-end apps for the web, mobile devices, and desktop platforms, similar to React. Additionally, because Angular is comprehensive and reliable, various industries choose it.
Cloning and running a GitHub project locally will help you understand more about Angular.
Requirements For Cloning
Cloning and executing an Angular app is simple, in contrast to other frameworks. It will be a GitHub project that you clone. Make sure you satisfy the following prerequisites before you start:
- Node.js should be installed, and it should be a stable and secure version. If not, figure out how to set up Node.js on Windows or Ubuntu.
- You ought to have Git set up.
- Ā You must have an active GitHub account.
1. Get Node Package Manager installed
JavaScript packages can be found in the Node Package Manager (npm) software repository. The Command Line Interface (CLI) of npm is capable of carrying out a number of operations. The CLI can be used, for instance, to download, set up, and deploy the application.
The npm package is included with Node.js installation. Run the subsequent commands in the terminal to verify the versions of your Node.js and npm packages:
To check the Node.js version which is presently installed, use the command that comes after to print the version:
- nodeĀ –version
Employing the same method, you can determine npm’s version:
- npmĀ āversion
2. Setup the Angular CLI
Angular CLI can be used to carry out a variety of development operations. The activities involve creating, testing, as well as deploying applications. Run this command to setupĀ the Angular CLI:
- $ npm install -g @angular/cli
Run the following command to verify the CLI version of Angular:
- Ā $ ng version
3. GitHub Project Finder
The Giphy-Replica project will be copied from GitHub:
Scroll in the direction of the green “Code” button. A drop-down menu will appear when you click it. Take a copy of the SSH or HTTP link. Both of these will work.
4. Project Clone Locally
Make a folder first and call it Angular-Clone. Keep in mind to use the subsequent command to navigate to the folder:
- cd Angular-Clone
The project will then be copied to your folder once you execute the command for git clone.
- Ā gitĀ cloneĀ https://github.com/Reuben-Kipkemboi/Giphy-Replica.git
Next, examine if the Giphy-Replica clone is present in the Angular-Clone folder. To see the contents of the folder, use the following:
- Ā ls
Go to the folder:
- cd Giphy-Replica
At this moment, you have the option of viewing the files of the project through the GitHub web interface or inspecting them in the editor of the code of your preference.
5. Set up npm Packages
To start the cloned project, you must install all of the packages as well as dependencies from it. In order to set up the npm packages, carry out these steps:
- Ā npmĀ install
If you come across any reports regarding vulnerability, address them as follows:
- npm audit fix
6. Launch the project in a web browser.
You now have everything you need to finish the project. It may be launched and accessed with a web browser. Build and serve the project first:
- ng serve
Then launch a browser and navigate to http://localhost:4200/ to see the project.
UtilizeĀ the Angular CLI to have the project launched in a browser on demand:
- Ā $ ng serve -o
The server is started, the app is built, and the command keeps an eye on the updates of files.
You must look at the Giphy-Replica page in your browser:
Why Clone a Project in Angular?
You can be able to clone an existing project from GitHub rather than starting from scratch. This is because it takes less time to copy a project, which is open-source, and customize it for your needs than to start from scratch. If applicable, you can add any beneficial modifications to the upstream project.
In 2021 Angular, which was ranked as the 4th most widely used front-end development framework, never ceases to astound. It has excellent tools that facilitate the creation of single-page apps. Use this fantastic framework to create apps of the highest caliber.