Skip to content

Commit

Permalink
fix: use default render config from helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 7, 2021
1 parent f54c959 commit 61d5064
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,10 @@ import ts, {
} from 'typescript';
import { ImportCollection } from './import-collection';
import { ReactOutputManager } from './react-output-manager';
import {
ReactRenderConfig,
ScriptKind,
ScriptTarget,
ModuleKind,
scriptKindToFileExtension,
} from './react-render-config';
import { ReactRenderConfig, ScriptKind, scriptKindToFileExtension } from './react-render-config';
import SampleCodeRenderer from './amplify-ui-renderers/sampleCodeRenderer';
import { getComponentPropName } from './react-component-render-helper';
import { transpile, buildPrinter } from './react-studio-template-renderer-helper';
import { transpile, buildPrinter, defaultRenderConfig } from './react-studio-template-renderer-helper';

export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer<
string,
Expand All @@ -57,11 +51,7 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer
> {
protected importCollection = new ImportCollection();

protected defaultRenderConfig = {
script: ScriptKind.TSX,
target: ScriptTarget.ES2015,
module: ModuleKind.ESNext,
};
protected defaultRenderConfig = defaultRenderConfig;

fileName = `${this.component.name}.tsx`;

Expand All @@ -73,9 +63,7 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer
}

this.renderConfig = {
script: ScriptKind.TSX,
target: ScriptTarget.ES2015,
module: ModuleKind.ESNext,
...this.defaultRenderConfig,
...this.renderConfig,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ import {
} from 'typescript';
import { StudioTemplateRenderer } from '@amzn/studio-ui-codegen';

import {
ReactRenderConfig,
ScriptKind,
scriptKindToFileExtension,
ScriptTarget,
ModuleKind,
} from './react-render-config';
import { ReactRenderConfig, ScriptKind, scriptKindToFileExtension } from './react-render-config';
import { ImportCollection } from './import-collection';
import { ReactOutputManager } from './react-output-manager';
import { transpile, buildPrinter, defaultRenderConfig } from './react-studio-template-renderer-helper';
Expand Down Expand Up @@ -49,9 +43,7 @@ export class ReactThemeStudioTemplateRenderer extends StudioTemplateRenderer<
}

this.renderConfig = {
script: ScriptKind.TSX,
target: ScriptTarget.ES2015,
module: ModuleKind.ESNext,
...this.defaultRenderConfig,
...this.renderConfig,
};
}
Expand Down

0 comments on commit 61d5064

Please sign in to comment.