Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Template File System Layout to better support large projects. #3766

Open
3 tasks done
dopry opened this issue Nov 20, 2024 · 1 comment
Open
3 tasks done

Improve Template File System Layout to better support large projects. #3766

dopry opened this issue Nov 20, 2024 · 1 comment

Comments

@dopry
Copy link

dopry commented Nov 20, 2024

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem description

As an electron developer I like to keep my code bundled by where it runs. ex) main, renderer, both so I easily know what APIs are available and how to communicate with the other parts of my app.

On one of my projects we used on of the templates and all the code was in the /src folder... As the project grew to over 200 files, this became a real challenge to manage and understand where the code in a particular file would run.

Proposed solution

We ended up updating to the following filesystem layout

/src/common - types, classes, and functions used in both the main and renderers.
/src/main/* - code that runs on main.
/src/renderers/{renderer name}/* - code that runs in the renderer (preload, html, rendered js, css)
/src/renderers/common/* - code shared between multiple renderers (common preload imports, component library, etc)

This has really helped us navigating our codebase and helped new team members get familiar more quickly. I think it would be nice if the templates provided this structure for new projects so others building with electron won't have to go through the complex file moving and organizing we had to after their projects have organically grown into a mess.

Alternatives considered

I haven't considered other file system layouts, but would find any that organize things in a similar fashion in spirit an improvement.

Additional information

No response

@an78mK89fy
Copy link

Everyone's habits are different, and the current time is suitable for newcomers who are new to it. You can customize the template or upload it to git

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

No branches or pull requests

2 participants