Skip to content

:shipit: Wrapper around gh-pages, made for angular-cli users. Publish to any gh-pages branch on GitHub (or any other branch on any other remote). Available on NPM.

Notifications You must be signed in to change notification settings

wingsuitist/angular-cli-ghpages

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-cli-ghpages

NPM version


Screenshot


This was an angular CLI addon (until they removed addon support). Now it's just a wrapper around tschaub/gh-pages.

Publish to any gh-pages branch on GitHub (or any other branch on any other remote).
Made for Travis-CI. Brought to you by the angular-buch.com team!

About

This script is similar to the normal github-pages:deploy command. But by design, the command is limited to the gh-pages branch of the same repository.
New: The deploy command is being removed from the core of the CLI very soon! #4385

In contrast to this, the angular-buch/angular-cli-ghpages script is able to push to any branch on any repository. It's made on top of tschaub/gh-pages. This script works great on Travis-CI. No git credentials must be set up in before. Specific environment variables of Travis-CI are evaluated, too. You will like it!

Installation & Setup

This addon has the following prerequisites:

  • Node.js 4.x
  • Git 1.7.6 or higher
  • Optional: Angular project created via angular-cli

To install this addon run the following command:

npm i -g angular-cli-ghpages

Usage

Execute angular-cli-ghpages in order to deploy the project with a build from dist folder.
Note: you have to create the dist folder in before (e.g. ng build --prod)

Usage:

ng build
angular-cli-ghpages [OPTIONS]

there is also a shorter ngh command available

ng build
ngh [OPTIONS]

If you want to push to gh-pages on the same repository with your default credentials, then just enter ngh without any options.

Options

  • optional
  • default: url of the origin remote of the current dir (assumes a git repository)

By default, gh-pages assumes that the current working directory is a git repository, and that you want to push changes to the origin remote. If instead your script is not in a git repository, or if you want to push to another repository, you can provide the repository URL in the repo option.

  • optional
  • default: Auto-generated commit

The commit message, must be wrapped in quotes.
Some handy additional text is always added, if the environment variable process.env.TRAVIS exists (for Travis CI).

Example:

angular-cli-ghpages --message="What could possibly go wrong?"
  • optional
  • default: gh-pages

The name of the branch you'll be pushing to. The default uses GitHub's gh-pages branch, but this can be configured to push to any branch on any remote.

  • optional
  • default: value of git config user.name and git config user.email

If you are running the command in a repository without a user.name or user.email git config properties (or on a machine without these global config properties), you must provide user info before git allows you to commit. In this case provide both name and email string values to identify the committer.

  • optional
  • default: true (boolean)

Suppress logging. With silent true log messages are suppressed and error messages are sanitized.

This option should be used if the repository URL or other information passed to git commands is sensitive and should not be logged (== you have a public build server). By default the silent mode is enabled to avoid sensitive data exposure.

  • optional
  • default: dist

Directory for all published sources, relative to the project-root.
Most probably no change is required here. This option can be used to deploy completely different folders, which are not related at all to angular.

  • optional
  • default: true (boolean)

Includes dotfiles by default. When set to false files starting with . are ignored.

Extra

For your convenience, the addon will recognize the environment variable GH_TOKEN and will replace this pattern in the --repo string. Please do NOT disable the silent mode if you have any credentials in the repository URL! Read more about Github tokens here.

In example, the following command runs on our Travis-CI:

angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected]

You have to treat the GH_TOKEN as secure as a password!

About the 404 page (specific to github pages only)

The old github-pages:deploy command created a 404.html file in the dist folder. This was required to fully support the router PathLocationStrategy. Right now you have to copy index.html to 404.html on your own. Please submit an issue if you really want this feature back.

Example:

ng build
cp dist/index.html dist/404.html
angular-cli-ghpages [OPTIONS]

License

Code released under the MIT license.

About

:shipit: Wrapper around gh-pages, made for angular-cli users. Publish to any gh-pages branch on GitHub (or any other branch on any other remote). Available on NPM.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%