Skip to content

Commit

Permalink
remove deprecated --fix option from postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi committed Sep 5, 2024
1 parent a8a3913 commit 27ef70f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-vans-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@keystone-6/core": major
---

Removed deprecated `fix` option from `postinstall` script
10 changes: 1 addition & 9 deletions packages/core/src/scripts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`)
Expand Down
14 changes: 0 additions & 14 deletions tests/cli-tests/artifacts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 27ef70f

Please sign in to comment.