ng-schematics-helpers
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i ng-schematics-helpers

Weekly Downloads

0

Version

0.0.7

License

MIT

Unpacked Size

34.4 kB

Total Files

19

Last publish

Collaborators

  • luis.reinoso