Skip to content

Instantly share code, notes, and snippets.

@radekwarisch
Last active February 9, 2021 17:37
Show Gist options
  • Save radekwarisch/f9abb184117daf710a8eb4e433663581 to your computer and use it in GitHub Desktop.
Save radekwarisch/f9abb184117daf710a8eb4e433663581 to your computer and use it in GitHub Desktop.
Schematic execute file
import {
schematicPipe,
chainifyGatherOptions,
copyTemplatesAnd,
mergeFilesAnd
} from './schematicUtils';
import {gatherOptions} from './gatherOptions';
import {
maybeExcludeTemplates,
overwriteEJSExtension
} from './copyTeplatePlugins';
import {
lintFiles,
injectIntoParentComponent
} from './mergeFilesPlugins';
export type ComponentSchemaType = {
name: string;
props?: string;
styles?: string;
tests?: boolean;
storybook?: boolean;
['parent-component-name']?: string;
};
export const schematicComponent = (options: ComponentSchemaType) =>
schematicPipe(
compose(chainifyGatherOptions, gatherOptions)(options),
copyTemplatesAnd([
maybeExcludeTemplates,
overwriteEJSExtension
]),
mergeFilesAnd([
lintFiles,
injectIntoParentComponent
])
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment