Angular CLI – Local Branch Compiling for Mac Users
If you want to find out how to compile a local branch (using a LAN IP address) to access it from any device, you’ve come to the right place.
This method of compiling is used for Web projects based on Angular CLI. It uses the WiFi router’s IP address to access a specific branch with any device connected to it.
We’ve all been in a position when a nasty bug appeared right before launching a new version of the project. When that happens, it hits the pause button for an indefinite amount of time.
Q: How better to solve the bug if not by using a branch?
Q: How to know if the bug was fixed before merging it?
A: with the help of a tester who knows how to compile a branch and get their hands dirty.
We’re here to pass on useful tips and tricks we’ve learned along the way. They’ve been a great help, and we hope they’ll come in handy for you too!
1. The project needs to be cloned locally. For this, use the “git clone” command in the terminal and add the project link (git clone + link).
2. Access the project folder in the terminal and use the command “git checkout” + the desired branch to access the local branch.
3. Before serving the branch, find the WiFi router IP address. It’s in the System Preferences / Network / Advanced / “TCP/IP” / IPv4 Address.
4. Changed the project environment with the following API: https://IPv4 Address:4200/api
*The environment API location depends on the project.
5. Compile the branch using the following command: ng serve –host IPv4 Address –port 4200 –ssl
*Where the –ssl command encrypts the communication between the git clients and the git server using the https protocol.
6. After the branch is compiled successfully, it can be accessed by any device connected to the same LAN. In the browser, add the URL: https://IPv4 Address:4200/api
Note: After entering the URL, the error “Your connection is not private” will show. Use the advanced button to proceed to the entered URL.
More about local branch compiling and our services here: