Project Configuration
Below are the required system and file configurations for creating NPM packages.
1. Setting Up Your System
Please ensure your system has the following installations:
- Git
- Node 22.13 (or greater)
- NPM 10.9 (or greater)
![]() |
|
2. Creating a Project Directory
Create a new folder for your project like so:
1 mkdir thank-you-tweet-button-001
![]() |
You may use any name. For example, this guide uses |
![]() |
|
Afterward, navigate to your project directory using the command line.
1 cd path/to/thank-you-tweet-button-001
3. Creating a package.json File
Use NPM to initialize a package.json file for your project.
1 npm init -y
Let’s also configure Git.
4. Initializing a Git Repository
Create a .git repo in your project’s root directory:
1 git init
You now need to specify the files you want Git to ignore.
5. Specifying the Files Git Should Ignore
Create a .gitignore file in your project’s root directory:
1 touch .gitignore
Afterward, open the newly created .gitignore file and write the names of the files, folders, or file types you want Git to ignore.
Here’s an example:
1 /node_modules
2 /dist
The snippet above instructs Git to ignore tracking the current directory’s node_modules and dist folders.
![]() |
|
It’s now time to stage and commit your recent changes.
6. Staging and Committing Your Project’s Changes to Git
Enter the following command on your terminal to stage and commit your recent changes.
1 git add -A && git commit -m "Initialize project using CodeSweetly's guide"
The command above tells Git to stage and commit all modified and untracked files in the project.
Let’s now configure a remote repository for the project.
7. Configuring a GitHub Remote Repository
- Go to the GitHub website and sign in or sign up if you do not have an account.
- After signing up for an account, create a home (a repository) in GitHub for your Git repository. (You can use
thank-you-tweet-button-001as the repo’s name or any other name you prefer.) - Once you’ve created a remote repository for your package, link your project’s
.gitdirectory (located locally on your system) with the remote repository on GitHub. To connect to the remote repository, go to your package’s root directory via your local terminal and run thegit remote addcommand. Here’s the syntax:
1 git remote add origin https://github.com/your-username/remote-repo-name.git
![]() |
|
You can also add the remote repo to your package.json file so that people who want to contribute to your project can easily access it.
1 {
2 "name": "thank-you-tweet-button-001",
3 "version": "1.0.0",
4 "repository": {
5 "type": "git",
6 "url": "https://github.com/your-username/app-repo-name.git"
7 },
8 "scripts": {
9 "test": "echo \"Error: no test specified\" && exit 1"
10 }
11 }
Let’s provide the remote repo’s Issues URL as the package’s bug tracker. And an email people can use to report issues:
1 {
2 "name": "thank-you-tweet-button-001",
3 "version": "1.0.0",
4 "repository": {
5 "type": "git",
6 "url": "https://github.com/your-username/app-repo-name.git"
7 },
8 "bugs": {
9 "url": "https://github.com/your-username/app-repo-name/issues",
10 "email": "your-project-email@host.com"
11 },
12 "scripts": {
13 "test": "echo \"Error: no test specified\" && exit 1"
14 }
15 }
Afterward, stage and commit your changes:
1 git add -A && git commit -m "Configure project's remote repo"
Let’s now push the local Git repository upstream.
8. Uploading Your Local Git Directory to the Remote Repo
After successfully connecting your local directory to the remote repository, you can begin to push (upload) your local project upstream. Here’s how:
1 git push -u origin main
The command above instructs Git to push your local main branch’s .git directory to the remote origin branch on GitHub.
![]() |
Refreshing your remote repository’s page should now reflect your upload. |
Let’s look at how to write a test case for your package in the next chapter.

