File tree 1 file changed +15
-0
lines changed
packages/angular-cli/commands
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,7 @@ const githubPagesDeployCommand = Command.extend({
147
147
. then ( saveStartingBranchName )
148
148
. then ( createGitHubRepoIfNeeded )
149
149
. then ( checkoutGhPages )
150
+ . then ( cleanGhPagesBranch )
150
151
. then ( copyFiles )
151
152
. then ( createNotFoundPage )
152
153
. then ( addAndCommit )
@@ -205,6 +206,20 @@ const githubPagesDeployCommand = Command.extend({
205
206
. then ( ( ) => execPromise ( `git commit -m \"initial ${ ghPagesBranch } commit\"` ) ) ;
206
207
}
207
208
209
+ function cleanGhPagesBranch ( ) {
210
+ return execPromise ( 'git ls-files' )
211
+ . then ( function ( stdout ) {
212
+ var files = '' ;
213
+ stdout . split ( "\n" ) . forEach ( function ( f ) {
214
+ // skip .gitignore & 404.html
215
+ if ( ( f != '' ) && ( f != '.gitignore' ) && ( f != '404.html' ) ) {
216
+ files = files . concat ( `"${ f } " ` ) ;
217
+ }
218
+ } ) ;
219
+ return execPromise ( `git rm -r ${ files } ` ) ;
220
+ } ) ;
221
+ }
222
+
208
223
function copyFiles ( ) {
209
224
return fsReadDir ( outDir )
210
225
. then ( ( files : string [ ] ) => Promise . all ( files . map ( ( file ) => {
You can’t perform that action at this time.
0 commit comments