chore: ✈ move static resources to src/static and cleanup build scripts & ✨ Resolve some issues ✨
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/tosrc/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
- HTML files (
- Removed committed build artifacts from
dist/directory - Updated
.gitignoreto exclude thedist/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 CSScopy-js-deps: Copies JavaScript dependencies from node_modulescopy-static: Copies static assets fromsrc/static/todist/build: Orchestrates all build steps
- Removed global sass dependency by using
npx sassinstead of requiring global installation - Added proper directory creation with
mkdir -pfor better reliability
🐳 Docker Compliance Fix
- Fixed Dockerfile linting issue by converting lowercase instruction to uppercase (docker:S6476)
Benefits
- Cleaner Repository: Build artifacts are no longer committed to version control
- Better Source Organization: Clear separation between source files (
src/static/) and build output (dist/) - Improved Build Process: Modular scripts make it easier to debug and maintain individual build steps
- Development Workflow: Developers can now modify static assets in
src/static/and have them automatically copied during build - 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 buildstill generates the completedist/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.
@ckabalan Looking for Review on this and a pipeline approval.
@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.
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.
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.