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

fix(cli): Set instance when migrating Mintlify > Fern #5093

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions packages/cli/docs-importers/commons/src/FernDocsBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export abstract class FernDocsBuilder {
public abstract setLayout({ layout }: { layout: docsYml.RawSchemas.LayoutConfig }): void;

public abstract build({ outputDirectory }: { outputDirectory: AbsoluteFilePath }): void;

public abstract setInstance({ companyName }: { companyName: string }): string;
}

export abstract class FernDocsNavigationBuilder {
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/docs-importers/commons/src/FernDocsBuilderImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ export class FernDocsBuilderImpl extends FernDocsBuilder {
})
);
}

public setInstance({ companyName }: { companyName: string }): string {
// We may append a suffix to the company name string to make it harder for
// other companies to build migrators for our docs. For now, we're not doing
// so but we can add that easily in the future.
const formattedCompanyString = companyName.toLowerCase().replace(" ", "-");

const fernDocsUrl = `https://${formattedCompanyString}.docs.buildwithfern.com`;

this.docsYml.instances.push({
url: fernDocsUrl
});

return fernDocsUrl;
}
}

export class TabbedNavigationBuilderImpl implements FernDocsNavigationBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export class MintlifyImporter extends DocsImporter<MintlifyImporter.Args> {
}
}
this.context.logger.debug("Imported OpenAPI specs");

// We're currently setting one instance so that clients can generate docs out of the box,
// but they'll have the option to add additional instances and custom domains later.
const instanceUrl = builder.setInstance({
companyName: mint.name
});
this.context.logger.debug(`Added instance ${instanceUrl} to docs.yml`);
}

private async getNavigationBuilder({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
instances: []
instances:
- url: https://bland-ai.docs.buildwithfern.com
title: Bland AI
favicon: logo.png
logo:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
instances: []
instances:
- url: https://layer.docs.buildwithfern.com
title: Layer
favicon: favicon.png
logo:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
instances: []
instances:
- url: https://zep-documentation.docs.buildwithfern.com
title: Zep Documentation
favicon: logo/favicon.png
logo:
Expand Down
Loading