-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PFX-637] Support create App Router #777
Changes from all commits
094499f
b63cbe9
82d1582
cb7e512
a327abf
3e9a7d0
030f993
e9c874e
6e788c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default function RootLayout({ children }) { | ||
return ( | ||
<html lang='en'> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
} | ||
|
||
RootLayout.propTypes = { | ||
children: PropTypes.node | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import IndexPage from '../components/index-page'; | ||
|
||
export const metadata = { | ||
title: 'Home', | ||
description: 'A basic gasket app', | ||
charset: 'UTF-8' | ||
}; | ||
|
||
export default IndexPage |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import IndexPage from '../components/index-page'; | ||
|
||
export default IndexPage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,26 @@ | |
/** @type {import('@gasket/core').HookHandler<'prompt'>} */ | ||
module.exports = async function promptHook(gasket, context, { prompt }) { | ||
const newContext = { ...context }; | ||
|
||
if (!('useAppRouter' in context)) { | ||
const { useAppRouter } = await prompt([ | ||
{ | ||
name: 'useAppRouter', | ||
message: 'Do you want to use the App Router? (experimental)', | ||
type: 'confirm', | ||
default: false | ||
} | ||
]); | ||
|
||
newContext.useAppRouter = useAppRouter; | ||
} | ||
|
||
if (newContext.useAppRouter) { | ||
newContext.nextServerType = 'defaultServer'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't this line get skipped if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a check outside of the useAppRouter prompt
|
||
} | ||
|
||
// TODO - evaluate if these prompts should be moved to the preset | ||
if (!('nextServerType' in context)) { | ||
if (!('nextServerType' in context) && !newContext.useAppRouter) { | ||
const { nextServerType } = await prompt([ | ||
{ | ||
name: 'nextServerType', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't presume
lang='en'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eslint looks for a lang value here
<html> elements must have the lang prop jsx-a11y/html-has-lang
.What would be a good default for this?
Would
en
be safe for the boilerplate code?