Skip to content

On the Registry

You'll publish a small library to npm, PyPI, crates.io or Packagist, then install it in a fresh folder the way a stranger would.

About

Publishing a package sounds like a big deal and takes an afternoon. What takes longer is making something worth installing: a clear name, one job, a README that gets someone running in a minute, and version numbers that mean something. Keep it tiny. A function you keep rewriting across projects is the perfect candidate. Expect the first publish to go up without the source files, because the manifest didn't list them, and that happens to everyone. Pull requests from strangers and maintaining it for years are covered over in Open Source.

At a glance

Per requirement
25 XP
Completion bonus
150 XP
Requirements
6
Takes
Two weeks
Skill level
Intermediate (months of practice)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own
Locked for now
Earn two more Common badges in Coding to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Pull one reusable function out of your own code and give it a package name nobody has taken. Search the registry first. Keep the name short and lowercase, with no cute misspellings, and write one sentence that says what it does. Take a screenshot of the registry search showing the name is free. Photo
  2. 2
    Set up the package structure, the metadata, and a README with the install command and one example. The README is the install command, a three-line example, and nothing else. If a stranger can't run it in 60 seconds from the README, cut words until they can. Take a screenshot of the README rendered. Photo
  3. 3
    Write tests for the package and run them from a clean checkout. Clone your repo into a new folder and run the tests there. If they only pass on your machine, you've got a hidden dependency somewhere. Take a screenshot of the tests passing in the fresh clone. Photo
  4. 4
    Publish version 0.1.0 to the public registry. Use npm publish, twine upload, cargo publish, or a tag for Packagist. Turn on two-factor for the registry account, because package hijacks are real. Take a screenshot of the package page on the registry. Photo
  5. 5
    Install it in a brand new project folder and use it from there. Not from your source tree, but from the registry, the way everyone else would. If the import fails, you've got a packaging bug, and everyone does the first time. Take a screenshot of the install and a working call. Photo
  6. 6
    Fix one thing and publish 0.1.1 with a changelog line. A typo, a better error message, or anything small will do. Bump the version, write one line in the CHANGELOG, and publish. Now you know the whole loop. Take a screenshot of the two versions listed on the registry. Photo