Skip to content

Commit 750823b

Browse files
Update README - npx ngh
avoids global installation FYI @fmalcher
1 parent 98ce574 commit 750823b

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

README.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
Publish to any gh-pages branch on GitHub (or any other branch on any other remote).
1111
Made for angular-cli users.
12-
Made with Travis-CI in mind.
12+
Made with Travis CI, CircleCi and Co. in mind.
1313
Brought to you by the [angular.schule](https://angular.schule/) team!
1414

1515
## About
1616

1717
This command is similar to the old `github-pages:deploy` command of @angular/cli which was removed in [#4385](https://github.com/angular/angular-cli/pull/4385).
1818
The [angular-cli-ghpages](https://github.com/angular-schule/angular-cli-ghpages) command is able to push to any branch on any repository. It's made on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages).
19-
**This script works great on [Travis-CI](https://travis-ci.org/).** No git credentials must be set up in before. Specific environment variables of Travis-CI are evaluated, too. You will like it!
19+
**This script works great on Travis CI and CircleCi.** No git credentials must be set up in before. Specific environment variables of Travis-CI are evaluated, too. You will like it!
2020

2121
## Changelog
2222

@@ -27,49 +27,43 @@ A detailed changelog is available in the [releases](https://github.com/angular-s
2727

2828
This command has the following prerequisites:
2929

30-
- Node.js 4.x
30+
- `Node.js 8.2.0` or higher which brings you `npm 5.2.0` which brings you [`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b)
3131
- Git 1.7.6 or higher
3232
- __optional__: Angular project created via [angular-cli](https://github.com/angular/angular-cli)
3333

3434
To install the command run the following:
3535

3636
```bash
37-
npm i -g angular-cli-ghpages
37+
npm i angular-cli-ghpages --save-dev
3838
```
3939

4040
## Usage
4141

42-
Execute `angular-cli-ghpages` in order to deploy the project with a build from `dist` folder.
42+
Execute `npx ngh` in order to deploy the project with a build from `dist` folder.
4343
__Note: you have to create the `dist` folder in before (e.g. `ng build --prod`)__
4444

4545
Usage:
4646

4747
```bash
4848
ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY_NAME/"
49-
angular-cli-ghpages [OPTIONS]
49+
npx ngh [OPTIONS]
5050
```
5151

5252
or
5353

5454
```bash
5555
ng build --prod --base-href "/REPOSITORY_NAME/"
56-
angular-cli-ghpages [OPTIONS]
56+
npx ngh [OPTIONS]
5757
```
5858

5959
or (`<base href="">` stays untouched)
6060

6161
```bash
6262
ng build --prod
63-
angular-cli-ghpages [OPTIONS]
63+
npx ngh [OPTIONS]
6464
```
6565

66-
there is also a shorter `ngh` command available
67-
68-
```bash
69-
ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
70-
ngh [OPTIONS]
71-
```
72-
If you want to push to `gh-pages` on the same repository with your default credentials, then just enter `ngh` without any options.
66+
If you want to push to `gh-pages` on the same repository with your default credentials, then just enter `npx ngh` without any options.
7367

7468

7569
### Usage with Angular CLI 6 or higher
@@ -79,7 +73,7 @@ Please take a look at the `dist` folder to see whether there is a subfolder with
7973
If yes, you need to specify the deploy directory manually then when using this tool:
8074

8175
```bash
82-
ngh --dir dist/[PROJECTNAME]
76+
npx ngh --dir dist/[PROJECTNAME]
8377
```
8478

8579
I most cases, the `[PROJECTNAME]` can be found in the `angular.json` file at `defaultProject`.
@@ -94,7 +88,7 @@ For your convenience, the command will recognize the [environment variable](http
9488
In example, the following command runs [on our Travis-CI](https://travis-ci.org/angular-buch/book-monkey2):
9589

9690
```bash
97-
angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected]
91+
npx ngh --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected]
9892
```
9993
> You have to treat the GH_TOKEN as secure as a password!
10094
@@ -103,21 +97,21 @@ angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.gi
10397
## Options
10498

10599
#### <a id="help">--help</a>
106-
* Example: `ngh --help`
100+
* Example: `npx ngh --help`
107101

108102
Output usage information.
109103

110104

111105
#### <a id="version">--version</a>
112-
* Example: `ngh --version`
106+
* Example: `npx ngh --version`
113107

114108
Output the version number. Please provide the version number on any bug report!
115109

116110

117111
#### <a id="repo">--repo</a>
118112
* __optional__
119113
* Default: url of the origin remote of the current dir (assumes a git repository)
120-
* Example: `ngh --repo=https://[email protected]/organisation/your-repo.git`
114+
* Example: `npx ngh --repo=https://[email protected]/organisation/your-repo.git`
121115

122116
By default, __gh-pages__ assumes that the current working directory is a git repository,
123117
and that you want to push changes to the `origin` remote.
@@ -128,7 +122,7 @@ you can provide the repository URL in the `repo` option.
128122
#### <a id="message">--message</a>
129123
* __optional__
130124
* Default: `Auto-generated commit`
131-
* Example: `ngh --message="What could possibly go wrong?"`
125+
* Example: `npx ngh --message="What could possibly go wrong?"`
132126

133127
The commit message, __must be wrapped in quotes__.
134128
Some handy additional text is always added,
@@ -138,7 +132,7 @@ if the environment variable `process.env.TRAVIS` exists (for Travis CI).
138132
#### <a id="branch">--branch</a>
139133
* __optional__
140134
* Default: `gh-pages`
141-
* Example: `ngh --branch=other-branch`
135+
* Example: `npx ngh --branch=other-branch`
142136

143137
The name of the branch you'll be pushing to.
144138
The default uses GitHub's `gh-pages` branch,
@@ -148,7 +142,7 @@ but this can be configured to push to any branch on any remote.
148142
#### <a id="name">--name & --email</a>
149143
* __optional__
150144
* Default: value of `git config user.name` and `git config user.email`
151-
* Example: `ngh --name="Displayed Username" [email protected]`
145+
* Example: `npx ngh --name="Displayed Username" [email protected]`
152146

153147
If you are running the command in a repository without a `user.name` or `user.email` git config properties
154148
(or on a machine without these global config properties),
@@ -160,8 +154,8 @@ In this case provide both `name` and `email` string values to identify the commi
160154
* __optional__
161155
* Default: silent `true` (boolean)
162156
* Example:
163-
* `ngh` -- Logging is in silent mode by default.
164-
* `ngh --no-silent` -- Logging shows extended information.
157+
* `npx ngh` -- Logging is in silent mode by default.
158+
* `npx ngh --no-silent` -- Logging shows extended information.
165159

166160
Logging is in silent mode by default.
167161
In silent mode log messages are suppressed and error messages are sanitized.
@@ -187,8 +181,8 @@ which are not related at all to angular.
187181
* __optional__
188182
* Default: dotfiles `true` (boolean)
189183
* Example:
190-
* `ngh` -- Dotfiles are included by default.
191-
* `ngh --no-dotfiles` -- Dotfiles are ignored.
184+
* `npx ngh` -- Dotfiles are included by default.
185+
* `npx ngh --no-dotfiles` -- Dotfiles are ignored.
192186

193187
The command includes dotfiles by default (e.g `.htaccess` will be committed)
194188
With `--no-dotfiles` files starting with `.` are ignored.
@@ -199,8 +193,8 @@ With `--no-dotfiles` files starting with `.` are ignored.
199193
* __optional__
200194
* Default: `undefined`
201195
* Example:
202-
* `ngh` -- Normal behaviour: Changes are applied.
203-
* `ngh --dry-run` -- No changes are applied at all.
196+
* `npx ngh` -- Normal behaviour: Changes are applied.
197+
* `npx ngh --dry-run` -- No changes are applied at all.
204198

205199
Run through without making any changes. This can be very usefull, because it outputs what would happend without doing anything.
206200

0 commit comments

Comments
 (0)