You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be beyond the scope of what you're trying to do with import-tree, but here's a thought.
When you're doing module imports in TypeScript, you can define import aliases to reference internal paths as if they were modules. So, if you have a project structure like this:
You can define a module alias like @stuff that maps to src/things, and it uses that as the base path for imports.
I wonder if we could/should do something similar with import-tree to help people create path construction helpers. So that you could have a structure like:
I think that adding _module.args via import-tree is a bit out of scope, given that it is agnostic to how you invoke it (it can be used with/without modules). However here are some tips that can help with the use-case you mention:
Since you have inputs.import-tree, you can have a dendritic module whose only responsability
is to add the aliases you want to have available at module.args.
No need to do this at flake outputs function level.
Each import-tree api returns a new import-tree you can assign (or pass as module args):
See the advanced API to see how you can add filters or predefined paths to it.
By the default calling an import-tree object will return a list of modules (for use at imports)
If you actually want a list of files see the .leafs and .files functions
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
This might be beyond the scope of what you're trying to do with
import-tree, but here's a thought.When you're doing module imports in TypeScript, you can define import aliases to reference internal paths as if they were modules. So, if you have a project structure like this:
You can define a module alias like
@stuffthat maps tosrc/things, and it uses that as the base path for imports.I wonder if we could/should do something similar with
import-treeto help people create path construction helpers. So that you could have a structure like:And you could define an "alias" that put a helper in the top-level args of the same name, defined like this:
And then invoked like this:
All reactions