diff --git a/src/templates/init/pipeline_config.yml.mu b/src/templates/init/.pipeline/config.yml.mu similarity index 100% rename from src/templates/init/pipeline_config.yml.mu rename to src/templates/init/.pipeline/config.yml.mu diff --git a/src/templates/scaffold-readme/README.md b/src/templates/scaffold-readme/README.md index 52809d2d..eed015bb 100644 --- a/src/templates/scaffold-readme/README.md +++ b/src/templates/scaffold-readme/README.md @@ -50,7 +50,7 @@ $ ./cx-server start ``` Point the new Jenkins to your repository and it will automatically run the pipeline. -If the pipeline should deploy your application as well, you need to modify the `pipeline_config.yml`. +If the pipeline should deploy your application as well, you need to modify the `.pipeline/config.yml`. ## NestJS diff --git a/test/utils/__snapshots__/templates.spec.ts.snap b/test/utils/__snapshots__/templates.spec.ts.snap index 20fab4dc..e160830a 100644 --- a/test/utils/__snapshots__/templates.spec.ts.snap +++ b/test/utils/__snapshots__/templates.spec.ts.snap @@ -3,11 +3,11 @@ exports[`Templates Utils should copy files locally 1`] = ` Array [ ".npmrc", + ".pipeline", "Jenkinsfile", "credentials.json", "deployment", "manifest.yml", - "pipeline_config.yml", "s4hana_pipeline", "systems.json", ] @@ -15,26 +15,79 @@ Array [ exports[`Templates Utils should return information which files to copy where 1`] = ` Array [ - ".gitkeep", - ".gitkeep", - ".gitkeep", - ".gitkeep", - ".gitkeep", - ".npmrc", - "Jenkinsfile", - "credentials.json", - "manifest.yml", - "pipeline_config.yml", - "systems.json", + Array [ + ".npmrc", + ], + Array [ + ".pipeline", + "config.yml", + ], + Array [ + "Jenkinsfile", + ], + Array [ + "credentials.json", + ], + Array [ + "deployment", + ".gitkeep", + ], + Array [ + "manifest.yml", + ], + Array [ + "s4hana_pipeline", + "reports", + "backend-integration", + ".gitkeep", + ], + Array [ + "s4hana_pipeline", + "reports", + "backend-unit", + ".gitkeep", + ], + Array [ + "s4hana_pipeline", + "reports", + "coverage-reports", + "backend-integration", + ".gitkeep", + ], + Array [ + "s4hana_pipeline", + "reports", + "coverage-reports", + "backend-unit", + ".gitkeep", + ], + Array [ + "systems.json", + ], ] `; exports[`Templates Utils should return information which files to copy where 2`] = ` Array [ - ".npmrc", - "manifest.yml", - "package.json", - "xs-app.json", - "xs-security.json", + Array [ + ".npmrc", + "approuter", + ], + Array [ + "approuter", + "manifest.yml", + ], + Array [ + "approuter", + "package.json", + ], + Array [ + "approuter", + "xs-app.json", + ], + Array [ + "approuter", + "xs-security.json", + ], ] `; diff --git a/test/utils/templates.spec.ts b/test/utils/templates.spec.ts index 38b0602b..126a9581 100644 --- a/test/utils/templates.spec.ts +++ b/test/utils/templates.spec.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as rm from 'rimraf'; -import { copyFiles, findConflicts, getCopyDescriptors, getTemplatePaths } from '../../src/utils'; +import { copyFiles, findConflicts, getCopyDescriptors, getTemplatePaths, CopyDescriptor } from '../../src/utils'; import { getCleanProjectDir, getTestOutputDir } from '../test-utils'; const testOutputDir = getTestOutputDir(__filename); @@ -16,10 +16,10 @@ describe('Templates Utils', () => { it('should return information which files to copy where', () => { const initCopyInfo = getCopyDescriptors('targetDir', getTemplatePaths(['init'])); - expect(initCopyInfo.map(copyInfo => path.basename(copyInfo.fileName)).sort()).toMatchSnapshot(); + expect(initCopyInfo.map(copyInfo => copyInfoToPathArray(copyInfo)).sort()).toMatchSnapshot(); const appRouterCopyInfo = getCopyDescriptors('targetDir', getTemplatePaths(['add-approuter'])); - expect(appRouterCopyInfo.map(copyInfo => path.basename(copyInfo.fileName)).sort()).toMatchSnapshot(); + expect(appRouterCopyInfo.map(appRouterCopyInfo => copyInfoToPathArray(appRouterCopyInfo).sort())).toMatchSnapshot(); }); it('should find conflicts', async () => { @@ -39,4 +39,10 @@ describe('Templates Utils', () => { // it('should copy files remotely', async () => { // const projectDir = getCleanProjectDir(testOutputDir, 'copy-files-remotely'); // }); + + function copyInfoToPathArray(copyInfo: CopyDescriptor): string[] { + const filePathBeginnginFromTargetDir = path.relative(path.resolve('targetDir'), copyInfo.fileName); + const filePathAsList = filePathBeginnginFromTargetDir.split(path.sep); + return filePathAsList; + } });