Skip to content

Commit

Permalink
Add support for onlyDirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jul 20, 2024
1 parent 9af4cb3 commit 7499ed6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/plugins/markdown-pages/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ import { reshape } from './hydrate.js';
* @typedef {object} Options
* @property {string | undefined} [ src ]
* @property {Group[] | undefined} [ groups ]
* @property {Group[] | undefined} [ onlyDirectories ]
*
* @param {Options} options
* @return {Promise<import('./types.ts').Manifest>}
*/
export async function discover({ groups, src }) {
export async function discover({ groups, src, onlyDirectories }) {
groups ??= [];

let groupsToLookFor = new Set();

if (src) {
groupsToLookFor.add({ name: 'root', src });
groupsToLookFor.add({ name: 'root', src, onlyDirectories });
}

groups.map((group) => groupsToLookFor.add(group));
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/markdown-pages/markdown-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SECRET_INTERNAL_IMPORT = 'kolay/manifest:virtual';

/** @type {(options: import('./types.ts').MarkdownPagesOptions) => import('unplugin').UnpluginOptions} */
export const markdownPages = (options) => {
let { src, dest, name, groups } = options ?? {};
let { src, dest, name, groups, onlyDirectories } = options ?? {};

const destination = dest ?? 'kolay-manifest';

Expand Down Expand Up @@ -43,7 +43,7 @@ export const markdownPages = (options) => {
`use the 'groups' key.`
);

const reshaped = await discover({ src, groups });
const reshaped = await discover({ src, groups, onlyDirectories });

Check failure on line 46 in src/plugins/markdown-pages/markdown-pages.js

View workflow job for this annotation

GitHub Actions / Browser Tests

Type 'boolean | undefined' is not assignable to type 'Group[] | undefined'.

Check failure on line 46 in src/plugins/markdown-pages/markdown-pages.js

View workflow job for this annotation

GitHub Actions / Node Tests

Type 'boolean | undefined' is not assignable to type 'Group[] | undefined'.

Check failure on line 46 in src/plugins/markdown-pages/markdown-pages.js

View workflow job for this annotation

GitHub Actions / Lint

Type 'boolean | undefined' is not assignable to type 'Group[] | undefined'.

if (groups) {
groups.forEach((group) => {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/markdown-pages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type GatheredDocs = Array<{ mdPath: string; config?: object }>;

export interface MarkdownPagesOptions {
src?: string | undefined;
onlyDirectories?: boolean;
groups: {
name: string;
src: string;
Expand Down

0 comments on commit 7499ed6

Please sign in to comment.