-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Mod File Generation #27451
Comments
So it just takes all your files and re-exports them in a mod.ts file? How does this save significant time? Why would you need to regenerate them and not update it whenever you create or delete a file? Since you've essentially switched it from manually including to manually excluding, I don't see how it saves any time. |
It's easy to forget to add/remove/update reexports. Consider projects that have dozens of files and many contributors. Also: auto-import updates come to mind: they often result in mod files that contain undesirable reexports. For instance, let's say we have a
export * from "./c.ts If we move export * from "../c.ts" Moderate ensures that this reexport is no longer in "moderating" is a way to simplify managing exports in large projects. The Deno team already somewhat "moderates" denoland/std. Although it's manual, there is an agreed upon convention for organizing and excluding files from different subpackages/mods. I'm not suggesting a specific |
This sounds like a useful features for certain projects, but I'm not sure if putting that into Deno itself is the ideal place. Personally, I haven't encountered projects where everything of the sibling files should be exported. There is always an exception here or there which makes automating it more tricky. That said it's a perfect feature to put into a tool on |
I would agree if not for the possibility that a proper solution may utilize the Deno module graph (to prevent issues such as used-before-initialization, misc). |
This may be out of scope, but I believe it's enough of a productivity boon that I'd like to propose it just incase.
I frequently utilize a tool called moderate to regenerate
mod.ts
files. The workflow is very simple:mod.ts
that I'd like to "moderate", I add a// moderate
comment at the very top.deno task mod
, which writes re-export statements for all files andmod.ts
-containing subdirectories.One can even specify excludes in the directive + add leading statements to be left untouched before the
// moderate
directive. Ie.This utility saves me significant time.
I was wondering if anyone thought a workflow such as this could make it into Deno toolchain, where it could be standardized and made to benefit the broader ecosystem. Dealing with mod/barrel files / and reexport statements is just such a pain for so many developers. I think we can do better by making this or a similar workflow a first class citizen.
The text was updated successfully, but these errors were encountered: