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):
files starting with comment: /* BATI dependency */
could be adapted in the future to support other tags: /* BATI dependency,tag1,tag2 */
files with names containing [dependency], like handler[dependency].ts
could be adapted in the future to support other tags: handler[dependency,tag1,tag2].ts
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)
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 thebati.flags
condition inpackage.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):
/* BATI dependency */
/* BATI dependency,tag1,tag2 */
[dependency]
, likehandler[dependency].ts
handler[dependency,tag1,tag2].ts