Alberto
Alberto

Reputation: 123

How to remove files previously added with ng add schematic command

I have implemented custom schematics angular ng-add in my own library, It allows to install my library in new project and makes other custom edit to other files.

Now what can I do if I wanted to uninstall my library and I wanted to come back with my changes? Can I create custom schematics that first remove my previous edit and then removes my library?

I try to install with ng add @angular/material then uninstall It and I see that the files previously touched are not modified but remain modified

Upvotes: 6

Views: 6870

Answers (1)

Gautam Krishna R
Gautam Krishna R

Reputation: 2675

There's no ng remove command. Schematics are written by the developers of the package. You can look into the package's schematic declaration to find out what files are modified. As of now there's no way to automatically do this. You can use npm uninstall package-name to remove it from the package.json. You need to manually remove the package imports from module, component etc...

There's issue with discussion on this feature: https://github.com/angular/angular-cli/issues/900

Upvotes: 7

Related Questions