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

feat(cli): Turn Mintlify migrator into a CLI command #5106

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

mattblank11
Copy link
Contributor

@mattblank11 mattblank11 commented Nov 5, 2024

Related to this card

This PR includes the functionality to run Mintlify migrations through the CLI. Some highlights in the PR:

  • Running fern init --mintlify <path-to-mint.json> will create the Fern docs in the directory that the command is run through
  • There's a function called runMintlifyMigration in @fern-api/mintlify-importer that actually runs the migration functionality
  • There's a function called initializeWithMintlify in /cli/init that ensures the mint.json file is valid, then calls runMintlifyMigration
  • There are unit tests for initializeWithMintlify to ensure that runMintlifyMigration only gets called if the mint.json file is valid
  • There's an ETE test for running the migration command, though I mentioned that's currently broken. I'm going to fix that this evening

@coderabbitai summary

Copy link

github-actions bot commented Nov 6, 2024

@mattblank11 mattblank11 changed the title feat(cli): Turn Mintlify migrator into a CLI command [WIP] feat(cli): Turn Mintlify migrator into a CLI command Nov 6, 2024
),
JSON.stringify(
{
version: "*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ideally this would be the latest version of fern available, wonder if we can pass that in from the cliContext in cli.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I believe I did this properly - let me know if not

}: { directory?: AbsoluteFilePath; openApiArg?: string } = {}): Promise<AbsoluteFilePath> {
openApiArg,
mintJsonArg
}: { directory?: AbsoluteFilePath; openApiArg?: string; mintJsonArg?: string } = {}): Promise<AbsoluteFilePath> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would probably make this accept a discriminated union of args and it can either be openapi or mintlify (cause i dont think --openapi and --mintlify together would work)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsinghvi Took a slightly different path vs. a discriminated union but achieved a similar outcome. Let me know what you think!

@dsinghvi
Copy link
Member

dsinghvi commented Nov 6, 2024

Up to add a changelog entry to cli/versions/versions.yml

The Fern CLI now supports initializing with a Mintlify project.
type: fix
irVersion: 53
version: 0.45.0-rc33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would just pull from main to confirm there is no merge conflict

Copy link
Member

@dsinghvi dsinghvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix init.test.ts.snap and make sure its easy to see the generated fern directory in a string format, otherwise good to merge! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants