Skip to content

Commit

Permalink
add defaults check
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSchndr committed Sep 15, 2022
1 parent b217891 commit d75de1b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v1.0.5

* add defaults check

## v1.0.4 - v1.0.1

* Optimizations & bug fixing
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vitepress-plugin-auto-sidebar",
"repository": "git://github.com/JonathanSchndr/vitepress-plugin-auto-sidebar.git",
"version": "1.0.4",
"version": "1.0.5",
"description": "Generate the VitePress sidebar through the folder structure.",
"files": [
"dist"
Expand Down
10 changes: 5 additions & 5 deletions src/vitepress-plugin-auto-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
Options
} from './vitepress-plugin-auto-sidebar.d';

export const getSidebar = (options: Options) => {
options.contentRoot = options.contentRoot ?? '/';
options.contentDirs = options.contentDirs ?? null;
options.collapsible = options.collapsible ?? true;
options.collapsed = options.collapsed ?? true;
export const getSidebar = (options: Options = {}) => {
options.contentRoot = options?.contentRoot ?? '/';
options.contentDirs = options?.contentDirs ?? null;
options.collapsible = options?.collapsible ?? true;
options.collapsed = options?.collapsed ?? true;

options.contentRoot = path.join(process.cwd(), options.contentRoot)
const dir = fs.readdirSync(options.contentRoot).filter((file: string) => (options.contentDirs === null || options.contentDirs?.indexOf(file) !== -1) && fs.statSync(path.join(options.contentRoot, file)).isDirectory());
Expand Down

0 comments on commit d75de1b

Please sign in to comment.