-
Notifications
You must be signed in to change notification settings - Fork 49
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
.tsx support #11
Comments
@gustaff-weldon sounds like an interesting |
@glato that would be awesome! I have found a couple of projects that might be handy: Typescript only: More known, mixed language types: Javascript
Of course, I'm happy to help with testing on our codebase, we have a fairly big app (~5000 ts/tsx files), I cannot share as it's a private repo. Let me know if that's enough :) |
@gustaff-weldon I've pushed an update in the current version
I'd appreciate any feedback if this helps and solves the issue? Or if there are some details which does not work out as expected? |
Hi @glato, First of all, thank you so mych for your effort, much appreciated. I will try to help with testing. For starters, I have run this against our codebase, and while it worked (ie. looks better than before :)) I'm a little bit suspicious about the number of files traversed. Are you following The reason I'm asking is because we are using alias in the import, think of Alias-related part of config for Typescript:
Alias-related part of config for Webpack:
If you do not resolve aliases, we might need to add this. I'm happy to provide those as a part of the I will get back to you as soon as I do more testing. But I wanted to clarify this alias thing. |
@gustaff-weldon Hi there, emerge currently tries to do a hybrid approach here: First it traverses recursively through all files from a starting directory and collecting every import statement within each file that it can find. For any recognized import statement, it tries to 'resolve' it to a correct POSIX-kind of filesystem path (e.g. an import of the kind 'foo/bar/../baz.ts' should be resolved to 'foo/baz.ts'). import aliases of the kind @myco/utils/date are currently not part of the resolver. If you say that this kind of import aliases are often used in js/ts project, this could indeed be an useful update. I'll see if I can find some further examples to analyze and test such import aliases and see about an update on this issue. |
@glato using aliases is quite a common thing in bigger JS projects. I will see if I can find some examples to help with testing |
@gustaff-weldon I've just pushed a small update in There is (currently) an undocumented yaml config section replace_dependency_substrings:
- "@foo": src/foo
- "@bar": src/bar so that import aliases/prefixes like This means that an example TS-configuration might look like this: ---
project_name: tsx example
loglevel: info
analyses:
- analysis_name: simple check
source_directory: /Users/user/github/cypress-realworld-app
only_permit_languages:
- javascript
- typescript
only_permit_file_extensions:
- .js
- .jsx
- .ts
- .tsx
replace_dependency_substrings:
- "@foo": src/foo
- "@bar": src/bar
file_scan:
- number_of_methods
- source_lines_of_code
- dependency_graph
- fan_in_out
- louvain_modularity
export:
- directory: /Users/user/tmp/emerge/export/cypress-realworld-app
- graphml
- dot
- json
- tabular_file
- tabular_console_overall
- d3 I would appreciate any feedback if this might solve your problem (by defining a custom configuration in |
@gustaff-weldon I've release this import alias feature with version 1.0.0. You can also install this tool very quickly with pip now (pip install emerge-viz). Will be closing this issue in a couple of days if this solves the problem. |
@glato thanks, I will give it a go. |
@glato I wonder if this is how the scan should behave given the following settings:
Notice that I exclude all
I would expect those to be excluded? It seems to be a problem with double extension ones, as eg.
|
Hello, any updates on this? I'm also trying to run emerge on a large Typescript+React codebase and I'm getting a bunch of
Thanks so much for this project. I think it will be very helpful to an initiative I have at work. |
Is your feature request related to a problem? Please describe.
I'm trying to run
emerge
against a big React app codebase.python emerge.py -c frontend.yml
I'm getting tons and tons of messages:
Pretty much the whole app gets skipped and not mapped.
Describe the solution you'd like
I'd like to be able to analyze a codebase that contains
tsx
which are essentiallyjsx
with Typescript.Given the size of our app, the ability to visualise it and check in an interactive way, would be an immense help.
The text was updated successfully, but these errors were encountered: