Use path dirname rather than parsing it manually

Signed-off-by: Mark Foresta <Mark.Foresta691@gmail.com>
This commit is contained in:
Mark Foresta
2024-10-12 10:39:41 -04:00
committed by blam
parent 91e112058d
commit 38d71169ef
@@ -28,6 +28,7 @@ import {
SerializedFile,
serializeDirectoryContents,
} from '@backstage/plugin-scaffolder-node';
import path from 'path';
import { TemplateActionRegistry } from '../actions';
import { NunjucksWorkflowRunner } from '../tasks/NunjucksWorkflowRunner';
import { DecoratedActionsRegistry } from './DecoratedActionsRegistry';
@@ -97,7 +98,7 @@ export function createDryRunner(options: TemplateTesterCreateOptions) {
throw new Error('baseUrl is required');
}
const basePath = fileURLToPath(new URL(baseUrl));
const contentsPath = basePath.replace('template.yaml', '');
const contentsPath = path.dirname(basePath);
const dryRunId = contentsPath
.replace(options.workingDirectory, '')
.replace('dry-run-content-', '');