Skip to content

Commit

Permalink
refactor: remove studio term (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch authored Nov 26, 2021
1 parent b6fc75e commit 4c82035
Show file tree
Hide file tree
Showing 105 changed files with 679 additions and 596 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ Amplify Codegen UI supports component generation in Node or a browser environmen
```js
import {
AmplifyRenderer,
StudioTemplateRendererFactory,
StudioTemplateRendererManager,
FrontendManagerTemplateRendererFactory,
FrontendManagerTemplateRendererManager,
} from '@aws-amplify/codegen-ui-react';

const renderConfig = {};
const outputConfig = {
outputPathDir: './src/ui-components';
};

const componentRendererFactory = new StudioTemplateRendererFactory(
const componentRendererFactory = new FrontendManagerTemplateRendererFactory(
(component) => new AmplifyRenderer(component, renderConfig),
);

const rendererManager = new StudioTemplateRendererManager(componentRendererFactory, outputConfig);
const rendererManager = new FrontendManagerTemplateRendererManager(componentRendererFactory, outputConfig);

const component = {
id: '1234-5678-9010',
Expand All @@ -56,21 +56,21 @@ rendererManager.renderSchemaToTemplate(component);

```js
import {
ReactThemeStudioTemplateRenderer,
StudioTemplateRendererFactory,
StudioTemplateRendererManager,
ReactThemeFrontendManagerTemplateRenderer,
FrontendManagerTemplateRendererFactory,
FrontendManagerTemplateRendererManager,
} from '@aws-amplify/codegen-ui-react';

const renderConfig = {};
const outputConfig = {
outputPathDir: './src/ui-components';
};

const themeRendererFactory = new StudioTemplateRendererFactory(
(theme) => new ReactThemeStudioTemplateRenderer(theme, renderConfig),
const themeRendererFactory = new FrontendManagerTemplateRendererFactory(
(theme) => new ReactThemeFrontendManagerTemplateRenderer(theme, renderConfig),
);

const themeRendererManager = new StudioTemplateRendererManager(themeRendererFactory, outputConfig);
const themeRendererManager = new FrontendManagerTemplateRendererManager(themeRendererFactory, outputConfig);

const theme = {
id: '1234-5678-9010',
Expand Down Expand Up @@ -120,21 +120,21 @@ themeRendererManager.renderSchemaToTemplate(theme);

```js
import {
ReactIndexStudioTemplateRenderer,
StudioTemplateRendererFactory,
StudioTemplateRendererManager,
ReactIndexFrontendManagerTemplateRenderer,
FrontendManagerTemplateRendererFactory,
FrontendManagerTemplateRendererManager,
} from '@aws-amplify/codegen-ui-react';

const renderConfig = {};
const outputConfig = {
outputPathDir: './src/ui-components',
};

const indexRendererFactory = new StudioTemplateRendererFactory(
(components) => new ReactIndexStudioTemplateRenderer(components, renderConfig),
const indexRendererFactory = new FrontendManagerTemplateRendererFactory(
(components) => new ReactIndexFrontendManagerTemplateRenderer(components, renderConfig),
);

const indexRendererManager = new StudioTemplateRendererManager(indexRendererFactory, outputConfig);
const indexRendererManager = new FrontendManagerTemplateRendererManager(indexRendererFactory, outputConfig);

const components = [
{
Expand Down Expand Up @@ -190,7 +190,7 @@ const { importsText, compText } = new AmplifyRenderer(component, renderConfig).r
#### Themes

```js
import { ReactThemeStudioTemplateRenderer } from '@aws-amplify/codegen-ui-react';
import { ReactThemeFrontendManagerTemplateRenderer } from '@aws-amplify/codegen-ui-react';

const renderConfig = {};

Expand Down Expand Up @@ -235,13 +235,13 @@ const theme = {
],
};

const { componentText } = new ReactThemeStudioTemplateRenderer(theme, renderConfig).renderComponent();
const { componentText } = new ReactThemeFrontendManagerTemplateRenderer(theme, renderConfig).renderComponent();
```

#### `index.js` File

```js
import { ReactIndexStudioTemplateRenderer } from '@aws-amplify/codegen-ui-react';
import { ReactIndexFrontendManagerTemplateRenderer } from '@aws-amplify/codegen-ui-react';

const renderConfig = {};
const components = [
Expand All @@ -267,7 +267,7 @@ const components = [
},
];

const { componentText } = new ReactIndexStudioTemplateRenderer(components, renderConfig);
const { componentText } = new ReactIndexFrontendManagerTemplateRenderer(components, renderConfig);
```

### Config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ export default function ComplexTest2(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(255,0,0)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/153x289?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/153x289?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"125px\\"
{...getOverrideProps(overrides, \\"Flex.Flex[0].View[0]\\")}
></View>
Expand All @@ -758,7 +758,7 @@ export default function ComplexTest2(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(219.30000364780426,255,0)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/153x289?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/153x289?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"122px\\"
{...getOverrideProps(overrides, \\"Flex.Flex[0].View[1]\\")}
></View>
Expand Down Expand Up @@ -825,7 +825,7 @@ export default function ComplexTest3(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(196.00000351667404,196.00000351667404,196.00000351667404)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/430x452?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/430x452?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"69px\\"
{...getOverrideProps(overrides, \\"Flex.View[0]\\")}
></View>
Expand Down Expand Up @@ -892,7 +892,7 @@ export default function ComplexTest4(
backgroundColor: \\"rgb(255,153.00000607967377,0)\\",
top: \\"1px\\",
left: \\"203px\\",
src: \\"https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!\\",
src: \\"https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!\\",
width: \\"120px\\",
position: \\"absolute\\",
height: \\"122px\\",
Expand All @@ -902,7 +902,7 @@ export default function ComplexTest4(
backgroundColor: \\"rgb(255,0,0)\\",
top: \\"0px\\",
left: \\"0px\\",
src: \\"https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!\\",
src: \\"https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!\\",
width: \\"122px\\",
position: \\"absolute\\",
height: \\"123px\\",
Expand Down Expand Up @@ -966,7 +966,7 @@ export default function ComplexTest4(
backgroundColor=\\"rgb(35.699965953826904,0,255)\\"
top=\\"0px\\"
left=\\"0px\\"
src=\\"https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!\\"
width=\\"122px\\"
position=\\"absolute\\"
height=\\"123px\\"
Expand All @@ -977,7 +977,7 @@ export default function ComplexTest4(
backgroundColor=\\"rgb(0,255,25.49997568130493)\\"
top=\\"1px\\"
left=\\"203px\\"
src=\\"https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!\\"
width=\\"120px\\"
position=\\"absolute\\"
height=\\"122px\\"
Expand Down Expand Up @@ -1023,7 +1023,7 @@ export default function ComplexTest5(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(35.699965953826904,0,255)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/240x120?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/240x120?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"120px\\"
{...getOverrideProps(overrides, \\"Flex.View[0]\\")}
></View>
Expand All @@ -1032,7 +1032,7 @@ export default function ComplexTest5(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(0,255,25.49997568130493)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/240x120?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/240x120?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"120px\\"
{...getOverrideProps(overrides, \\"Flex.View[1]\\")}
></View>
Expand Down Expand Up @@ -1156,7 +1156,7 @@ export default function ComplexTest7(
top=\\"0px\\"
borderRadius=\\"45px\\"
left=\\"254.15074157714844px\\"
src=\\"https://via.placeholder.com/401x192?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/401x192?text=Amplify+FrontendManager+is+Awesome!\\"
width=\\"150.84925842285156px\\"
position=\\"absolute\\"
height=\\"196px\\"
Expand Down Expand Up @@ -1184,7 +1184,7 @@ export default function ComplexTest7(
top=\\"0px\\"
borderRadius=\\"27px\\"
left=\\"0px\\"
src=\\"https://via.placeholder.com/401x192?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/401x192?text=Amplify+FrontendManager+is+Awesome!\\"
width=\\"169.42330932617188px\\"
position=\\"absolute\\"
height=\\"189.0880126953125px\\"
Expand Down Expand Up @@ -1241,7 +1241,7 @@ export default function ComplexTest8(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(219.30000364780426,255,0)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/472x723?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/472x723?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"119px\\"
{...getOverrideProps(overrides, \\"Flex.Flex[0].View[0]\\")}
></View>
Expand All @@ -1250,7 +1250,7 @@ export default function ComplexTest8(
padding=\\"0px 0px 0px 0px\\"
backgroundColor=\\"rgb(255,0,0)\\"
position=\\"relative\\"
src=\\"https://via.placeholder.com/472x723?text=Amplify+Studio+is+Awesome!\\"
src=\\"https://via.placeholder.com/472x723?text=Amplify+FrontendManager+is+Awesome!\\"
height=\\"124px\\"
{...getOverrideProps(overrides, \\"Flex.Flex[0].View[1]\\")}
></View>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ReactStudioTemplateRenderer renderSampleCodeSnippet component with name 1`] = `
exports[`ReactFrontendManagerTemplateRenderer renderSampleCodeSnippet component with name 1`] = `
Object {
"compText": "<MyText />",
"importsText": "import { MyText } from \\"./ui-components\\";
",
}
`;

exports[`ReactStudioTemplateRenderer renderSampleCodeSnippet component without name 1`] = `
exports[`ReactFrontendManagerTemplateRenderer renderSampleCodeSnippet component without name 1`] = `
Object {
"compText": "<unknown_component_name />",
"importsText": "import { unknown_component_name } from \\"./ui-components\\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
limitations under the License.
*/
import { JsxFragment, factory } from 'typescript';
import { ReactStudioTemplateRenderer } from '../../react-studio-template-renderer';
import { ReactFrontendManagerTemplateRenderer } from '../../react-frontend-manager-template-renderer';

export class MockTemplateRenderer extends ReactStudioTemplateRenderer {
export class MockTemplateRenderer extends ReactFrontendManagerTemplateRenderer {
renderJsx(): JsxFragment {
return factory.createJsxFragment(factory.createJsxOpeningFragment(), [], factory.createJsxJsxClosingFragment());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
import { StudioComponent } from '@aws-amplify/codegen-ui';
import { FrontendManagerComponent } from '@aws-amplify/codegen-ui';
import { assertASTMatchesSnapshot } from '../__utils__/snapshot-helpers';

import { AmplifyRenderer } from '../../amplify-ui-renderers/amplify-renderer';
import Primitive from '../../primitive';

function testPrimitive(component: StudioComponent) {
function testPrimitive(component: FrontendManagerComponent) {
const renderedComponent = new AmplifyRenderer(component, {}).renderJsx(component);
assertASTMatchesSnapshot(renderedComponent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
import { StudioTemplateRendererFactory, StudioComponent, StudioTheme } from '@aws-amplify/codegen-ui';
import {
FrontendManagerTemplateRendererFactory,
FrontendManagerComponent,
FrontendManagerTheme,
} from '@aws-amplify/codegen-ui';
import fs from 'fs';
import { join } from 'path';
import { ModuleKind, ScriptTarget, ScriptKind, ReactRenderConfig } from '..';
import { AmplifyRenderer } from '../amplify-ui-renderers/amplify-renderer';
import { ReactThemeStudioTemplateRenderer } from '../react-theme-studio-template-renderer';
import { ReactThemeFrontendManagerTemplateRenderer } from '../react-theme-frontend-manager-template-renderer';

function loadSchemaFromJSONFile(jsonSchemaFile: string): StudioComponent {
function loadSchemaFromJSONFile(jsonSchemaFile: string): FrontendManagerComponent {
return JSON.parse(
fs.readFileSync(join(__dirname, 'studio-ui-json', `${jsonSchemaFile}.json`), 'utf-8'),
) as StudioComponent;
fs.readFileSync(join(__dirname, 'frontend-manager-ui-json', `${jsonSchemaFile}.json`), 'utf-8'),
) as FrontendManagerComponent;
}

function loadThemeFromJSONFile(jsonThemeFile: string): StudioTheme {
function loadThemeFromJSONFile(jsonThemeFile: string): FrontendManagerTheme {
return JSON.parse(
fs.readFileSync(join(__dirname, 'studio-ui-json', `${jsonThemeFile}.json`), 'utf-8'),
) as StudioTheme;
fs.readFileSync(join(__dirname, 'frontend-manager-ui-json', `${jsonThemeFile}.json`), 'utf-8'),
) as FrontendManagerTheme;
}

function generateWithAmplifyRenderer(
Expand All @@ -38,8 +42,8 @@ function generateWithAmplifyRenderer(
isSampleCodeSnippet = false,
): { componentText: string; declaration?: string } {
const schema = loadSchemaFromJSONFile(jsonSchemaFile);
const rendererFactory = new StudioTemplateRendererFactory(
(component: StudioComponent) => new AmplifyRenderer(component, renderConfig),
const rendererFactory = new FrontendManagerTemplateRendererFactory(
(component: FrontendManagerComponent) => new AmplifyRenderer(component, renderConfig),
);
if (isSampleCodeSnippet) {
return { componentText: rendererFactory.buildRenderer(schema).renderSampleCodeSnippet().compText };
Expand All @@ -49,8 +53,8 @@ function generateWithAmplifyRenderer(

function generateWithThemeRenderer(jsonFile: string, renderConfig: ReactRenderConfig = {}): string {
const theme = loadThemeFromJSONFile(jsonFile);
const rendererFactory = new StudioTemplateRendererFactory(
(theme: StudioTheme) => new ReactThemeStudioTemplateRenderer(theme, renderConfig),
const rendererFactory = new FrontendManagerTemplateRendererFactory(
(theme: FrontendManagerTheme) => new ReactThemeFrontendManagerTemplateRenderer(theme, renderConfig),
);
return rendererFactory.buildRenderer(theme).renderComponent().componentText;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"value": "relative"
},
"src": {
"value": "https://via.placeholder.com/153x289?text=Amplify+Studio+is+Awesome!"
"value": "https://via.placeholder.com/153x289?text=Amplify+FrontendManager+is+Awesome!"
},
"height": {
"value": "125px"
Expand All @@ -47,7 +47,7 @@
"value": "relative"
},
"src": {
"value": "https://via.placeholder.com/153x289?text=Amplify+Studio+is+Awesome!"
"value": "https://via.placeholder.com/153x289?text=Amplify+FrontendManager+is+Awesome!"
},
"height": {
"value": "122px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"value": "relative"
},
"src": {
"value": "https://via.placeholder.com/430x452?text=Amplify+Studio+is+Awesome!"
"value": "https://via.placeholder.com/430x452?text=Amplify+FrontendManager+is+Awesome!"
},
"height": {
"value": "69px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"value": "0px"
},
"src": {
"value": "https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!"
"value": "https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!"
},
"width": {
"value": "122px"
Expand Down Expand Up @@ -53,7 +53,7 @@
"value": "203px"
},
"src": {
"value": "https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!"
"value": "https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!"
},
"width": {
"value": "120px"
Expand Down Expand Up @@ -132,7 +132,7 @@
"backgroundColor": "rgb(255,153.00000607967377,0)",
"top": "1px",
"left": "203px",
"src": "https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!",
"src": "https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!",
"width": "120px",
"position": "absolute",
"height": "122px"
Expand All @@ -142,7 +142,7 @@
"backgroundColor": "rgb(255,0,0)",
"top": "0px",
"left": "0px",
"src": "https://via.placeholder.com/323x123?text=Amplify+Studio+is+Awesome!",
"src": "https://via.placeholder.com/323x123?text=Amplify+FrontendManager+is+Awesome!",
"width": "122px",
"position": "absolute",
"height": "123px"
Expand Down
Loading

0 comments on commit 4c82035

Please sign in to comment.