-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): Turn Mintlify migrator into a CLI command (#5106)
- Loading branch information
1 parent
6e2c245
commit 11f3aa1
Showing
30 changed files
with
407 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## 0.46.20 | ||
**`(feat):`** The `fern init` command now supports a `--mintlify` option. You can pass in | ||
the path to your `mint.json` and the Fern CLI will generate a fern documentation | ||
website. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/cli/cli/src/commands/generate/checkOutputDirectory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
packages/cli/cli/src/commands/generate/generateAPIWorkspaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { MintlifyImporter } from "./MintlifyImporter"; | ||
export { runMintlifyMigration } from "./runMintlifyMigration"; |
49 changes: 49 additions & 0 deletions
49
packages/cli/docs-importers/mintlify/src/runMintlifyMigration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { FERN_DIRECTORY, PROJECT_CONFIG_FILENAME } from "@fern-api/configuration"; | ||
import { FernDocsBuilderImpl } from "@fern-api/docs-importer-commons"; | ||
import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; | ||
import { TaskContext } from "@fern-api/task-context"; | ||
import { writeFile } from "fs/promises"; | ||
import { MintlifyImporter } from "./MintlifyImporter"; | ||
|
||
interface RunMintlifyMigrationParams { | ||
absolutePathToMintJson: AbsoluteFilePath; | ||
outputPath: AbsoluteFilePath; | ||
taskContext: TaskContext; | ||
versionOfCli: string; | ||
} | ||
|
||
export async function runMintlifyMigration({ | ||
absolutePathToMintJson, | ||
outputPath, | ||
taskContext, | ||
versionOfCli | ||
}: RunMintlifyMigrationParams): Promise<void> { | ||
const mintlifyImporter = new MintlifyImporter({ | ||
context: taskContext | ||
}); | ||
|
||
const builder = new FernDocsBuilderImpl(); | ||
|
||
await mintlifyImporter.import({ | ||
args: { absolutePathToMintJson }, | ||
builder | ||
}); | ||
|
||
await builder.build({ outputDirectory: outputPath }); | ||
|
||
await writeFile( | ||
join( | ||
AbsoluteFilePath.of(outputPath), | ||
RelativeFilePath.of(FERN_DIRECTORY), | ||
RelativeFilePath.of(PROJECT_CONFIG_FILENAME) | ||
), | ||
JSON.stringify( | ||
{ | ||
version: versionOfCli, | ||
organization: "fern" | ||
}, | ||
undefined, | ||
4 | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
packages/cli/ete-tests/src/tests/init/fixtures/mintlify/mint.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "Test API", | ||
"logo": "/logo.png", | ||
"favicon": "/favicon.png", | ||
"colors": { | ||
"primary": "#0069ED", | ||
"light": "#4D9CFF", | ||
"dark": "#0050B4" | ||
}, | ||
"topbarLinks": [ | ||
{ | ||
"name": "Login", | ||
"url": "https://example.com/login" | ||
} | ||
], | ||
"topbarCtaButton": { | ||
"name": "Get Started", | ||
"url": "https://example.com/register" | ||
}, | ||
"navigation": [] | ||
} |
Oops, something went wrong.