BM: Baca dalam Bahasa Melayu
World 9: Power Tools
Packages
You will learn: how to share your code as a package that other projects install.
The problem
Three of your projects use the same date helper. You fixed a bug in one copy. The other two still break.
Pick one answer.
Watch
A package: A bundle of code with a name and a version that others can install. is code with a name and a version. It sits on a registry: An online shelf where packages are stored and shared., like a shop shelf. GitHub Packages is a shelf on GitHub, right next to your code.
Try it
GitHub Packages has shelves for many kinds of package. Sort each one.
Drag a card into a box. Or tap the card, then tap the box.
Try it
In another project, build the command that installs the date helper.
Tap the pieces in the right order.
Predict
You publish version 1.2.1 with the fix. What do your three projects get?
Pick one answer.
Check
Good package habit, or needs work? Swipe each one.
Swipe right for good, left for needs work. Or use the buttons.
Give every release a new version number
You did it!
You can now share code as a package on GitHub.
Go deeper (optional)
On GitHub Packages, npm names need your scope, like @aina-codes. You also tell npm to use GitHub’s registry. Container images live at ghcr.io. Publishing from your laptop needs a personal access token (classic). In Actions, GITHUB_TOKEN works. Public packages are free.
Bahasa Melayu
Tiga projek anda guna pembantu tarikh yang sama. Anda baiki pepijat dalam satu salinan. Dua lagi masih rosak.
Pakej (package) ialah kod dengan nama dan versi. Ia duduk di registry, macam rak kedai. GitHub Packages ialah rak di GitHub, betul-betul di sebelah kod anda.
GitHub Packages ada rak untuk banyak jenis pakej. Susun setiap satu.
Dalam projek lain, bina arahan yang pasang pembantu tarikh itu.
Anda terbitkan versi 1.2.1 dengan pembaikan itu. Apa yang tiga projek anda dapat?
Tabiat pakej yang bagus, atau perlu baiki? Leret setiap satu.
Kini anda boleh kongsi kod sebagai pakej di GitHub.
You finished this before. Practice is always welcome!
Official docs: Introduction to GitHub Packages · Working with the npm registry · Working with the Container registry
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?