Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Componentisation proof of concept #9154

Closed
wants to merge 9 commits into from

Commits on Jun 17, 2024

  1. Add Packwerk

    This will allow us to define packages and identify where packages
    have dependencies outside their domain, and manually specify
    dependencies where necessary
    
    https://github.com/Shopify/packwerk
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    d666a11 View commit details
    Browse the repository at this point in the history
  2. Load all Rails engines in packages on boot

    In the next commit, we’ll add a Rails engine to the `packages`
    directory, which we will autoload on boot. Engines will also contain
    routes, which we will add to the routes configuration, so we can include
    routes in the main routes.rb file.
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    2afa50b View commit details
    Browse the repository at this point in the history
  3. Include all tests and factories from packages

    To improve visibility, tests will be included in their relevant
    pacakages, so we’ll need to ensure all test-related files are
    included during the test run
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    e3b3f91 View commit details
    Browse the repository at this point in the history
  4. Add an Emergency Banner package

    This adds the engine code in `lib` to define the engine, and moves the
    code involved in the Emergency Banner (including the tests) to the
    package directory, shaped as a mini-Rails app.
    
    The routes for this package are defined in a routes file, and then
    loaded in the main routes file with the `draw` method.
    
    We also define a package in package.yml that tells Packwerk to enforce
    dependencies. Running `packwerk update-todo` adds a `package_todo.yml`
    file, which shows us where dependencies are being loaded in from other
    parts of the application.
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    7f7d5c8 View commit details
    Browse the repository at this point in the history
  5. Add a base package

    This can eventually contain all code that other packages depend on,
    including base controllers, models and some components that are used
    across the application.
    
    We can now define the base package and dependencies in our package and
    run `packwerk update-todo`, which removes the `package-todo` file in our
    exiting package.
    
    We also update our root application to enforce dependencies and
    add the base package as a dependency. This ensures that the root
    application doesn’t use any code in any of our packages, unless
    a dependency is defined.
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    9ce1ff4 View commit details
    Browse the repository at this point in the history
  6. Add Packwerk to CI

    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    27f8239 View commit details
    Browse the repository at this point in the history
  7. Add brackets to arguments in view

    There is an open bug in Packwerk when shorthand hash syntax is used in
    views (Shopify/packwerk#278). Adding brackets
    seems to fix it
    pezholio committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    0445b45 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3a02f0e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a09ec2c View commit details
    Browse the repository at this point in the history