From 27ef70f612464206184b428bbbd466f9560bee23 Mon Sep 17 00:00:00 2001 From: Gautam Singh <5769869+gautamsi@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:43:30 -0500 Subject: [PATCH] remove deprecated --fix option from postinstall --- .changeset/rotten-vans-vanish.md | 5 +++++ packages/core/src/scripts/cli.ts | 10 +--------- tests/cli-tests/artifacts.test.ts | 14 -------------- 3 files changed, 6 insertions(+), 23 deletions(-) create mode 100644 .changeset/rotten-vans-vanish.md diff --git a/.changeset/rotten-vans-vanish.md b/.changeset/rotten-vans-vanish.md new file mode 100644 index 00000000000..1a9924fef75 --- /dev/null +++ b/.changeset/rotten-vans-vanish.md @@ -0,0 +1,5 @@ +--- +"@keystone-6/core": major +--- + +Removed deprecated `fix` option from `postinstall` script diff --git a/packages/core/src/scripts/cli.ts b/packages/core/src/scripts/cli.ts index 5af75a4e39c..6d1422bbe31 100644 --- a/packages/core/src/scripts/cli.ts +++ b/packages/core/src/scripts/cli.ts @@ -9,7 +9,6 @@ import { telemetry } from './telemetry' export type Flags = { dbPush: boolean - fix: boolean // TODO: deprecated, remove in breaking change frozen: boolean prisma: boolean server: boolean @@ -58,9 +57,6 @@ export async function cli (cwd: string, argv: string[]) { prisma use prisma commands in a Keystone context Options - --fix (postinstall) @deprecated - do build the graphql or prisma schemas, don't validate them - --frozen (build, migrate) don't build the graphql or prisma schemas, only validate them @@ -116,11 +112,7 @@ export async function cli (cwd: string, argv: string[]) { // WARNING: postinstall is an alias for `build --frozen --no-ui` if (command === 'postinstall') { - return build(cwd, { - frozen: !defaultFlags(flags, { fix: false }).fix, - prisma: true, - ui: false, - }) + return build(cwd, { frozen: true, prisma: true, ui: false }) } console.log(`${command} is an unknown command`) diff --git a/tests/cli-tests/artifacts.test.ts b/tests/cli-tests/artifacts.test.ts index 9af15bc64a7..76d45faad66 100644 --- a/tests/cli-tests/artifacts.test.ts +++ b/tests/cli-tests/artifacts.test.ts @@ -45,20 +45,6 @@ const schemasMatch = ['schema.prisma', 'schema.graphql'] // because when they're slow and then run the same code as the postinstall command // (and in the case of the build command we need to spawn a child process which would make each case take a _very_ long time) describe('postinstall', () => { - test('updates the schemas without prompting when --fix is passed', async () => { - const cwd = await testdir({ - ...symlinkKeystoneDeps, - 'keystone.js': basicKeystoneConfig, - }) - - const recording = recordConsole() - await cliMock(cwd, ['postinstall', '--fix']) - const files = await getFiles(cwd, schemasMatch) - - expect(files).toEqual(await getFiles(`${__dirname}/fixtures/basic-project`, schemasMatch)) - expect(recording()).toMatchInlineSnapshot(`"? Generated GraphQL and Prisma schemas"`) - }) - test("does not prompt, error or modify the schemas if they're already up to date", async () => { const cwd = await testdir({ ...symlinkKeystoneDeps,