Skip to content

Commit

Permalink
Lock file maintenance (#6890)
Browse files Browse the repository at this point in the history
* Lock file maintenance

* explicitly declare return type of createExpressServer

* Fix things

* Update createExpressServer.ts

* add runtime classic to problematic docs pages

* fix prisma clientVersion in tests

* Create happy-flies-do.md

* more docs runtime fixes

* more docs runtime fixes

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: gwyneplaine <cc.lee@live.com.au>
Co-authored-by: mitchellhamilton <mitchell@hamil.town>
  • Loading branch information
4 people committed Nov 16, 2021
1 parent dcdb8b6 commit 546b495
Show file tree
Hide file tree
Showing 21 changed files with 954 additions and 564 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-flies-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@keystone-next/keystone": patch
---

Explicitly declare return type on createExpressServer
1 change: 0 additions & 1 deletion docs/babel.config.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import {
createContext,
Expand Down
5 changes: 3 additions & 2 deletions docs/components/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { MDXProvider } from '@mdx-js/react';
import { jsx } from '@emotion/react';
import { ReactNode } from 'react';
import { ReactElement, ReactNode } from 'react';

import { H1, H2, H3, H4, H5, H6 } from '../components/docs/Heading';
import { Code, InlineCode } from '../components/primitives/Code';
Expand All @@ -27,7 +28,7 @@ export function Markdown({
children: ReactNode;
description: string;
}) {
const headings = getHeadings(children);
const headings = getHeadings((children as ReactElement).props.children);
const firstHeading = headings[0]?.label;

if (!firstHeading) {
Expand Down
1 change: 1 addition & 0 deletions docs/components/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { useRef, Fragment, ReactNode } from 'react';
import { useRouter } from 'next/router';
Expand Down
1 change: 1 addition & 0 deletions docs/components/docs/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';

Expand Down
1 change: 1 addition & 0 deletions docs/components/icons/Bulb.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';

Expand Down
1 change: 1 addition & 0 deletions docs/components/icons/Video.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';

Expand Down
1 change: 1 addition & 0 deletions docs/components/primitives/EditButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';

Expand Down
5 changes: 2 additions & 3 deletions docs/lib/getHeadings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ export type Heading = {
export function getHeadings(children: ReactNode): Heading[] {
return Children.toArray(children)
.filter((child: any) => {
return child.props?.mdxType && ['h1', 'h2', 'h3'].includes(child.props.mdxType);
return child.type && ['h1', 'h2', 'h3'].includes(child.type);
})
.map((child: any) => {
const childrenText = Array.isArray(child.props.children)
? child.props.children.join('').replace('[object Object]', '')
: child.props.children;
const depth =
(child.props?.mdxType && parseInt(child.props.mdxType.replace('h', ''), 0)) ?? 0;
const depth = (child.type && parseInt(child.type.replace('h', ''), 0)) ?? 0;
return {
id: depth > 0 ? `${slugify(childrenText)}` : '',
depth,
Expand Down
1 change: 1 addition & 0 deletions docs/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import { useRouter } from 'next/router';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/for-content-management.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import Image from 'next/image';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/for-developers.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import Image from 'next/image';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/for-organisations.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import Image from 'next/image';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import Image from 'next/image';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/updates/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { HTMLAttributes, ReactNode } from 'react';
import { jsx } from '@emotion/react';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/updates/roadmap.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { ComponentProps, Fragment, ReactNode } from 'react';
import { jsx } from '@emotion/react';
Expand Down
1 change: 1 addition & 0 deletions docs/pages/why-keystone.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react';
import Image from 'next/image';
Expand Down
9 changes: 8 additions & 1 deletion packages/keystone/src/lib/server/createExpressServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cors, { CorsOptions } from 'cors';
import express from 'express';
import { GraphQLSchema } from 'graphql';
import { graphqlUploadExpress } from 'graphql-upload';
import { ApolloServer } from 'apollo-server-express';
import type { KeystoneConfig, CreateContext, SessionStrategy, GraphQLConfig } from '../../types';
import { createSessionContext } from '../../session';
import { DEFAULT_FILES_STORAGE_PATH } from '../context/createFilesContext';
Expand Down Expand Up @@ -57,7 +58,13 @@ export const createExpressServer = async (
config: KeystoneConfig,
graphQLSchema: GraphQLSchema,
createContext: CreateContext
) => {
): Promise<{
expressServer: express.Express;
apolloServer: ApolloServer<{
req: IncomingMessage;
res: ServerResponse;
}>;
}> => {
const expressServer = express();

if (config.server?.cors) {
Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const expectPrismaError = (
args.map(({ path, message, code, target }) => ({
extensions: {
code: 'KS_PRISMA_ERROR',
prisma: { clientVersion: '3.4.0', code, meta: { target } },
prisma: { clientVersion: '3.4.2', code, meta: { target } },
},
path,
message,
Expand Down

0 comments on commit 546b495

Please sign in to comment.