Next V14 - Metadata to Viewport Export

This codemod migrates certain viewport metadata to viewport export.

Next.js
jscodeshift
Estimated time saving
~5 minutes/occurrence
Change mode
Autonomous
Applicability criteria

Next.js version higher or equal to 14.

Made by
Vercel
Vercel

Usage →

Codemod CLI:

intalling vs code extension tooltip icon
codemod next/14/metadata-to-viewport-export
copy CLI command icon

Codemod VS Code extension:

intalling vs code extension tooltip icon
vs code logo
Run in VS Code

Description

This codemod migrates certain viewport metadata to viewport export.

Before

export const metadata = {
	title: 'My App',
	themeColor: 'dark',
	viewport: {
		width: 1,
	},
};

After

export const metadata = {
	title: 'My App',
};
export const viewport = {
	width: 1,
	themeColor: 'dark',
};