Skip to content

A Repository used to test deploy angular 2 projects on github.io

License

Notifications You must be signed in to change notification settings

eapostol/ng2-testdeploy

Repository files navigation

Viewing this site on Github.io

The site URL is shown at https://eapostol.github.io/ng2-testdeploy/

Angular 2 Test Deployment

This project was generated with angular-cli version 1.0.0-beta.28.3.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive/pipe/service/class/module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.

Deploying to GitHub Pages

Run ng github-pages:deploy to deploy to GitHub Pages.

Further help

To get more help on the angular-cli use ng help or go check out the Angular-CLI README.

A Repository used to test deploy angular 2 projects on github.io

Steps to Deploy on Github.io

You should test deploy a simple angular 2 CLI project to understand how deployment on github.io works. These are the steps that you can perform to test the process out. Once you test it. Then you can perform the same steps, starting at step 14 (assuming you have a project!) on your own project.

Create a repository on Github for your project. Again make sure the repo name is simple enough so that it can also be used as a directory name...for example

ra-ng2-testdeploy

Note your project name can be whatever is appropriate. Choose no .gitignore, and no license.

  1. Launch a terminal on your computer.
  2. Go to your directory where your projects are stored.
  3. At the terminal, in your projects directory, type

ng new ra-ng2-testdeploy

  1. Wait while your new Angular 2 project is created.
  2. Once its done, type at the terminal

cd ra-ng2-testdeploy

  1. At the terminal type npm start or ng serve and make sure your default website works as http://localhost:4200 in a web browser.

  2. At the terminal, press control-c to stop the server.

  3. At the terminal, type in the following commands followed by the enter key

git init

git add .

git commit -m "#001: first commit"

  1. In a web browser, return to your github repository for this project and copy the git url from the "clone or download" button. It should look something like:

https://github.com/eapostol/ng2-testdeploy.git

  1. Return to the terminal.
  2. At the terminal, type

git remote add origin https://github.com/eapostol/<yourprojectName>.git

where yourProjectName is the project name added in the URL e.g. ng2-testdeploy

  1. At the terminal type in the following commands:

git remote -v

git push -u origin master

git pull

If you have problems with push and pull, try

git branch --set-upstream-to=origin/master

git pull

git push -u origin master

You can then proceed to develop code for the project.

  1. Then at the terminal (when you are ready to deploy), type in the following at the terminal AND THIS IS IMPORTANT!

ng github-pages:deploy

  1. Once its deployed, browse to the resultant github.io address that is shown in the terminal. It likely says something like

Deployed! Visit https://eapostol.github.io//ra-ng2-testdeploy//

If you browse and the URL doesn't show anything...wait a few minutes, then try again. if it doesn't work still...

  1. Go back to terminal, type in

git branch -a

and confirm that there is a remote branch that looks like

remotes/origin/gh-pages

  1. Once you confirm that the remote branch exists, at the terminal switch to the github io branch...

git checkout gh-pages

  1. Open index.html in a text editor.

  2. In index.html, note the tag. It may say something like or something similar. change it to the base URL that matches the website address you are browsing to, for example.

  1. Commit or push your change to the remote repository using either git push at the terminal or use github desktop.

  2. Browse to the URL of your github.io project. For example.

https://eapostol.github.io/ng2-testdeploy/

  1. Don't forget to update your README.MD to reference the URL of your live site.

About

A Repository used to test deploy angular 2 projects on github.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published