Skip to content

Instantly share code, notes, and snippets.

@IKatsuba
Created December 28, 2021 15:02
Show Gist options
  • Save IKatsuba/d505bfc17b6c5954918b9b87d9e917b2 to your computer and use it in GitHub Desktop.
Save IKatsuba/d505bfc17b6c5954918b9b87d9e917b2 to your computer and use it in GitHub Desktop.
const rule: Rule = (tree: Tree, context: SchematicContext): void => {
setActiveProject(createProject(tree));
const appModule = getMainModule('src/main.ts');
addImportToNgModule(appModule, 'SomeModule');
addImports(appModule.getFilePath(), {moduleSpecifier: '@some/package', namedExports: ['SomeModule']})
saveActiveProject();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment