-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove all non ES5/ES Modules syntax from generated Admin UI files (#…
- Loading branch information
Showing
18 changed files
with
135 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@keystone-next/admin-ui': major | ||
'@keystone-next/auth': major | ||
--- | ||
|
||
Removed all syntax that is not ES5 + ES Modules in the generated Admin UI pages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Architecture | ||
|
||
TODO: the rest of this | ||
|
||
## Invariants | ||
|
||
- Generated files for the Admin UI should only contain valid ES5 + ES Modules because Keystone should not make assumptions about the user's Babel config. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"main": "dist/admin-ui.cjs.js", | ||
"module": "dist/admin-ui.esm.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { KeystoneProvider } from '../../context'; | ||
import { ErrorBoundary } from '../../components'; | ||
import { Core } from '@keystone-ui/core'; | ||
import { AppProps } from 'next/app'; | ||
import { DocumentNode } from 'graphql'; | ||
import { AdminConfig, FieldViews } from '@keystone-next/types'; | ||
|
||
type AppConfig = { | ||
adminConfig: AdminConfig; | ||
adminMetaHash: string; | ||
fieldViews: FieldViews; | ||
lazyMetadataQuery: DocumentNode; | ||
}; | ||
|
||
export const getApp = (props: AppConfig) => ({ Component, pageProps }: AppProps) => { | ||
return ( | ||
<Core> | ||
<KeystoneProvider {...props}> | ||
<ErrorBoundary> | ||
<Component {...pageProps} /> | ||
</ErrorBoundary> | ||
</KeystoneProvider> | ||
</Core> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,2 @@ | ||
import type { BaseKeystone } from '@keystone-next/types'; | ||
|
||
export const homeTemplate = (lists: BaseKeystone['lists']) => | ||
` | ||
import React from 'react'; | ||
import { HomePage } from '@keystone-next/admin-ui/pages/HomePage'; | ||
import { gql } from '@keystone-next/admin-ui/apollo'; | ||
export default function Home() { | ||
return <HomePage query={gql\` | ||
query { | ||
keystone { | ||
adminMeta { | ||
lists { | ||
key | ||
fields { | ||
path | ||
createView { | ||
fieldMode | ||
} | ||
} | ||
} | ||
} | ||
} | ||
${Object.entries(lists) | ||
.map(([listKey, list]) => `${listKey}: ${list.gqlNames.listQueryMetaName} { count }`) | ||
.join('\n')} | ||
}\`} />; | ||
}`; | ||
export const homeTemplate = `export { HomePage as default } from '@keystone-next/admin-ui/pages/HomePage'; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
export const itemTemplate = (listKey: string) => | ||
` | ||
import React from 'react'; | ||
`import { getItemPage } from '@keystone-next/admin-ui/pages/ItemPage'; | ||
import { ItemPage } from '@keystone-next/admin-ui/pages/ItemPage'; | ||
export default function Item() { | ||
return <ItemPage listKey="${listKey}" />; | ||
} | ||
`; | ||
export default getItemPage(${JSON.stringify({ listKey })}) | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
export const listTemplate = (listKey: string) => | ||
` | ||
import React from 'react'; | ||
`import { getListPage } from '@keystone-next/admin-ui/pages/ListPage'; | ||
import { ListPage } from '@keystone-next/admin-ui/pages/ListPage'; | ||
export default function List() { | ||
return <ListPage listKey="${listKey}" />; | ||
} | ||
`; | ||
export default getListPage(${JSON.stringify({ listKey })}); | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
import type { KeystoneConfig } from '@keystone-next/types'; | ||
|
||
export const noAccessTemplate = (session: KeystoneConfig['session']) => | ||
` | ||
import React from 'react'; | ||
`import { getNoAccessPage } from '@keystone-next/admin-ui/pages/NoAccessPage'; | ||
import { NoAccessPage } from '@keystone-next/admin-ui/pages/NoAccessPage'; | ||
export default function Home() { | ||
return <NoAccessPage sessionsEnabled={${!!session}} />; | ||
} | ||
`; | ||
export default getNoAccessPage(${JSON.stringify({ sessionsEnabled: !!session })}) | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c63e5d7
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.
Successfully deployed to the following URLs: