neutralinojs / neutralinojs-cli

neu cli for Neutralinojs
https://neutralino.js.org/docs/cli/neu-cli
MIT License
93 stars 56 forks source link

Do we really need readDirectory in runner.js? #172

Closed shalithasuranga closed 6 months ago

shalithasuranga commented 2 years ago

I am not sure why we need to use the existing readDirectory function by re-constructing the output of fs.readdirSync. Can we use the fs API directly in the test file without the wrapper function?

Assignee @pathange-s

pathange-s commented 2 years ago

There might arise a case surely in the future where we will need to get the files present in the directory. So, I thought of creating a separate function for that. I feel having it this way keeps the code modular. Let me know.

For example, check out this. We are calling readDirectory a couple of times. Removing this will lead to writing duplicate code. https://github.com/neutralinojs/neutralinojs-cli/blob/master/spec/build.spec.js

Sadaf-A commented 7 months ago

There might arise a case surely in the future where we will need to get the files present in the directory. So, I thought of creating a separate function for that. I feel having it this way keeps the code modular. Let me know.

For example, check out this. We are calling readDirectory a couple of times. Removing this will lead to writing duplicate code. https://github.com/neutralinojs/neutralinojs-cli/blob/master/spec/build.spec.js

Hey @shalithasuranga, considering this is this issue still up for contributions?

abhaysinghs772 commented 6 months ago

@shalithasuranga and @Sadaf-A , I also agree with the suggestions made above by @pathange-s, although yes we can use fs API directly.

please do let me know about your suggestions, I will do the needful.

abhaysinghs772 commented 6 months ago

@shalithasuranga, I analyzed this minor issue and I think was correct. so I raised the PR regarding this please review it and merge it https://github.com/neutralinojs/neutralinojs-cli/pull/257 .

thanks

shalithasuranga commented 6 months ago

Fixed via #257 .. Thanks :tada: