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

Smarter detection of imported dependency files #275

Closed
magne4000 opened this issue Jun 22, 2024 · 1 comment · Fixed by #288
Closed

Smarter detection of imported dependency files #275

magne4000 opened this issue Jun 22, 2024 · 1 comment · Fixed by #288
Assignees
Labels
✨ enhancement New feature or request

Comments

@magne4000
Copy link
Member

magne4000 commented Jun 22, 2024

Shared files are files that can be imported by 0, 1 or multiple other files. Currently, those files are put in dedicated shared-* folders. They are created on file system if the bati.flags condition in package.json is true.

It's a bit cumbersome to maintain, and for complex flags combinations, it will become more and more difficult to not break things (i.e. ensuring that these files are not created when they shouldn't be).

The goal of this RFC will be to ensure that some files are only generated on file system if at least one other regular file imports it. It mostly impact shared files, but can be used anywhere in boilerplates.

How to tag a file as "dependency"

Possible solutions (TODO: pick one):

  1. files starting with comment: /* BATI dependency */
    • could be adapted in the future to support other tags: /* BATI dependency,tag1,tag2 */
  2. files with names containing [dependency], like handler[dependency].ts
    • could be adapted in the future to support other tags: handler[dependency,tag1,tag2].ts
@magne4000 magne4000 added the ✨ enhancement New feature or request label Jun 22, 2024
@magne4000 magne4000 self-assigned this Jun 22, 2024
@magne4000 magne4000 changed the title Smarter detection of imported ~~shared~~ dependency files Smarter detection of imported dependency files Jun 22, 2024
@magne4000
Copy link
Member Author

magne4000 commented Jun 27, 2024

Solution 1. could also be adapted for other use cases, such as generating a whole file only if some conditions are met (e.g. generate file server.node.ts only if no serverless deployment target has been chosen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant