With Packwerk 2.0, we made a few changes to simplify the setup. Updating will require removing some previously necessary files and configuration.
Because packwerk is no longer involved in specifying the application's inflections, it doesn't have to live in the production
group in your Gemfile
anymore. We recommend moving it to the development
group.
We no longer require the load_paths
key in packwerk.yml
. You can simply delete the load_paths key as it will not be read anymore. Instead, Packwerk will ask Rails for load paths. If you're using spring, make sure to properly set up spring (see USAGE.md) to keep packwerk fast.
We no longer require a custom inflections.yml
file. Instead, you'll want to revert BACK to using the inflections.rb
initializer as you would have done prior to adopting packwerk. To do this, you'll want to convert back to using the plain ActiveSupport Inflections API.
Given the following example inflections.yml
, here is an example inflections.rb
that would follow. Tip: if you're using git, you can run git log config/inflections.yml
, find the first commit that introduced inflections.yml
, find the COMMIT_SHA, and then run git show COMMIT_SHA
to see what your inflections file looked like before (note that you may have changed inflections.yml
since then, though).
config/inflections.yml
# List your inflections in this file instead of `inflections.rb`
# See steps to set up custom inflections:
# https://github.com/Shopify/packwerk/blob/main/USAGE.md#Inflections
acronym:
- 'HTML'
- 'API'
singular:
- ['oxen', 'oxen']
irregular:
- ['person', 'people']
uncountable:
- 'fish'
- 'sheep'
config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym('HTML')
inflect.acronym('API')
inflect.singular('oxen', 'oxen')
inflect.irregular('person', 'people')
inflect.uncountable('fish')
inflect.uncountable('sheep')
end