angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Rename / remove / move components

Open zpydee opened this issue 10 years ago • 102 comments

Please provide us with the following information:

  1. OS? Mac OSX (El Capitan)
  1. Versions. Please run ng --version. If there's nothing outputted, please angular-cli: 1.0.0-beta.1 node: 5.7.0 os: darwin x64

It would be really usefull to add cli commands for:

  • rm = removing a component
  • mv = moving / renaming a component

Unless I am missing it, I don't see that this exists and it would be really useful during refactoring to avoid all the manual updates that come with this process.

Thoughts?

zpydee avatar May 24 '16 07:05 zpydee

+1

suslovsergey avatar Nov 08 '17 08:11 suslovsergey

Yes please :)

totalknowledge avatar Nov 14 '17 16:11 totalknowledge

+1

danielszuk avatar Nov 18 '17 20:11 danielszuk

+10086 for renaming

rmlzy avatar Nov 24 '17 09:11 rmlzy

+1

kazaaaak avatar Dec 04 '17 11:12 kazaaaak

+1

activecodedev avatar Dec 06 '17 15:12 activecodedev

+1 . I actually need the renaming part as I have just developed my first angular app and I felt the need to refactor it and my IDE was not kind enough to allow me to do that .

Raveesh avatar Dec 18 '17 13:12 Raveesh

+1 It would be a nice feature in angular CLI to have a command for removing/renaming components or modules or pipes etc.,

hemanthNaga avatar Dec 20 '17 05:12 hemanthNaga

One solution, although breaks the Angular convention, is to rename the files in each component directory to index.ts, template.html and style.css. That way you can rename just the folder and for imports you can simply import { SomeComponent } from './path/to/dir';.

It's not ideal though, and I would also prefer renaming support. Just the file names is fine, the refactoring can be done in the IDE and is probably out of scope of the CLI anyway.

ryall avatar Dec 22 '17 15:12 ryall

I also agree, in having a "ng destroy" or "ng remove", when we want to delete a component, so we do not need to delete the file and then also manualy modify the app.module.ts

Costas-Zeimpekis avatar Feb 07 '18 10:02 Costas-Zeimpekis

Hi guys! ✌️

We just wrote a tool to rename angular components. Check it out https://www.npmjs.com/package/ng-rn

Hope you like it 🙃

rechenberger avatar Feb 23 '18 15:02 rechenberger

We just wrote a tool to rename angular components. Check it out https://www.npmjs.com/package/ng-rn

Looks I just had this itching my mind at the right time. Thx!

gitlines avatar Feb 23 '18 17:02 gitlines

Any plan to support this in the future? Combining schematics and ngc can be really powerful here..

gioragutt avatar May 08 '18 09:05 gioragutt

+1 for moving Something like - ng move <component_name> <new_location> or ng move <old_component_path> <new_component_path>

kartikgola-compro avatar May 14 '18 06:05 kartikgola-compro

+1

anafreitas avatar Aug 21 '18 18:08 anafreitas

@filipesilva Could I develop this feature and submit a pull request, or is it already under development by someone else?

thegrims avatar Aug 21 '18 19:08 thegrims

why on earth will i creat a component and not be able to delete... absurd

zion99674 avatar Nov 26 '18 17:11 zion99674

+1 for ng mv(renaming component), happened to me many times. I always kick off a component with a stupid name, naming is really an art...

yglin avatar Jan 10 '19 09:01 yglin

Moving can be easily done using many extensions for VS Code, what we need is ng rename to rename a component and also style, html and test files

alexciesielski avatar Mar 20 '19 17:03 alexciesielski

Hey guys! Just wanted to check on the status of this issue for renaming components (.ts, .html, .css and .spec.ts files as well as the corresponding Component object).

I'd appreciate if anyone could tell me some - I hope, good - news!

HunteRoi avatar May 13 '19 13:05 HunteRoi