visualsubnetcalc icon indicating copy to clipboard operation
visualsubnetcalc copied to clipboard

chore: ✈ move static resources to src/static and cleanup build scripts & ✨ Resolve some issues ✨

Open ranma2913 opened this issue 2 months ago • 4 comments

Summary

This PR refactors the project's build system and file organization to improve maintainability and align with modern web development practices. The changes reorganize static assets and modularize the build process.

Includes Commits from PR #41 so also fixes https://github.com/ckabalan/visualsubnetcalc/issues/37 Fixes #39 Fixes #42 Fixes #44 Fixes #45

Changes Made

🗂️ File Organization Restructure

  • Moved all static assets from dist/ to src/static/ including:
    • HTML files (index.html, 404.html)
    • Static assets (favicon.ico, ads.txt, robots.txt, sitemap.xml)
    • Icon directory with all favicon variants
    • Main CSS and JavaScript files
  • Removed committed build artifacts from dist/ directory
  • Updated .gitignore to exclude the dist/ directory from version control

🔧 Build Script Improvements

  • Modularized build process by breaking down the monolithic build script into focused tasks:
    • process-sass: Compiles SCSS to CSS
    • copy-js-deps: Copies JavaScript dependencies from node_modules
    • copy-static: Copies static assets from src/static/ to dist/
    • build: Orchestrates all build steps
  • Removed global sass dependency by using npx sass instead of requiring global installation
  • Added proper directory creation with mkdir -p for better reliability

🐳 Docker Compliance Fix

  • Fixed Dockerfile linting issue by converting lowercase instruction to uppercase (docker:S6476)

Benefits

  1. Cleaner Repository: Build artifacts are no longer committed to version control
  2. Better Source Organization: Clear separation between source files (src/static/) and build output (dist/)
  3. Improved Build Process: Modular scripts make it easier to debug and maintain individual build steps
  4. Development Workflow: Developers can now modify static assets in src/static/ and have them automatically copied during build
  5. CI/CD Compatibility: The existing GitHub Actions workflow continues to work seamlessly with these changes

Deployment Impact

No breaking changes - The deployment process remains unchanged:

  • npm run build still generates the complete dist/ directory
  • CloudFormation template compatibility maintained
  • GitHub Actions workflow continues to work without modification
  • Docker build process updated to work with new structure

Testing

  • [x] Build process verified locally
  • [x] Static asset copying confirmed
  • [x] Docker build tested
  • [ ] Deployment pipeline compatibility confirmed

This refactoring sets up a more maintainable foundation for future development while ensuring zero disruption to the existing deployment infrastructure.

ranma2913 avatar Oct 03 '25 22:10 ranma2913

@ckabalan Looking for Review on this and a pipeline approval.

ranma2913 avatar Oct 15 '25 15:10 ranma2913

@bl4ckfir3 I see you made contributions this year. How did you engage @ckabalan for reviews? I'd like to ensure I'm following the best practice.

ranma2913 avatar Oct 15 '25 15:10 ranma2913

Hey @ranma2913 - The overview looks good and I would agree with all of those changes. I'll need to sit down and do some testing. I'm in the middle of moving my family across the US and will have to manage my time carefully. However, if it builds and the tests pass we should be in good shape. Give me some time to process this, I'm still committed to this project, but have to prioritize family for a little bit.

ckabalan avatar Oct 16 '25 15:10 ckabalan

You bet, it's a really useful project! I'm using it almost every week as I'm moving projects to public cloud from my company's datacenters.

ranma2913 avatar Oct 16 '25 16:10 ranma2913