In this blog, I will be releasing my til_tracker
project with npm
Process for creating a release
- Create an account for npm.
- Ensure you have
package.json
file in the root directory. - Add/Update
README.md
file go give full instructions on how to your code. -
Tag your release, using
npm version 1.0.0 -m "Release v1.0.0"
- Push the new tag to GitHub, using
git push origin main --tags
- Enter
npm login
in the terminal to log in to npm first. - Use
npm publish --access public
for final release. - Now, you can run
npm i til_tracker
. https://www.npmjs.com/package/til_tracker
Automate Release Process with GitHub Actions
Following cd.yml
was implemented to automate a new release whenever a new tag is pushed to the main branch.
// .github/workflows/cd.yml
name: cd
on:
push:
tags:
- 'v**'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v1
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install node dependencies
run: npm ci
- name: Build
run: npm run build
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
*NOTE: you need to set up an access token from npm. Click your profile, and you will see "Access Tokens". Copy the access token and paste the token in GitHub Settings/Secrets, as NPM_TOKEN
.
Installation Guide
- Run
npm i til_tracker
in the terminal - Run
cd node_modules/til_tracker
to go to the root directory of thetil_tracker
- Install
ts-node
if your current project does not have one - Now you can use the
til_tracker
User Testing
It was noted that the documentation lacked information on certain prerequisites essential for executing til_tracker
. Specifically, the current documentation omitted two crucial steps: the requirement of ts-node
as a prerequisite and the necessity for the user to navigate to the root directory of til_tracker
in node_modules
to enable the use of til_tracker
. So, adjustments were made to the README.md
file to incorporate these details. Following these changes, the instructions in the README.md
file became more user-friendly, allowing my reviewer to use it without any issues.
You can find the complete README.md
file in here: README.md
Top comments (0)