-
Notifications
You must be signed in to change notification settings - Fork 6
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
Expose all CLI options to the npm library #173
Comments
I took a deeper look into the project code and WebAssembly. What is the reason for creating several different executables for the CLI instead of using WebAssembly? There is even I quickly created a small test on my fork of the project. |
Hi @EcoFreshKase. In general, distributing separate binaries was a pratical way to ship the tool to multiple operating systems. It's generally designed to be used as a CLI tool. That said, it also occurred to me that I could output a wasm build and allow it to run on the web, which works. However, I wasn't envisioning fta being used like a library. I'm definitely open to perhaps another npm package coexisting that is a library version of fta -- at least, I think that's what you're getting at here? |
@sgb-io yes, I would love to have fta as a library, because I want to use it to create a tool in the future. How would you like to have this implement. Should we creat a npm package |
@EcoFreshKase I would suggest that Note that you can't use If you can help propose what the library should contain/expose/do I'd be happy to get involved with this |
@sgb-io I think it would make sense to group all the As for what should be contained in the library. I would suggest at least functions to analyze single files and whole projects and a possibility to get the metrics that are used internaly. Maybe even some util functionality to e.g. calculate the |
@sgb-io sorry for the wait I was sick the last week. You said you wanted to get involved in this. How do you think should we split the work for this? schemeanalyzeFileshould take a path to a file that should be analyzed by fta and options to configure the analysis. analyzeProjectshould take a path to the root of whole project that should be analyzed by fta and options to configure the analysis. OptionsType that contains all configurations for the analysis AnalyzedFilefta results for one file AnalyzedProjectfta results for a whole project getScoretakes an AnalyzedFile without fta_score and returns the fta_score |
Currently only the
json
flag can be set in the options forrunFta
. Adding more or all options could be helpful.Adding options currently exposed to the CLI should be straightforward. For other config options I think #63 should be implemented before implementing this issue. Otherwise, I don't see a way of executing
runFta
without creating afta.json
for every run.Additionally, I think changing the exported functions could be beneficial. Currently
runFta
always returns a string, either containing a formatted table or an array ofAnalyzedFile
as a string. Automatically converting the array would be helpful. Also, exposing two different functions could help create a clearer interface. Otherwise, every call ofrunFta
would require a check or an explicit cast, even though the expected type is likely obvious from the context.Other ideas are of course welcome!
The text was updated successfully, but these errors were encountered: