This directory contains utility scripts for maintaining the Tech Notes Hub project.
A Node.js script that automatically updates the frontmatter (metadata) in all Markdown files in the /docs and /i18n/vi directories.
- Ensures all Markdown files have consistent frontmatter
- Updates the
updatefield with the current date only if the field doesn't exists - Sets default values for missing fields:
author: "Tech Notes Hub"date: Current date (if missing)tags: Default tags (if missing)title: Generated from filename (if missing)description: Generated from title (if missing)
- Logs include timestamps for better tracking
- Node.js
- Dependencies:
gray-matterglob
Update all files:
# Install dependencies if not already installed
npm install
# Make the script executable
chmod +x tools/update-frontmatter.js
# Run the script to update all files
node tools/update-frontmatter.js
# Or explicitly specify all files
node tools/update-frontmatter.js --allUpdate a single file manually:
# Update a specific file by providing the relative path from either docs/ or i18n/vi/
node tools/update-frontmatter.js algorithms/sorting-algorithms.md
# The script will check for the file in both directories:
# - /docs/algorithms/sorting-algorithms.md
# - /i18n/vi/algorithms/sorting-algorithms.mdA Python script that automatically generates the SUMMARY.md file by scanning the docs/ directory structure.
- Creates a well-structured table of contents
- Extracts titles from Markdown files when available
- Organizes content by categories based on directory structure
- Generates clean, formatted links to all documentation files
- Python 3.6+
- No external dependencies (uses only standard library)
# Make the script executable (first time only)
chmod +x tools/generate_summary.py
# Run the script to generate SUMMARY.md
python tools/generate_summary.pyThe script will:
- Scan all directories in
/docs - Extract titles from Markdown files or generate them from filenames
- Create a hierarchical table of contents
- Write the result to
SUMMARY.mdin the project root
This script is configured to run automatically via GitHub Actions when:
- Any Markdown file is changed in the
/docsor/i18ndirectories - Weekly on Monday at 00:00 UTC
- Manually via the GitHub Actions interface
The automation will commit any changes back to the repository with a commit message "chore: update markdown frontmatter [skip ci]".
When adding new tools to this directory, please follow these guidelines:
- Create a well-documented script with clear comments
- Update this README with information about the tool
- Ensure the tool follows project coding standards
- Add any necessary dependencies to the project's package.json