Skip to content

Module and component generators are slow #185

@sebawita

Description

@sebawita

Environment
@nativescript/schematics 0.4 and 0.5

Describe the bug
Running all of the following commands in a code-sharing project takes too long to execute:

ng g m my-module
ng g c my-component --no-web
ng g migrate-module web-component

To Reproduce

# Create a new code-sharing project with Angular CLI and NativeScript Schematics
ng new my-app -c=@nativescript/schematics --shared`
cd my-app

# Test - generate component
ng g c my-component --no-web

# Test - generate module
ng g m my-module

# Test - migrate-module
ng g m web-module --no-nativescript
ng g migrate-module --name=web-module

Expected behavior
These commands should execute in under 2 seconds.

Sample project
n/a

Additional context
It looks like filter from angular schematics is the function that slows the whole process a lot, as it goes through all node_modules files one by one.

import { filter } from '@angular-devkit/schematics'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions