Shopify / Shopify/tapioca

Make `require.rb` less necessary

Open
#429 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

One of the main stumbling blocks for people getting started with Tapioca is around the require.rb file. There are a few things we can do to improve the brittleness around it, some of which are:

  • Require all gems in the Gemfile regardless of require: false.

    This is a bit hacky, but most of our require.rb files are dominated by the requires for gems that have been marked as require: false in the Gemfile. If we can make Bundler load those gems as well, then those entries in the require.rb file can just go away.

  • Add built-in knowledge of some of the non-default requires of popular gems.

    Like how Sorbet srb rbi tooling does, we can start maintaining a list of gems with their non-standard (optional) requires that we can use instead of asking everyone to keep redeclaring those again and again. Ideally, this would not be bundled into the Tapioca gem, but can be distributed out-of-band and fetched using a Tapioca command (maybe tapioca require can do that?)

  • Try to brute force loading as many files from the gem lib path as possible.

    We could try to load all the files from a gem's lib directory, but we have to be careful about exit/abort calls, at_exit hooks, etc etc and we also need to probably make a few passes through the requires to make sure that the include order related issues can be resolved as much as possible.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how require.rb is used and how gem lib paths are loaded. The issue proposes brute-force loading with safeguards for exit, abort, at_exit hooks, and repeated passes for require ordering. Done means reducing manual require.rb entries without introducing unsafe loading or order-related failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.