ng-schematics-helpers
v0.0.7
Published
Angular Schematics helper functions
Downloads
4
Readme
ng-schematics-helpers
These functions help you quickly and easily update your imports and declarations in both your NgModule and Storybook files. Standalone components support soon.
Installation
npm install --save ng-schematics-helpers
Usage
Import required helper function.
import { findClassBySelector } from 'ng-schematics-helpers'
findClassBySelector
Search a class name by selector findClassBySelector
findClassBySelector(selector: string, sourcePath: string, tree: Tree)
This will return:
{
className: 'NavComponent',
classPath: '/projects/pet-project/src/app/nav-component/nav.component.ts',
modulePath: '/projects/pet-project/src/app/nav-component/nav.module.ts',
moduleName: 'NavModule',
}
updateDeclarations
Update declarations inside selected module
updateDeclarations({
tree: Tree
modulePathToEdit: string
componentNameToInsert: string
componentPathToInsert: string
})
updateImports
Update imports inside selected module
updateImports({
tree: Tree
modulePathToEdit: string
moduleNameToInsert: string
modulePathToInsert: string
useRelativePath: boolean
})
updateStorybookImports
Update imports inside storybook file
updateStorybookImports({
tree: Tree
modulePathToEdit: string
moduleNameToInsert: string
modulePathToInsert: string
useRelativePath?: boolean
}):
updateStorybookImports
Update declarations inside storybook file
updateStorybookDeclarations({
tree: Tree
modulePathToEdit: string
moduleNameToInsert: string
modulePathToInsert: string
useRelativePath?: boolean
})
updateStorybookDeclarations
Update imports inside storybook file
updateStorybookImports({
tree,
modulePathToEdit,
moduleNameToInsert,
modulePathToInsert,
useRelativePath = true,
}):
Check out docs or testing files for more information.
License
Luis Reinoso MIT License