Reading at scale
Lesson 16 An unfamiliar repo
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.
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
- Line 3 Open this after the README.
scriptsshow how it really starts and tests, anddependenciesshow the framework. - Line 6 Likely the entry point: it starts listening.
app.jsprobably builds the app. Confirm inscripts.start, don't guess. - Line 8 One file per feature: this folder is a map of what the API offers.
- 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.