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

Generator with existing entities

Open maxx0r opened this issue 10 years ago • 8 comments

Hi,

first off; i'm an idiot.

I generated a file, wrote the code, wanted to start the serve job and in a reflex I did arrow up+ enter in my command prompt.

But i forgot i didnt ionic serve after generating. So it regenerated the page, overwriting the code I just wrote. Is there a possibility the generator checks whether the generate command will overwrite existing files so it can ask for a confirmation?

maxx0r avatar Apr 29 '16 13:04 maxx0r

Hey thanks for the issue. I think this is definitely a good idea, for the exact situation you encountered. On Fri, Apr 29, 2016 at 8:08 AM Max Keyner [email protected] wrote:

Hi,

first off; i'm an idiot.

I generated a file, wrote the code, wanted to start the serve job and in a reflex I did arrow up+ enter in my command prompt.

But i forgot i didnt ionic serve after generating. So it regenerated the page, overwriting the code I just wrote. Is there a possibility the generator checks whether the generate command will overwrite existing files so it can ask for a confirmation?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-cli/issues/968

tlancina avatar Apr 30 '16 13:04 tlancina

D'oh! I just did this exact same thing.

Seems like this would be a super simple fix that would prevent people like myself & max from banging our heads on tables in the future.

goleary avatar Nov 15 '16 19:11 goleary

closed because why....? has this been fixed?

goleary avatar Jul 27 '18 00:07 goleary

Huh.. I must've closed the tab before writing a comment. Sorry about that.

We won't be adding this functionality for v3. We're only putting critical fixes into @ionic/app-scripts. That's why I closed this issue.

If you like I can keep the issue open for v4, but for v4 the Ionic CLI uses the Angular CLI to run schematics that generate app features. The feature request would have to be made in the Angular CLI repo, because it would be for ng generate.

imhoffd avatar Jul 27 '18 00:07 imhoffd

I'm pretty sure angular-cli already does this (at least for the last version I used of it that was the case)

goleary avatar Jul 27 '18 17:07 goleary

Hmm.. I haven't seen that. Is that new for Angular CLI 6.1.0? We'll need to do something in the Ionic CLI to properly handle stdin/stdout of the process.

imhoffd avatar Jul 27 '18 18:07 imhoffd

image IIRC this has been the effect for some time.

goleary avatar Jul 27 '18 20:07 goleary

Oops, sorry. I thought we were talking about the original feature request:

Is there a possibility the generator checks whether the generate command will overwrite existing files so it can ask for a confirmation?

I think the error message is good, though. 👍

imhoffd avatar Jul 28 '18 03:07 imhoffd