Closed Skiyee closed 4 months ago
The update involves enhancing the directory scanning functionality in a software project by introducing a new method to fetch subdirectories and refining existing methods for better path handling. Additionally, new Vue components were added to display simple messages, and the testing suite was updated to accommodate the new directory scanning capabilities.
File Path | Change Summary |
---|---|
packages/core/src/context.ts |
Added getSubPageDirs , updated scanSubPages to use new method, modified path logic in parsePages |
packages/core/src/files.ts |
Introduced getSubPageDirs function to fetch subdirectories |
.../pages-sub-more/home/pages/about/index.vue |
Added index.vue with a greeting message in 'about' directory |
.../pages-sub-more/home/pages/index.vue |
New index.vue as the home section index page |
.../pages-sub-more/user/pages/index.vue |
New index.vue as the user section index page |
test/generate.spec.ts |
Updated imports and test cases to support new directory scanning functionality |
🐰🌟✨
In the land of code, where directories sprawl,
A rabbit hopped, adjusting paths so tall.
With a flick and a function, subdirs align,
"Hello from pages!" they cheerfully chime.
Oh, what joy these new changes bring,
In the heart of the code, where rabbits sing!
🌟✨🐰
packages/core/src/files.ts (1)
`25-31`: The implementation of `getSubPageDirs` correctly retrieves directories using `fg.sync` with the `onlyDirectories` option.test/generate.spec.ts (3)
`1-1`: Correct addition of the `it` import from 'vitest' for use in test cases. --- `95-95`: Modification of `PageContext` instantiation aligns with the updated logic for handling pages without merging. --- `176-210`: The addition of the new test case to support glob patterns in `subPackages` is correctly implemented and necessary for verifying the new functionality.packages/core/src/context.ts (3)
`22-22`: Correct addition of `getSubPageDirs` to the import statements to support its usage in `scanSubPages`. --- `88-95`: The updated logic in `scanSubPages` correctly uses `getSubPageDirs` to handle deeper directory structures in subpackages. --- `248-249`: The modifications in `parsePages` correctly calculate the `basePath` and `root` paths, ensuring accurate path generation for nested directories.
修复当分包拥有二级目录以上时,root和path路径无法正确生成问题
Summary by CodeRabbit
New Features
Bug Fixes
Tests