Javascript packaging is not easy and the support materials are not easy to find compared to how to use packages. This is a shame, because creating packages:
- Promotes good architecture
- Promotes gradual adoption when making big changes
- Enables the success of others
- Increases your visibility for your career
This lesson (and the commit history) show step by step how to create a simple JavaScript package to introduce the core concepts of what a package is and the core concepts of:
- Main entrypoint
- Exports
- Semantic versioning
- Tagging
Run the npm init
command to setup a package by creating a package.json
file.
Publish a package that lets users call an echo
function to output their string value in the following format:
echo: <user value>
Update the echo
function so that user values are echoed 5 times.
Update the echo
function so that the following are configurable
- The number echoes
- The default
echo:
prefix
Create a package that will make it easier for users to use the animchan API. This package should be able to get:
- All anime names starting with a letter (e.g. all anime names starting with 'b')
- All anime characters for an anime (e.g. All characters in 'One punch man')