Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@progfay/nextjs-ssg-rewrite-rule-gen

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@progfay/nextjs-ssg-rewrite-rule-gen

generate nginx rewrite rules for Next.js SSG (Pages Router)

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-25.55%
Maintainers
1
Weekly downloads
 
Created
Source

@progfay/nextjs-ssg-rewrite-rule-gen

Description

Next.js supports Static Exports.

However, it's a lot of work to manage the routing for the generated file without Vercel. Dynamic Routes feature makes routing more difficult.

This application automatically generates nginx rewrite rules for generated files.

Requirements

Installation

npm install -D @progfay/nextjs-ssg-rewrite-rule-gen

Configuration

[!NOTE] This application is available with zero configuration.

You can run this application with config in following command: nextjs-ssg-rewrite-rule-gen --config config.json

{
	"pagesDirPath": "apps/src/pages",
	"ignoreRoutes": ["/debug"],
  "nginxConfigs": [
    {
      "pattern": "^/credential$",
      "directives": ["add_header Cache-Control \"no-store\";"]
    }
  ],
	"basePath": "/app",
	"trailingSlash": true
}

Available configs:

How to work

pages directory:

pages
└── user
    ├── [id]
        └── index.js
    └── new
        └── index.js

Generated files with Static Exports (next build and output: "export"):

out
└── user
    ├── [id].html
    └── new.html

nginx rewrite rules (generated by @progfay/nextjs-ssg-rewrite-rule-gen):

location ~ ^/user/new/?$ {
  rewrite ^/user/new/?$ /user/new.html break;
}

location ~ ^/user/[^/]+?/?$ {
  rewrite ^/user/[^/]+?/?$ /user/[id].html break;
}

FAQs

Package last updated on 17 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc