Skip to content

Organised terminal usage examples into function-based folders#707

Open
rachelpatrao wants to merge 2 commits intothoth-tech:mainfrom
rachelpatrao:organize-terminal-write-examples
Open

Organised terminal usage examples into function-based folders#707
rachelpatrao wants to merge 2 commits intothoth-tech:mainfrom
rachelpatrao:organize-terminal-write-examples

Conversation

@rachelpatrao
Copy link
Copy Markdown

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.

  • Documentation (update or new)

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:

    • public/usage-examples/terminal/write/
    • public/usage-examples/terminal/write_line/
    • public/usage-examples/terminal/write_int/
    • public/usage-examples/terminal/write_char/
    • public/usage-examples/terminal/write_double/
    • public/usage-examples/terminal/write_line_empty/
    • public/usage-examples/terminal/write_line_int/
  • Modified:

    • public/usage-examples/terminal/*

Additional Notes

This change is purely structural and aims to improve organisation and maintainability of terminal usage examples.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 662e555
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/69cd375c194c660007f5281b

Copy link
Copy Markdown

@ralphweng-autograb ralphweng-autograb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review has been moved to the correct account (ralphweng2023). Please disregard.

Copy link
Copy Markdown

@ralphweng2023 ralphweng2023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. The getAllFiles() function (line 78) recurses into subdirectories but only returns filenames (not relative paths including the subfolder).
  2. getUsageExampleContent() (line 326) and getUsageExampleImports() (line 239) construct file paths using categoryPath + "/" + filename — this assumes files are directly in the category folder (e.g., usage-examples/terminal/write_line-1-example.txt).
  3. 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 from usage-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

@rachelpatrao
Copy link
Copy Markdown
Author

rachelpatrao commented Apr 1, 2026

i have made the needed changes as per the peer reveiw. the terminal subfolder organization works now.
The Netlify build is failing due to invalid anchor links (#rectangle-around) in API documentation pages. This appears unrelated to my changes.

Copy link
Copy Markdown

@ralphweng2023 ralphweng2023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

@Nadiazahan Nadiazahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants