Skip to content

Commit 737f07f

Browse files
committed
updating to newest angular-cli
1 parent 0fc6101 commit 737f07f

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

README.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ But by design, the command is limited to the `gh-pages` branch of the same repos
1818
In contrast to this, the [Angular2Buch/angular-cli-ghpages](https://github.com/Angular2Buch/angular-cli-ghpages) addon is able to push to any branch on any repository. It's build on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages).
1919
__This addon 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!
2020

21+
angular-cli-ghpages was successfully tested against `angular-cli: 1.0.0-beta.11-webpack.2`.
22+
23+
2124
## Installation & Setup
2225

2326
This addon has the following prerequisites:
@@ -90,8 +93,8 @@ Suppress logging. With silent `true` log messages are suppressed and error messa
9093
* optional
9194
* default: `dist`
9295

93-
Directory for all sources, relative to the project-root.
94-
Most probably no change is required here, usefull together with --skip-build.
96+
Directory for all published sources, relative to the project-root.
97+
Most probably no change is required here, useful together with --skip-build.
9598
This option can be used to deploy completely different folders, which are note related at all to angular.
9699

97100

@@ -100,26 +103,33 @@ This option can be used to deploy completely different folders, which are note r
100103
* default: `production`
101104

102105
The Angular environment to create a build for.
106+
The build artifacts are always placed into the path `dist/`.
107+
The option `--dir` has no effect on the output path.
103108

104109

105110
#### <a id="skip-build">--skip-build</a>
106111
* optional
107112
* default: `false` (boolean)
108113

109-
Skip building the project before deploying, usefull together with --dir.
114+
Skip building the project before deploying, useful together with --dir.
115+
110116

111117

118+
#### <a id="dotfiles">--dotfiles</a>
119+
* optional
120+
* default: `true` (boolean)
121+
122+
Includes dotfiles by default. When set to `false` files starting with `.` are ignored.
112123

113124

114125

115126
## Extra
116127

117-
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 credentials in the repository URL! Read more about [Github tokens here](https://help.github.com/articles/creating-an-access-token-for-command-line-use/).
128+
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/).
118129

119130
In example, the following command runs [on our Travis-CI](https://travis-ci.org/Angular2Buch/book-monkey2):
120131

121132
```sh
122-
ng build --environment=production
123133
ng ghpages --repo=https://[email protected]/organisation/your-repo.git --name="Displayed Username" [email protected]
124134
```
125135
> You have to treat the GH_TOKEN as secure as a password!

deploy.js

+21-11
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = Command.extend({
4848
name: 'dir',
4949
type: String,
5050
default: 'dist',
51-
description: 'Directory for all sources, relative to the project-root. Most probably no change is required here.'
51+
description: 'Directory for all published sources, relative to the project-root. Most probably no change is required here.'
5252
}, {
5353
name: 'environment',
5454
type: String,
@@ -58,7 +58,12 @@ module.exports = Command.extend({
5858
name: 'skip-build',
5959
type: Boolean,
6060
default: false,
61-
description: 'Skip building the project before deploying, usefull together with --dir'
61+
description: 'Skip building the project before deploying, useful together with --dir'
62+
}, {
63+
name: 'dotfiles',
64+
type: Boolean,
65+
default: true,
66+
description: 'Includes dotfiles by default. When set to `false` files starting with `.` are ignored.'
6267
}],
6368
run: function(options, rawArgs) {
6469

@@ -73,8 +78,20 @@ module.exports = Command.extend({
7378
email: options['email']
7479
}
7580
};
76-
options.dotfiles = true;
81+
82+
// gh-pages: forwards messages to ui
7783
options.logger = function(message) { ui.write(message + "\n"); }
84+
85+
var buildTask = new BuildTask({
86+
ui: this.ui,
87+
analytics: this.analytics,
88+
project: this.project
89+
});
90+
91+
var buildOptions = {
92+
environment: options.environment,
93+
outputPath: 'dist/'
94+
};
7895

7996
if (process.env.TRAVIS) {
8097
options.message += '\n\n' +
@@ -95,14 +112,7 @@ module.exports = Command.extend({
95112
var publish = Promise.denodeify(ghpages.publish);
96113

97114
function build() {
98-
if (options.skipBuild) return Promise.resolve();
99-
100-
var buildTask = new BuildTask({
101-
ui: this.ui,
102-
analytics: this.analytics,
103-
project: this.project
104-
});
105-
115+
if (options.skipBuild) return Promise.resolve();
106116
return buildTask.run(buildOptions);
107117
}
108118

0 commit comments

Comments
 (0)