This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Rule, | |
SchematicContext, | |
Tree, | |
MergeStrategy, | |
empty, | |
mergeWith, | |
apply, | |
template, | |
move, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
schematicPipe, | |
chainifyGatherOptions, | |
copyTemplatesAnd, | |
mergeFilesAnd | |
} from './schematicUtils'; | |
import {gatherOptions} from './gatherOptions'; | |
import { | |
maybeExcludeTemplates, | |
overwriteEJSExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
forEach, | |
rename, | |
FileEntry | |
} from '@angular-devkit/schematics'; | |
export const maybeExcludeTemplates = <TInputType>({ | |
options, | |
}: TInputType) => forEach(maybeExcludeFile(options)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
noop, | |
externalSchematic, | |
} from '@angular-devkit/schematics'; | |
import {compose, toPairs} from 'ramda' | |
export const lint = <TInputType>({ | |
config, | |
}: TInputType) => compose(lint(config)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const gatherOptions = <TInputType>(schema: ComponentSchemaType) => async ( | |
tree: Tree, | |
context: SchematicContext | |
): TInputType => { | |
const {classify} = strings; | |
const {name, 'parent-file-name': parentFileName} = schema; | |
const fileName = classify(name); | |
const config = loadConfigFromFile({tree}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Rule = (tree: Tree, context: SchematicContext) => | |
Tree | Observable<Tree> | Rule | Promise<void | Rule> | void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const chainifyGatherOptions = <TInputType>( | |
gatherOptionsFn: ( | |
tree: Tree, | |
context: SchematicContext | |
) => Observable<TInputType> | Promise<TInputType> | TInputType | |
) => { | |
const reassignInputKeys = (input: TInputType) => (newInput: TInputType) => { | |
Object.entries(newInput).forEach(([key, newValue]: [string, unknown]) => { | |
Object.assign(input, { | |
[key]: newValue, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const copyTemplatesAnd = <TInputType>( | |
...plugins: (ChainableType<TInputType>)[] | |
) => (input: TInputType) => () => { | |
const {templatesPath, movePath, templateVariables, tree} = input; | |
const newTemplates = apply(url(templatesPath), [ | |
template(templateVariables), | |
move(movePath), | |
...plugins.map(compose(input)), | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const mergeFilesAnd = <TInputType>( | |
...plugins: (ChainableType<TInputType>)[] | |
) => (input: TInputType) => () => { | |
const {templates = empty()} = input; | |
return chain([ | |
mergeWith(templates, MergeStrategy.Overwrite), | |
...plugins.map(compose(input)), | |
]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
type PropsType = Readonly<{ | |
data: Record<string, unknown>, | |
type: number, | |
isActive: boolean, | |
items: Array<unknown>, | |
}>; | |
const NewComponent = ({data, type, isActive, items}: PropsType) => { |
OlderNewer