🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

graffiti-plugin-next

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graffiti-plugin-next

Next.js plugin for Graffiti framework

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Next.js plugin for Graffiti.js

Create Next.js pages with Graffiti.js GraphQL backend.

Installation

npm install graffiti-plugin-next next react react-dom

Note: Next.js, React and React-DOM are peer dependencies and should be installed along with the plugin.

Usage

Create a graffiti.config.js in your project

const nextPlugin = require('graffiti-plugin-next');

module.exports = {
  mongoUrl: 'mongodb://localhost/graffiti',
  plugins: [nextPlugin()],
};

Development mode

By default Graffiti will use nodemon in development mode to auto-restart server on file changes.
This makes Next.js development experience suboptimal. If you wish to use hot reload provided by Next.js, you'll need to create custom nodemon.json config that ignores changes to pages/ folder, e.g.:

{
  "ignore": [".git", "node_modules", "pages/**/*"]
}

Building for production

Please remember that to create Next.js build for production you need to execute next build manually as usual, e.g.:

{
  "name": "example-plugin-next",
  "scripts": {
    "start": "NODE_ENV=production graffiti",
    "build": "next build",
    "develop": "graffiti dev"
  },
  "dependencies": {
    "graffiti": "*",
    "graffiti-plugin-next": "*",
    "next": "*",
    "react": "*",
    "react-dom": "*"
  }
}

Keywords

graffiti

FAQs

Package last updated on 14 Sep 2020

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