chore(scaffolder): fixing typescript woes

This commit is contained in:
blam
2020-07-06 11:34:46 +02:00
parent 7693a8d484
commit 66016baf5c
2 changed files with 7 additions and 4 deletions
@@ -131,13 +131,13 @@ describe('CookieCutter Templater', () => {
component_id: 'newthing',
};
const returnPath = await cookie.run({
const { resultDir } = await cookie.run({
directory: tempdir,
values,
dockerClient: mockDocker,
});
expect(returnPath.startsWith(`${tempdir}-result`)).toBeTruthy();
expect(resultDir.startsWith(`${tempdir}-result`)).toBeTruthy();
});
it('should pass through the streamer to the run docker helper', async () => {
@@ -18,6 +18,7 @@ import { JsonValue } from '@backstage/config';
import { runDockerContainer } from './helpers';
import { TemplaterBase, TemplaterRunOptions } from '.';
import path from 'path';
import { TemplaterRunResult } from './types';
export class CookieCutter implements TemplaterBase {
private async fetchTemplateCookieCutter(
@@ -34,7 +35,7 @@ export class CookieCutter implements TemplaterBase {
}
}
public async run(options: TemplaterRunOptions): Promise<string> {
public async run(options: TemplaterRunOptions): Promise<TemplaterRunResult> {
// First lets grab the default cookiecutter.json file
const cookieCutterJson = await this.fetchTemplateCookieCutter(
options.directory,
@@ -66,6 +67,8 @@ export class CookieCutter implements TemplaterBase {
dockerClient: options.dockerClient,
});
return path.resolve(resultDir, options.values.component_id as string);
return {
resultDir: path.resolve(resultDir, options.values.component_id as string),
};
}
}