Skip to content

Commit 4fb4eca

Browse files
committed
BREAKING CHANGE: broken --silent / --dotfiles feature is replace by --no-silent and --no-dotfiles
fixes angular-schule#6
1 parent b55a03e commit 4fb4eca

File tree

4 files changed

+98
-60
lines changed

4 files changed

+98
-60
lines changed

Diff for: README.md

+93-50
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,29 @@
77

88
<hr>
99

10-
This __was__ an angular CLI addon (until they [removed addon support](https://github.com/angular/angular-cli/pull/3695)).
11-
Now it's just a wrapper around [tschaub/gh-pages](https://github.com/tschaub/gh-pages).
12-
1310
Publish to any gh-pages branch on GitHub (or any other branch on any other remote).
14-
Made for Travis-CI. Brought to you by the [angular-buch.com](https://angular-buch.com/) team!
11+
Made for angular-cli users.
12+
Made with Travis-CI in mind.
13+
Brought to you by the [angular-buch.com](https://angular-buch.com/) team!
1514

1615
## About
1716

18-
This script is similar to the normal `github-pages:deploy` command.
19-
But by design, the command is limited to the `gh-pages` branch of the same repository.
20-
__New: The deploy command is being removed from the core of the CLI very soon! [#4385](https://github.com/angular/angular-cli/pull/4385)__
21-
22-
23-
In contrast to this, the [angular-buch/angular-cli-ghpages](https://github.com/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](https://github.com/tschaub/gh-pages).
24-
__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!
17+
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).
18+
The [angular-cli-ghpages](https://github.com/angular-buch/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!
2520

2621

2722
## Installation & Setup
2823

29-
This addon has the following prerequisites:
24+
This command has the following prerequisites:
3025

3126
- Node.js 4.x
3227
- Git 1.7.6 or higher
33-
- Optional: Angular project created via [angular-cli](https://github.com/angular/angular-cli)
28+
- __optional__: Angular project created via [angular-cli](https://github.com/angular/angular-cli)
3429

35-
To install this addon run the following command:
30+
To install the command run the following:
3631

37-
```sh
32+
```bash
3833
npm i -g angular-cli-ghpages
3934
```
4035

@@ -45,14 +40,14 @@ __Note: you have to create the `dist` folder in before (e.g. `ng build --prod`)
4540

4641
Usage:
4742

48-
```sh
43+
```bash
4944
ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
5045
angular-cli-ghpages [OPTIONS]
5146
```
5247

5348
there is also a shorter `ngh` command available
5449

55-
```sh
50+
```bash
5651
ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
5752
ngh [OPTIONS]
5853
```
@@ -61,73 +56,106 @@ If you want to push to `gh-pages` on the same repository with your default crede
6156

6257
## Options
6358

59+
60+
#### <a id="help">--help</a>
61+
* Example: `ngh --help`
62+
63+
Output usage information.
64+
65+
66+
#### <a id="version">--version</a>
67+
* Example: `ngh --version`
68+
69+
Output the version number. Please provide the version number on any bug report!
70+
71+
6472
#### <a id="repo">--repo</a>
65-
* optional
66-
* default: url of the origin remote of the current dir (assumes a git repository)
73+
* __optional__
74+
* Default: url of the origin remote of the current dir (assumes a git repository)
75+
* Example: `ngh --repo=https://[email protected]/organisation/your-repo.git`
76+
77+
By default, __gh-pages__ assumes that the current working directory is a git repository,
78+
and that you want to push changes to the `origin` remote.
79+
If instead your files are not in a git repository, or if you want to push to another repository,
80+
you can provide the repository URL in the `repo` option.
6781

68-
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.
6982

7083
#### <a id="message">--message</a>
71-
* optional
72-
* default: `Auto-generated commit`
84+
* __optional__
85+
* Default: `Auto-generated commit`
86+
* Example: `ngh --message="What could possibly go wrong?"`
7387

7488
The commit message, __must be wrapped in quotes__.
75-
Some handy additional text is always added, if the environment variable `process.env.TRAVIS` exists (for Travis CI).
76-
77-
Example:
78-
```sh
79-
angular-cli-ghpages --message="What could possibly go wrong?"
80-
```
89+
Some handy additional text is always added,
90+
if the environment variable `process.env.TRAVIS` exists (for Travis CI).
8191

8292

8393
#### <a id="branch">--branch</a>
84-
* optional
85-
* default: `gh-pages`
94+
* __optional__
95+
* Default: `gh-pages`
96+
* Example: `ngh --branch=other-branch`
8697

87-
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.
98+
The name of the branch you'll be pushing to.
99+
The default uses GitHub's `gh-pages` branch,
100+
but this can be configured to push to any branch on any remote.
88101

89102

90103
#### <a id="name">--name & --email</a>
91-
* optional
92-
* default: value of `git config user.name` and `git config user.email`
104+
* __optional__
105+
* Default: value of `git config user.name` and `git config user.email`
106+
* Example: `ngh --name="Displayed Username" [email protected]`
93107

94-
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.
108+
If you are running the command in a repository without a `user.name` or `user.email` git config properties
109+
(or on a machine without these global config properties),
110+
you must provide user info before git allows you to commit.
111+
In this case provide both `name` and `email` string values to identify the committer.
95112

96113

97-
#### <a id="silent">--silent</a>
98-
* optional
99-
* default: `true` (boolean)
114+
#### <a id="no-silent">--no-silent</a>
115+
* __optional__
116+
* Default: silent `true` (boolean)
117+
* Example:
118+
* `ngh` -- Logging is in silent mode by default.
119+
* `ngh --no-silent` -- Logging shows extended information.
100120

101-
Suppress logging. With silent `true` log messages are suppressed and error messages are sanitized.
121+
Logging is in silent mode by default.
122+
In silent mode log messages are suppressed and error messages are sanitized.
102123

103-
> 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.
124+
The `--no-silent` option enables extended console logging.
125+
Keep this untouched if the repository URL or other information passed to git commands is sensitive!
126+
127+
> WARNING: This option should kept like it is 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.
104128
105129

106130
#### <a id="dir">--dir</a>
107-
* optional
108-
* default: `dist`
131+
* __optional__
132+
* Default: `dist`
109133

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

115139

116-
#### <a id="dotfiles">--dotfiles</a>
117-
* optional
118-
* default: `true` (boolean)
119140

120-
Includes dotfiles by default. When set to `false` files starting with `.` are ignored.
141+
#### <a id="no-dotfiles">--no-dotfiles</a>
142+
* __optional__
143+
* Default: dotfiles `true` (boolean)
144+
* Example:
145+
* `ngh` -- Dotfiles are included by default.
146+
* `ngh --no-dotfiles` -- Dotfiles are ignored.
121147

148+
The command includes dotfiles by default (e.g `.htaccess` will be committed)
149+
With `--no-dotfiles` files starting with `.` are ignored.
122150

123151

124152
## Extra
125153

126-
For your convenience, the addon will recognize the [environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) `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](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
154+
For your convenience, the command will recognize the [environment variable](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) `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](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
127155

128156
In example, the following command runs [on our Travis-CI](https://travis-ci.org/angular-buch/book-monkey2):
129157

130-
```sh
158+
```bash
131159
angular-cli-ghpages --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected]
132160
```
133161
> You have to treat the GH_TOKEN as secure as a password!
@@ -141,13 +169,28 @@ Right now you have to copy `index.html` to `404.html` on your own.
141169
Please submit an [issue](https://github.com/angular-buch/angular-cli-ghpages/issues) if you really want this feature back.
142170

143171
Example:
144-
```sh
172+
```bash
145173
ng build
146174
cp dist/index.html dist/404.html
147175
angular-cli-ghpages [OPTIONS]
148176
```
149177

150178

179+
## Development Hints for hacking on angular-cli-ghpages
180+
181+
```bash
182+
git clone https://github.com/angular-buch/angular-cli-ghpages.git
183+
cd angular-cli-ghpages
184+
npm link
185+
```
186+
187+
`npm link` is very similar to `npm install -g` except that instead of downloading the package
188+
from the NPM repo, the just cloned `angular-cli-ghpages/` folder becomes the global package.
189+
190+
Now you can use `ngh` via the command line.
191+
Please read the official [npm-link documentation](https://www.npmjs.org/doc/cli/npm-link.html)
192+
and the [npm-link cheatsheet](http://browsenpm.org/help#linkinganynpmpackagelocally) for more information.
193+
151194
## License
152195
Code released under the [MIT license](https://opensource.org/licenses/MIT).
153196

Diff for: bin/angular-cli-ghpages

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ program
1313
.option('-b, --branch <branch>', 'The git branch to push your pages to.', 'gh-pages')
1414
.option('-n, --name <name>', 'The git user-name which is associated with this commit.')
1515
.option('-e, --email <email>', 'The git user-email which is associated with this commit')
16-
.option('-x, --silent', 'Suppress console logging. This option should be used if the repository URL or other information passed to git commands is sensitive! Default: true')
17-
.option('-t, --dotfiles', 'Includes dotfiles by default. When set to `false` files starting with `.` are ignored. Default: true')
16+
.option('-S, --no-silent', 'Logging is in silent mode by default. The option enables extended console logging. Keep this untouched if the repository URL or other information passed to git commands is sensitive!')
17+
.option('-T, --no-dotfiles', 'Includes dotfiles by default. When set files starting with `.` are ignored.')
1818
.parse(process.argv);
1919

2020
index.run(program);

Diff for: index.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ exports.run = function (options) {
77

88
options = options || {};
99

10-
if (options.silent === undefined) {
11-
options.silent = true;
12-
}
13-
14-
if (options.dotfiles === undefined) {
15-
options.dotfiles = true;
16-
}
10+
//console.log('SILENT:', options.silent);
11+
//console.log('DOTFILES:', options.dotfiles);
1712

1813
if (options['name'] && options['email']) {
1914
options.user = {

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-cli-ghpages",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"description": "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).",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)