DEV Community

Cover image for A dependency to deploy Next apps to GitHub Pages ⚡
Welcoming Sloth
Welcoming Sloth

Posted on

1

A dependency to deploy Next apps to GitHub Pages ⚡

Recently I made a small tool named neght, heavily inspired by storybook-deployer, to help developers deploy their static Next.js apps to GitHub Pages.

Preview

What is Neght 💭

Neght is a tool / dependency you can add to your project to easily deploy it to GitHub Pages. It builds the project in a way that's compatible with GitHub Pages and then pushes it to a designated branch.

How it works 👩‍🔧

First, configure your Next app to be static site, which consists of adding output: 'export' to your next config.

Then, add neght as a dependency (yarn add neght).

Finally, add neght as a script to your package.json.

"scripts": {
  "build": "next build",
  "deploy": "neght --script build --branch gh-pages"
}
Enter fullscreen mode Exit fullscreen mode

That's it! Now when you run the deploy script neght will take care of building your Next project and pushing it to gh-pages branch of your repository.

All that remains for you to do is to make sure that GitHub serves the gh-pages branch through GitHub Pages and you're all done.

Links 🔗

GitHub: https://github.com/Tomburgs/neght
npm: https://www.npmjs.com/package/neght

AI Agent image

How to Build an AI Agent with Semantic Kernel (and More!)

Join Developer Advocate Luce Carter for a hands-on tutorial on building an AI-powered dinner recommendation agent. Discover how to integrate Microsoft Semantic Kernel, MongoDB Atlas, C#, and OpenAI for ingredient checks and smart restaurant suggestions.

Watch the video 📺

Top comments (1)

Collapse
 
no2ehi profile image
Ruholah

thanks man.

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay