Remove forest types from versioning

Forest types generate a lot of noise during PR reviews and create a lot of conflicts.
So I would like to remove it from my repo and to generate it manually with a script running just before starting my server (with the forest agent).
Unfortunately I can’t do that because the methods to generate the types are private and can only be started with the full agent (cf here).

What should I do ?

Additional note: even if I cannot reproduce, I believe that schema types are not deterministic (i.e. same code can produce a different type file).

Context

  • Agent type & version:
    @forestadmin/agent”: “1.4.4”
    @forestadmin/datasource-sql”: “1.1.4”

Hello @leonard_henriquez,

  • Are you using typescript in your project?

You will lose auto-completion if you do so. Could you just add the ./typings.ts to your .gitignore?

PS: I’m not sure if you were talking about autocompletion and typings or about the .forestadmin-schema.json.

Hello Leonard

You can skip typing generation by not providing the related option

To generate them on demand, use an environment variable to set the option conditionally

createAgent({
  typingsPath: process.env.FOREST_GENERATE_TYPING_FILE ? 'src/typings.ts' : undefined
})

But then, the generated file really should be deterministic.
What changes when you restart that should not? Field ordering?

1 Like

I’m talking about typescript types :slightly_smiling_face:

Hey @leonard_henriquez,

In this case, the answer form @romaing is the right one.

Is this workaround ok for you?

Kind regards,
Morgan

It seems to work, thank you !

1 Like