Reading at scale

Lesson 16 An unfamiliar repo

5 min read · JavaScript · Quiz

README, manifest, entry points and tests give you a map in ten minutes

What you'll learn

  • Build a map of an unfamiliar repo in four stops
  • Find the real entry point and the real commands
  • Trust the manifest over the README

You open a repo you have never seen, with 200 files. Nobody reads 200 files. You read four of them, in the right order, and you have a map.

The idea

Make a map in four stops. The README says what the project is for and how to run it. The manifest (package.json) lists the dependencies and the commands it really offers. The entry point is where the program starts. The tests show what it promises.

Then pick one feature and follow it from the route to the database and back. That is ten minutes, and you know where things live. When the README and the manifest disagree, believe the manifest: a command that doesn't exist fails right away.

shop-api (file tree)
1shop-api/2  README.md3  package.json4  .env.example5  src/6    server.js7    app.js8    routes/9      orders.js10      users.js11    services/12      invoice.js13    db/14      migrations/15  test/16    orders.test.js
  1. Line 3 Open this after the README. scripts show how it really starts and tests, and dependencies show the framework.
  2. Line 6 Likely the entry point: it starts listening. app.js probably builds the app. Confirm in scripts.start, don't guess.
  3. Line 8 One file per feature: this folder is a map of what the API offers.
  4. Line 16 The tests are the project's promises. Read the test names before the code.

Take away

  • Four stops: README, manifest, entry point, tests. Then follow one feature all the way through.
  • The manifest tells you what really runs. The README may be out of date.
  • An entry point is named by the project's own commands, not guessed from file names.

Quiz: test yourself

6 questions: a quick quiz, then a review drill. Pick an answer to see why it's right.