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: added cname options for CNAME file #1834

Merged
merged 3 commits into from Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/lib/output/renderer.ts
Expand Up @@ -126,6 +126,10 @@ export class Renderer extends ChildableComponent<
@BindOption("cleanOutputDir")
cleanOutputDir!: boolean;

/** @internal */
@BindOption("cname")
cname!: string;

/** @internal */
@BindOption("gaID")
gaID!: string;
Expand Down Expand Up @@ -376,6 +380,10 @@ export class Renderer extends ChildableComponent<
}
}

if (this.cname) {
fs.writeFileSync(path.join(directory, "CNAME"), this.cname);
}

return true;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/options/declaration.ts
Expand Up @@ -91,6 +91,7 @@ export interface TypeDocOptionMap {
defaultCategory: string;
categoryOrder: string[];
categorizeByGroup: boolean;
cname: string;
sort: SortStrategy[];
gitRevision: string;
gitRemote: string;
Expand Down
4 changes: 4 additions & 0 deletions src/lib/utils/options/sources/typedoc.ts
Expand Up @@ -208,6 +208,10 @@ export function addTypeDocOptions(options: Pick<Options, "addDeclaration">) {
type: ParameterType.Boolean,
defaultValue: true,
});
options.addDeclaration({
name: "cname",
help: "Set the CNAME file text, it's useful for custom domains on GitHub Pages.",
});
options.addDeclaration({
name: "sort",
help: "Specify the sort strategy for documented values.",
Expand Down