Organised terminal usage examples into function-based folders#707
Organised terminal usage examples into function-based folders#707rachelpatrao wants to merge 2 commits intothoth-tech:mainfrom
Conversation
❌ Deploy Preview for splashkit failed.
|
ralphweng2023
left a comment
There was a problem hiding this comment.
Peer Review
I've reviewed this PR which reorganises terminal usage examples into function-based subfolders.
⚠️ Critical Issue — This will break the build
I've checked the auto-generation script (scripts/api-pages-script.cjs) and this reorganisation will break npm run build.
Here's why:
- The
getAllFiles()function (line 78) recurses into subdirectories but only returns filenames (not relative paths including the subfolder). getUsageExampleContent()(line 326) andgetUsageExampleImports()(line 239) construct file paths usingcategoryPath + "/" + filename— this assumes files are directly in the category folder (e.g.,usage-examples/terminal/write_line-1-example.txt).- After this PR, the actual file is at
usage-examples/terminal/write_line/write_line-1-example.txt, but the script will try to read fromusage-examples/terminal/write_line-1-example.txt— which no longer exists.
Result: The script will find the .txt files (via recursive scan) and generate import statements, but the import paths will be wrong and the build will fail.
What needs to happen
Before reorganising into subfolders, the auto-generation script needs to be updated to track the relative path (including subfolder) for each file. Alternatively, the files should remain in the flat structure that the script currently expects.
Please run npm run build locally to confirm — I expect it will fail with file-not-found errors.
Checks
- Files are pure renames (no content changes) — ✅ confirmed via
similarity index 100% - Build passes with new file structure — ❌ expected to fail
|
i have made the needed changes as per the peer reveiw. the terminal subfolder organization works now. |
ralphweng2023
left a comment
There was a problem hiding this comment.
The critical build issue I raised has been addressed in commit 662e555. The fix correctly updates getAllFiles() to return relative paths (including subfolder) instead of bare filenames, and all downstream consumers (getUsageExampleImports, getUsageExampleContent) now use path.basename() for name-based matching while preserving relative paths for file reads/imports. The 4 failing checks (Header rules, Pages changed, Redirect rules, Netlify deploy) are pre-existing on main and unrelated to this PR. Approved.
Nadiazahan
left a comment
There was a problem hiding this comment.
Hi, I’ve reviewed your PR and overall it looks really good. The reorganisation into function-based folders definitely improves the structure and makes the usage examples easier to navigate and maintain.
I also saw the earlier feedback about the build issue, and it’s good to see that this has now been addressed with the updates to handle relative paths properly. The explanation and follow-up changes make sense, and it looks like the original issue has been resolved.
From what I can see, the changes are mainly structural and everything is still accessible, which is great. The organisation is much clearer compared to the previous flat structure.
I noticed the Netlify checks are still failing, but based on the comments it seems like this is unrelated to your changes, so that shouldn’t be an issue for this PR.
Overall everything looks solid to me, approving this.
Description
Reorganized terminal usage examples into function-based folders to improve structure and readability.
Previously, all example files were stored flat in one directory. This change groups them into logical folders such as write, write_line, write_int, etc., making it easier to navigate and maintain.
No functional changes were made.
How Has This Been Tested?
Verified folder structure locally after reorganising files.
Confirmed all files are correctly moved and accessible.
No runtime or functional changes were introduced.
Folders and Files Added/Modified
Added:
Modified:
Additional Notes
This change is purely structural and aims to improve organisation and maintainability of terminal usage examples.