Upgrades

Learn how to smoothly upgrade from one version to the next.

General instructions

Nitropage versions are managed via the package.json file in your project folder. Make sure to update the versions of all related dependencies. To automatically update just the Nitropage dependencies to their latest versions, run the following command:

pnpm up "@npio/*" nitropage

Alternatively you can also run pnpm up, to update all dependencies of your project.

Afterwards you should apply database schema changes by running:

pnpm np update -m

Updating the 'src' folder

If you didn't make any changes to your projects src folder, you can run the following command, which will update the whole folder including all blueprints, styles, configs, etc.

WARNING: Make sure that your project is fully versioned before running the commands below, otherwise you risk loosing data!

NP_REPO_URL=https://codeberg.org/nitropage/nitropage
NP_STARTER=$NP_REPO_URL/packages/starter
NP_STARTER_RAW=$NP_REPO_URL/raw/branch/next/packages/starter

npx tiged -f $NP_STARTER/src#next src
curl $NP_STARTER_RAW/tailwind.config.cjs > tailwind.config.cjs

Updating blueprints

The starter kit comes with several blueprints that are in your control, allowing you to change their code, functionality and appearance. On the other hand, if you leave their code as is, you can easily update them to the latest state:

WARNING: Make sure that your project is fully versioned before running the commands below, otherwise you risk loosing data!

NP_REPO_URL=https://codeberg.org/nitropage/nitropage
NP_STARTER=$NP_REPO_URL/packages/starter
NP_STARTER_RAW=$NP_REPO_URL/raw/branch/next/packages/starter

npx tiged -f $NP_STARTER/src/blueprints#next src/blueprints
npx tiged -f $NP_STARTER/src/components#next src/components

curl $NP_STARTER_RAW/src/app.css > src/app.css
curl $NP_STARTER_RAW/tailwind.config.cjs > tailwind.config.cjs

Keep in mind that this doesn't delete any old files and doesn't take care of file renamings, that might have occured in newer starter kit versions. E.g. if a blueprint was renamed from faq.np.tsx to accordion.np.tsx, you have to manually delete the old faq.np.tsx file.

v0.59

This version includes extensive changes in the internal architecture of Nitropage, which also asked for a complete rework of the starter kit structure. Learn more about the changes in the Nitropage v0.59 prerelease announcement.

Updating existing <0.59 projects in-place to v0.59 is not recommended. Instead generate a fresh starter project and move needed files from the old project to the new one. Please backup your project before you continue!

These commands will move the files from your old project to a new one. Please adjust them for your specific needs:

# Moving db related files
mv old-project/prisma/migrations new-project/prisma/
mv old-project/prisma/dev.db new-project/.data/

# Moving the storage folders
mv old-project/public/media new-project/.data/storage/public/
mv old-project/public/fonts new-project/.data/storage/public/

# Cleaning up obsolete cache folders
rm -r new-project/.data/storage/public/media/cache
rm -r new-project/.data/storage/public/media/min

# Moving the .git versioning folder
mv old-project/.git new-project/

Afterwards copy atleast the following variables from the old .env file to the new one:

  • NP_AUTH_SALT
  • NP_AUTH_IRON_PASSWORD renamed to NP_AUTH_PASSWORD

Last but not least, you should apply the database schema changes:

pnpm np update -m