Creating a new package
Create GitHub repository#
GitHub has a generous free plan which allows us to create private repositories, run a CI/CD environment, and host private NPM packages. The first step for our new component library is to create a private GitHub repository.

Repository details:
Owner
Use your GitHub username
If your company uses GitHub you may create this package under their organization when creating a component library for production
Name
Use
component-library
Permissions
Make sure the repository is listed as
PRIVATE
README / .gitignore
Provide a default
README
as well as theNode .gitignore
template
Clone repository#
Once the repository is created, let's clone it to our machine.
# Navigate to where you want to store the repository
cd ~/Courses
# Use the HTTPS or SSH values provided by GitHub
git clone COPY_FROM_GITHUB
When the repository is finished cloning, open it in your editor of choice. You should see the README
and .gitignore
we defined in the previous step.

Initialize the package#
To help the initial package creation we will use the npm-init command.
# Navigate to our component library
cd ~/Courses/component-library
# Initialize our package with all default values
npm init --force
You will see a new package.json
with its values pre-populated to match our repository. Let's update the name of the package to include our GitHub account as a scope:
// File: package.json
{
"name": "@GITHUBUSERNAME/component-library",
"version": "0.0.0"
}
Dependencies#
This page is a preview of The newline Guide to Building a Company Component Library