Merge pull request #13172 from backstage/mob/fix/windowz

mob: Fixing scaffolder windows templating
This commit is contained in:
Johan Haals
2022-08-16 14:08:59 +02:00
committed by GitHub
2 changed files with 9 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Fix issue on Windows where templated files where not properly skipped as intended.
@@ -27,7 +27,6 @@ import {
TemplateFilter,
SecureTemplater,
} from '../../../../lib/templating/SecureTemplater';
import path from 'path';
/**
* Downloads a skeleton, templates variables into file and directory names and content.
@@ -301,12 +300,13 @@ export function createFetchTemplateAction(options: {
}
function containsSkippedContent(localOutputPath: string): boolean {
// if the path is absolute means that the root directory has been skipped
// if the path is empty means that there is a file skipped in the root
// if the path starts with a separator it means that the root directory has been skipped
// if the path includes // means that there is a subdirectory skipped
// All paths returned are considered with / seperator because of globby returning the linux seperator for all os'.
return (
localOutputPath === '' ||
path.isAbsolute(localOutputPath) ||
localOutputPath.includes(`${path.sep}${path.sep}`)
localOutputPath.startsWith('/') ||
localOutputPath.includes('//')
);
}