From 8c566caee55341bfd15e3cda764da5fcd434e941 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 26 Aug 2016 02:28:55 +0100 Subject: [PATCH] fix(build): copy dot files in assets Close #1758 Close #1847 --- addon/ng2/models/webpack-build-common.ts | 3 ++- tests/e2e/e2e_workflow.spec.js | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addon/ng2/models/webpack-build-common.ts b/addon/ng2/models/webpack-build-common.ts index 2abd5822e5b1..cc005ca28833 100644 --- a/addon/ng2/models/webpack-build-common.ts +++ b/addon/ng2/models/webpack-build-common.ts @@ -147,7 +147,8 @@ export function getWebpackCommonConfig( }), new CopyWebpackPlugin([{ context: path.resolve(appRoot, appConfig.assets), - from: '**/*', + from: { glob: '**/*', dot: true }, + ignore: [ '.gitignore' ], to: path.resolve(projectRoot, appConfig.outDir, appConfig.assets) }]) ], diff --git a/tests/e2e/e2e_workflow.spec.js b/tests/e2e/e2e_workflow.spec.js index db90d88d5e1c..dd81249fcf54 100644 --- a/tests/e2e/e2e_workflow.spec.js +++ b/tests/e2e/e2e_workflow.spec.js @@ -316,12 +316,18 @@ describe('Basic end-to-end Workflow', function () { it('moves all files that live inside `assets` into `dist`', function () { this.timeout(420000); - const tmpFile = path.join(process.cwd(), 'src', 'assets', 'test.abc'); - const tmpFileLocation = path.join(process.cwd(), 'dist', 'assets', 'test.abc'); - fs.writeFileSync(tmpFile, 'hello world'); + const dotFile = path.join(process.cwd(), 'src', 'assets', '.file'); + const distDotFile = path.join(process.cwd(), 'dist', 'assets', '.file'); + fs.writeFileSync(dotFile, ''); + const testFile = path.join(process.cwd(), 'src', 'assets', 'test.abc'); + const distTestFile = path.join(process.cwd(), 'dist', 'assets', 'test.abc'); + fs.writeFileSync(testFile, 'hello world'); + const distDotGitIgnore = path.join(process.cwd(), 'dist', 'assets', '.gitignore'); sh.exec(`${ngBin} build`); - expect(existsSync(tmpFileLocation)).to.be.equal(true); + expect(existsSync(distDotFile)).to.be.equal(true); + expect(existsSync(distTestFile)).to.be.equal(true); + expect(existsSync(distDotGitIgnore)).to.be.equal(false); }); // Mobile mode doesn't have styles