This programmer needs re-training. Angular + GitHub

Crazy Diamond

Ars Tribunus Angusticlavius
8,175
My team has been tasked with creating a new web UI using Angular 6 and GitHub as source control (an enterprise installation of GitHub, not the public one).

Although it is not really relevant to this discussion, the web UI is to replace a .Net WebForm UI that was initially built in 2004 and updated since (there are microservices using WebApi that serve the data objects).

Since at least 2008, all of this code has been in TFS, so I have not had the need to use Git or anything similar. Just TFS.

I'm finding it hard to figure out the best way to create a totally new Angular 6 app, and to put it into a totally new GitHub repository. The reason I'm not using TFS for this is due to multiple reasons, but suffice it to say that the enterprise direction is NOT TFS and the tools to deploy from GitHub in our enterprise already exist.

If I go through Angular tutorials, there is an assumption that you "just know Git." When I search Google for "angular with git" I find articles that talk about deploying code to GitHub (which makes me question my understanding of Git).

I tried creating a new repository, and then "checking in" my new angular app, and it does seem to check in, and you can browse the code on our github site. But when another user downloads the code (clone?) and tries to run it, it fails due to missing node_modules directory.

So again, I question whether or not I understand the proper way of doing team development of an angular app using GitHub. (We are going to use VS Code as the IDE).

Can anyone provide some pointers or resources that will speed up my understanding of this?
 

MarkLT1

Ars Tribunus Militum
1,615
Subscriptor
After checking out the repo, the dev needs to issue the command

Code:
npm install

From the command line in order to install all necessary packages to compile/run the angular app.

Typically node_modules is excluded from the git repo as you don’t want to be including a bunch of third party code in your repo when npm install wil go grab the necessary code for you.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,343
Subscriptor++
May also be desirable to use the VS Code npm extension. I don't use Code so I'm not sure how it differs (if at all) from the full VS implementation. Having right click access to (re)installing node packages is quite nice.
VS Code and VS are two totally different applications with no relation to each other beyond name. That said, I am pretty sure that VS code does have some nice extensions for handling npm and node.

As for the installation bit, it has to be done on every clone independently. You should probably write the instructions for setup into the readme.md file.
 
When I started listening looking into React I felt the same way. The beginner tutorials are awful because they either want to gloss over everything, and most of the deep dive still don't explain things.

Learn git. (It's a good skill anyway)
Do multiple tutorial stuff for basics of Angular ( even an old version can help with understand why the changes).
Build a toy project. (Independent of the tutorials)

Then start the design work on what your trying to replace / upgrade.
 

krimhorn

Ars Legatus Legionis
39,865
May also be desirable to use the VS Code npm extension. I don't use Code so I'm not sure how it differs (if at all) from the full VS implementation. Having right click access to (re)installing node packages is quite nice.
VS Code and VS are two totally different applications with no relation to each other beyond name. That said, I am pretty sure that VS code does have some nice extensions for handling npm and node.
Yes, I am aware. That's why I linked the VS Code extension and mentioned I'm not sure if it does things in the same way the VS support does. Worth it to try out though, IMO.
 

Crazy Diamond

Ars Tribunus Angusticlavius
8,175
After checking out the repo, the dev needs to issue the command

Code:
npm install

From the command line in order to install all necessary packages to compile/run the angular app.

Typically node_modules is excluded from the git repo as you don’t want to be including a bunch of third party code in your repo when npm install wil go grab the necessary code for you.

Ok, that makes sense to me now. My searching did lead me down the path of running npm install afterwards, but it didn't exactly feel right.

I've went through the Angular 6 book, so I have a working knowledge of it for now.
 

fatimid08

Wise, Aged Ars Veteran
130
Since there is some struggle with git and npm in addition to Angular, I think it would be worth breaking down into steps:

1. Learn about Git https://git-scm.com/book/en/v2 . Consider GitHub as just a git repository with rudimentary issue-tracking and code review tools built-in.
2. Learn about package management in JS land (aka npm) https://docs.npmjs.com/getting-started/what-is-npm
3. Learn about Angular https://angular.io/guide/quickstart

Most tutorials out there assume you know git and npm to some extent, so it's good to review them separately first.

I recommend a few extensions in VSCode to help your development flow:
- GitLens
- TSLint
- Angular Language Service
- Angular Schematics

If you want to debug inside VSCode directly instead of the browser, you can also follow https://github.com/Microsoft/vscode-rec ... ngular-CLI
 

Jehos

Ars Legatus Legionis
55,560
Some Git links:

Understanding Git Conceptually - really recommend you start here. Git is a VERY different beast from TFS, and it takes a while to grok the decentralized, peer-to-peer nature of git. I still struggle with it when I use it for personal stuff because we use TFS at work, so I'm used to centralized source control. What re-centers me in git is remembering that you have your own local repository that may or may not be linked to another repo somewhere (like your GitHub server). You check your changes into your own repo as often as you want, then push (or pull request) the change set to the shared server so others can pull it.

git - the simple guide - nuts and bolts commands you'll commonly use.

Git happens! 6 Common Git Mistakes and How To Fix Them - note, probably don't do the reflog thing without consent from your peers.
 

Action Attack Goose

Wise, Aged Ars Veteran
154
Subscriptor++
Some Git links:

Understanding Git Conceptually - really recommend you start here. Git is a VERY different beast from TFS, and it takes a while to grok the decentralized, peer-to-peer nature of git. I still struggle with it when I use it for personal stuff because we use TFS at work, so I'm used to centralized source control. What re-centers me in git is remembering that you have your own local repository that may or may not be linked to another repo somewhere (like your GitHub server). You check your changes into your own repo as often as you want, then push (or pull request) the change set to the shared server so others can pull it.

git - the simple guide - nuts and bolts commands you'll commonly use.

Git happens! 6 Common Git Mistakes and How To Fix Them - note, probably don't do the reflog thing without consent from your peers.

That primer link is super handy, thanks.