Abhishek-Mallick / universal-box

Project scaffolding just got easier — streamline your development with Universal-Box's pre-built templates and one-click deployment! 🚀
https://universal-box.dev
Apache License 2.0
27 stars 24 forks source link

Reduce npm Package Size by Excluding `templates/` Directory from Distribution #7

Open Abhishek-Mallick opened 2 months ago

Abhishek-Mallick commented 2 months ago

The templates/ directory in our npm package contains various templates used for scaffolding code. As we continue to add more templates, the size of the npm package will increase unnecessarily, leading to version inflation and potential issues for users with limited bandwidth.

Proposed Solution:

Exclude the templates/ directory from the npm package by adding it to .npmignore. Modify the bin/universal-box.js script to dynamically display available template options by iterating through the templates/ directory. Since the templates/ directory will not be present in the npm package, we can create empty directories representing each template just to display the options. These empty directories won't be ignored by .npmignore. When a user selects a template, the corresponding directory should be cloned from the repository, pulling in the necessary files only when needed.

Expected Outcome:

Reduced package size, making it more efficient to install and update. Users will still be able to see all available templates and select them for scaffolding without downloading unnecessary files.

Open to further discussions

Abhishek-Mallick commented 1 month ago

Addressed in https://github.com/Abhishek-Mallick/universal-box/commit/5fd7c24668fa4287ed12db2edd353b8523f08c04

Package size reduced from 2.5.0 (2.97MB) to 2.6.0 (25.8KB)

Abhishek-Mallick commented 1 month ago

Issue will remain active for further discussions