trailsjs / generator-trails-old

:package: Trails Generator.
Other
6 stars 8 forks source link

Warn user when an override is needed #32

Closed jaumard closed 8 years ago

jaumard commented 8 years ago

Don't know if it's currently possible, but it can be nice when a trailpack needs to override some files, to let the user know which trailpack needs to override the files. This will help the user to understand what is going on and to make a decision if the user wants to override the files or not.

scippio commented 8 years ago

I think better solution is when rewrite is not needed... so we should concentrate this way...

jaumard commented 8 years ago

Can you elaborate ? Maybe with example.

I dig into this and there no simple way to add a message before the conflict. And we don't want to complicate the generator only for this.

So maybe the only thing to do it to add under the README (of each trailpacks with embedded files) witch files need to be overwrite and why

scippio commented 8 years ago

What abou this (for example):

We have now this:

why we don't have something like: DefaultService.js in generator-trails and DefaultServiceExpress4 in railpack-express4?

jaumard commented 8 years ago

Services are equals, so DefaultService.js from express is now removed (https://github.com/trailsjs/trailpack-express4/tree/master/archetype/api). No overwrite problem anymore. Don't need to have DefaultService.js and DefaultServiceExpress4 if they do the same.

scippio commented 8 years ago

Yeah... that's solution too. :) My proposal was something like approach for future conflict problems...

jaumard commented 8 years ago

When the generator ask to overwrite a file it's because it's needed, for example if you install a trailpack who embed a custom config (database.js) this file will be in conflict with the current default file from Trails so the generator will ask the user to overwrite it.

We don't want to have database.js and database"Trailpack".js. In a custom Trailpack if you don't want to have some conflict with another Trailpack later yes you can suffice the name of your services/controllers/models but it's a manual step. We don't want to do it automatically.

scippio commented 8 years ago

ok... so hopefully everyone will know what he is doing or not using default files in project. Update docs is good way...

jaumard commented 8 years ago

We have to create some documentation about this when someone create a new Trailpack to explain this. And the user always have the possibility to not overwrite files. Each Trailpack should have some documentation about default file are embedded and for what purpose. Like this the user can decide if he want to allow the overwrite or not.