Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated --fix option from postinstall #9190

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
---

Remove the deprecated `--fix` flag from `keystone postinstall`
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
Loading