ackama / rails-template

Application template for Rails 7 projects; preloaded with best practices for TDD, security, deployment, and developer productivity.
Other
294 stars 15 forks source link

refactor: create a dedicated method for updating `package.json` #527

Closed G-Rath closed 7 months ago

G-Rath commented 7 months ago

I'm aware of how much conflict this will create with #466 but oh well 🤷

G-Rath commented 7 months ago

We can't use templating because the file is touched by external code too i.e. react-rails and shakapacker write to it (and in fact we're depending on shakapacker:install to create the file initially).

Also I don't think it's as comparable: afaik all our templating files are generally within a single variant or maybe two whereas this particular file is modified by 5, and which are somewhat dependent on the actions of each other so I don't think templating would be as clean of a solution here.

joshmcarthur commented 7 months ago

Cool, that's all good. I thought it was worth raising, because it's quite easy to take an established pattern (like modifying the file in code), and use that over something that's already available via thor and the generator framework