From 0e4778ca18f61fc28e53116c402217a90f16c33b Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sun, 15 May 2016 00:27:59 +0100 Subject: [PATCH] fix(deploy): fix file copy, index tag rewrite --- addon/ng2/commands/github-pages-deploy.ts | 10 ++++++++-- tests/acceptance/github-pages-deploy.spec.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addon/ng2/commands/github-pages-deploy.ts b/addon/ng2/commands/github-pages-deploy.ts index 6848be374e10..2b7704d333c5 100644 --- a/addon/ng2/commands/github-pages-deploy.ts +++ b/addon/ng2/commands/github-pages-deploy.ts @@ -149,13 +149,19 @@ module.exports = Command.extend({ function copyFiles() { return fsReadDir('dist') - .then((files) => Promise.all(files.map((file) => fsCopy(path.join('dist', file), path.join('.', file))))) + .then((files) => Promise.all(files.map((file) => { + if (file === '.gitignore'){ + // don't overwrite the .gitignore file + return Promise.resolve(); + } + return fsCopy(path.join('dist', file), path.join('.', file)) + }))); } function updateBaseHref() { let indexHtml = path.join(root, 'index.html'); return fsReadFile(indexHtml, 'utf8') - .then((data) => data.replace(//g, ` data.replace(//g, ``)) .then((data) => fsWriteFile(indexHtml, data, 'utf8')); } diff --git a/tests/acceptance/github-pages-deploy.spec.js b/tests/acceptance/github-pages-deploy.spec.js index 368f1b8b2f2c..9b1351a0ac98 100644 --- a/tests/acceptance/github-pages-deploy.spec.js +++ b/tests/acceptance/github-pages-deploy.spec.js @@ -130,7 +130,7 @@ describe('Acceptance: ng github-pages:deploy', function() { let indexHtml = path.join(process.cwd(), 'index.html'); return fsReadFile(indexHtml, 'utf8'); }) - .then((data) => expect(data.search(` expect(data.search(``)).to.not.equal(-1)); }); it('should create repo if needed', function() {