diff --git a/packages/core/src/constants/options.constants.ts b/packages/core/src/constants/options.constants.ts index d9107d0..f984bf5 100644 --- a/packages/core/src/constants/options.constants.ts +++ b/packages/core/src/constants/options.constants.ts @@ -14,6 +14,7 @@ export const defaultPackageOptions: RequiredKeys< | "fileNameMapper" | "nameMapper" | "kindMapper" + | "hasPackagePage" > > = { logo: "", @@ -23,7 +24,6 @@ export const defaultPackageOptions: RequiredKeys< readmeName: "README.md", readmeDir: "", showImports: true, - addPackagePage: true, orderCategories: {}, excludeCategories: ["Namespaces"], }; diff --git a/packages/core/src/parsing/docs.ts b/packages/core/src/parsing/docs.ts index 4505e5b..211889c 100644 --- a/packages/core/src/parsing/docs.ts +++ b/packages/core/src/parsing/docs.ts @@ -22,7 +22,7 @@ export const buildDocs = async ( extra: { instanceDate: string; instanceFile: string }, // eslint-disable-next-line max-params ) => { - const { packages, tsConfigPath, addMonorepoPage = true } = pluginOptions; + const { packages, tsConfigPath, addMonorepoPage = true, addPackagePage = true } = pluginOptions; const isMonorepo = packages.length > 1; const isEnabledMonorepo = packages.filter((pkg) => pkg.generateMdx).length > 1; @@ -56,7 +56,7 @@ export const buildDocs = async ( packageOptionsPath, mdxOutDir, packageDocsJsonPath, - addPackagePage = true, + hasPackagePage, } = getPackageOptions(packages, packageOptions, docsGenerationDir, generatedFilesDir, tsConfigPath, isMonorepo); /** @@ -65,10 +65,12 @@ export const buildDocs = async ( trace(`Setup package directories for ${cleanFileName(packageOptions.title)}`, packageName); createFile(packageOptionsPath, JSON.stringify(pkgMeta)); + const shouldCreateIndexPage = hasPackagePage !== undefined ? hasPackagePage : addPackagePage; + /** * Generate package page from readme or custom setup */ - if (pluginOptions.generateMdx && addPackagePage) { + if (pluginOptions.generateMdx && shouldCreateIndexPage) { trace(`Generating package page`, packageName); generatePackagePage(mdxOutDir, packageOptions); } diff --git a/packages/core/src/types/package.types.ts b/packages/core/src/types/package.types.ts index efbbef3..5a3ec56 100644 --- a/packages/core/src/types/package.types.ts +++ b/packages/core/src/types/package.types.ts @@ -53,7 +53,7 @@ export type PackageOptions = { readmeName?: string; readmeDir?: string; showImports?: boolean; - addPackagePage?: boolean; + hasPackagePage?: boolean; generateMdx?: boolean; orderCategories?: Record; excludeCategories?: string[];