DEV Community

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

Posted on

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

Top comments (1)

Collapse
 
no2ehi profile image
Ruholah

thanks man.