From 907f7b102c2fd541fd4df8d45331795ee062ca73 Mon Sep 17 00:00:00 2001 From: Daniel Cousens <413395+dcousens@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:10:17 +1100 Subject: [PATCH] Remove embedded keystone functionality (#8315) Co-authored-by: Daniel Cousens --- .changeset/seven-papayas-boris.md | 5 ++ packages/core/next/package.json | 4 -- packages/core/package.json | 5 -- .../admin-ui/next-config.ts | 1 - packages/core/src/next.ts | 57 ------------------- 5 files changed, 5 insertions(+), 67 deletions(-) create mode 100644 .changeset/seven-papayas-boris.md delete mode 100644 packages/core/next/package.json delete mode 100644 packages/core/src/next.ts diff --git a/.changeset/seven-papayas-boris.md b/.changeset/seven-papayas-boris.md new file mode 100644 index 00000000000..1176894049a --- /dev/null +++ b/.changeset/seven-papayas-boris.md @@ -0,0 +1,5 @@ +--- +'@keystone-6/core': major +--- + +Removes `@keystone-6/core/next` from our exports diff --git a/packages/core/next/package.json b/packages/core/next/package.json deleted file mode 100644 index 02a1fcf468d..00000000000 --- a/packages/core/next/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "main": "dist/keystone-6-core-next.cjs.js", - "module": "dist/keystone-6-core-next.esm.js" -} diff --git a/packages/core/package.json b/packages/core/package.json index 1394e0b1c43..730cfc17ba2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -6,10 +6,6 @@ "main": "dist/keystone-6-core.cjs.js", "module": "dist/keystone-6-core.esm.js", "exports": { - "./next": { - "module": "./next/dist/keystone-6-core-next.esm.js", - "default": "./next/dist/keystone-6-core-next.cjs.js" - }, ".": { "module": "./dist/keystone-6-core.esm.js", "default": "./dist/keystone-6-core.cjs.js" @@ -310,7 +306,6 @@ "entrypoints": [ "index.ts", "system.ts", - "next.ts", "___internal-do-not-use-will-break-in-patch/load-config.ts", "___internal-do-not-use-will-break-in-patch/artifacts.ts", "___internal-do-not-use-will-break-in-patch/admin-ui/pages/*/index.tsx", diff --git a/packages/core/src/___internal-do-not-use-will-break-in-patch/admin-ui/next-config.ts b/packages/core/src/___internal-do-not-use-will-break-in-patch/admin-ui/next-config.ts index 1cec1ebaaa7..9d89f073d1d 100644 --- a/packages/core/src/___internal-do-not-use-will-break-in-patch/admin-ui/next-config.ts +++ b/packages/core/src/___internal-do-not-use-will-break-in-patch/admin-ui/next-config.ts @@ -20,7 +20,6 @@ export const config = withPreconstruct({ config.externals = [ ...config.externals, /@keystone-6\/core(?!\/___internal-do-not-use-will-break-in-patch\/admin-ui\/id-field-view|\/fields\/types\/[^\/]+\/views)/, - '.prisma/client', ]; // we need to set these to true so that when __dirname/__filename is used // to resolve the location of field views, we will get a path that we can use diff --git a/packages/core/src/next.ts b/packages/core/src/next.ts deleted file mode 100644 index 4209eaa3eb5..00000000000 --- a/packages/core/src/next.ts +++ /dev/null @@ -1,57 +0,0 @@ -import execa from 'execa'; -// @ts-ignore -import withPreconstruct from '@preconstruct/next'; - -let hasAlreadyStarted = false; - -export const withKeystone = - (internalConfig: any = {}) => - ( - phase: - | 'phase-export' - | 'phase-production-build' - | 'phase-production-server' - | 'phase-development-server', - thing: any - ) => { - if (phase === 'phase-production-build') { - execa.sync('node', [require.resolve('@keystone-6/core/bin/cli.js'), 'postinstall'], { - stdio: 'inherit', - }); - } - if (phase === 'phase-development-server' && !hasAlreadyStarted) { - hasAlreadyStarted = true; - - const cliPath = require.resolve('@keystone-6/core/bin/cli.js'); - - execa.sync('node', [cliPath, 'postinstall', '--fix'], { - stdio: 'inherit', - }); - // for some reason things blow up with EADDRINUSE if the dev call happens synchronously here - // so we wait a sec and then do it - setTimeout(() => { - execa('node', [cliPath], { - stdio: 'inherit', - env: { ...process.env, PORT: process.env.PORT || '8000' }, - }); - }, 100); - } - let internalConfigObj = - typeof internalConfig === 'function' ? internalConfig(phase, thing) : internalConfig; - - let originalWebpack = internalConfigObj.webpack; - internalConfigObj.webpack = (webpackConfig: any, options: any) => { - if (options.isServer) { - webpackConfig.externals = [ - ...webpackConfig.externals, - '@keystone-6/core/___internal-do-not-use-will-break-in-patch/api', - '@keystone-6/core/___internal-do-not-use-will-break-in-patch/next-graphql', - '@keystone-6/core/next', - '@keystone-6/core/system', - '.prisma/client', - ]; - } - return originalWebpack ? originalWebpack(webpackConfig, options) : webpackConfig; - }; - return withPreconstruct(internalConfigObj); - };