Skip to content
AstroPaper
Go back

How to update dependencies of AstroPaper

Edit page

Updating the dependencies of a project can be tedious. However, neglecting to update project dependencies is not a good idea either. In this post, I will share how I usually update my projects, focusing on AstroPaper as an example. Nonetheless, these steps can be applied to other js/node projects as well.

Forrest Gump Fake Quote

Table of contents

Open Table of contents

Updating Package Dependencies

There are several ways to update dependencies, and I’ve tried various methods to find the easiest path. One way to do it is by manually updating each package using npm install package-name@latest. This method is the most straightforward way of updating. However, it may not be the most efficient option.

My recommended way of updating dependencies is by using the npm-check-updates package. There’s a good article from freeCodeCamp about that, so I won’t be explaining the details of what it is and how to use that package. Instead, I’ll show you my typical approach.

First, install npm-check-updates package globally.

npm install -g npm-check-updates

Before making any updates, it’s a good idea to check all new dependencies that can be updated.

ncu

Most of the time, patch dependencies can be updated without affecting the project at all. So, I usually update patch dependencies first.

ncu -i --target patch

Then update minor dependencies.

ncu -i --target minor

Finally, update major dependencies one at a time to make sure nothing breaks.

ncu -i --target major

After updating, run the project and test everything:

npm install
npm run build

Updating AstroPaper template

Like other open source projects, AstroPaper is also evolving with bug fixes, feature updates etc. So if you happen to use AstroPaper as your blog template and want to update the template with latest features and fixes, you can do so by following the steps below.

Option 1: Using git merge

If you forked AstroPaper, you can merge upstream changes:

git remote add upstream https://github.com/satnaing/astro-paper.git
git fetch upstream
git merge upstream/main

Option 2: Manual update

For non-forked projects, check the CHANGELOG and manually apply relevant changes.

Conclusion

Keeping dependencies up to date is important for security and performance. Using tools like npm-check-updates makes the process more manageable.


Edit page
Share this post on:

Previous Post
Predefined color schemes
Next Post
Portfolio Website Development