Skip to content

Commit cf25245

Browse files
committed
fix: 🐛 package options
1 parent 894cddf commit cf25245

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

packages/core/src/constants/options.constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const defaultPackageOptions: RequiredKeys<
1414
| "fileNameMapper"
1515
| "nameMapper"
1616
| "kindMapper"
17+
| "hasPackagePage"
1718
>
1819
> = {
1920
logo: "",
@@ -23,7 +24,6 @@ export const defaultPackageOptions: RequiredKeys<
2324
readmeName: "README.md",
2425
readmeDir: "",
2526
showImports: true,
26-
addPackagePage: true,
2727
orderCategories: {},
2828
excludeCategories: ["Namespaces"],
2929
};

packages/core/src/parsing/docs.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const buildDocs = async (
2222
extra: { instanceDate: string; instanceFile: string },
2323
// eslint-disable-next-line max-params
2424
) => {
25-
const { packages, tsConfigPath, addMonorepoPage = true } = pluginOptions;
25+
const { packages, tsConfigPath, addMonorepoPage = true, addPackagePage = true } = pluginOptions;
2626
const isMonorepo = packages.length > 1;
2727

2828
const isEnabledMonorepo = packages.filter((pkg) => pkg.generateMdx).length > 1;
@@ -56,7 +56,7 @@ export const buildDocs = async (
5656
packageOptionsPath,
5757
mdxOutDir,
5858
packageDocsJsonPath,
59-
addPackagePage = true,
59+
hasPackagePage,
6060
} = getPackageOptions(packages, packageOptions, docsGenerationDir, generatedFilesDir, tsConfigPath, isMonorepo);
6161

6262
/**
@@ -65,10 +65,12 @@ export const buildDocs = async (
6565
trace(`Setup package directories for ${cleanFileName(packageOptions.title)}`, packageName);
6666
createFile(packageOptionsPath, JSON.stringify(pkgMeta));
6767

68+
const shouldCreateIndexPage = hasPackagePage !== undefined ? hasPackagePage : addPackagePage;
69+
6870
/**
6971
* Generate package page from readme or custom setup
7072
*/
71-
if (pluginOptions.generateMdx && addPackagePage) {
73+
if (pluginOptions.generateMdx && shouldCreateIndexPage) {
7274
trace(`Generating package page`, packageName);
7375
generatePackagePage(mdxOutDir, packageOptions);
7476
}

packages/core/src/types/package.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export type PackageOptions = {
5353
readmeName?: string;
5454
readmeDir?: string;
5555
showImports?: boolean;
56-
addPackagePage?: boolean;
56+
hasPackagePage?: boolean;
5757
generateMdx?: boolean;
5858
orderCategories?: Record<string, number>;
5959
excludeCategories?: string[];

0 commit comments

Comments
 (0)