spotify-dl icon indicating copy to clipboard operation
spotify-dl copied to clipboard

Feature/Use as node library

Open yonahforst opened this issue 3 years ago • 3 comments

Title

Use as node library

Details

This PR allows the library to be use from within node. It does so by removing the dependency on a global cliInputs object. Options are instead passed down as arguments.

I tried to change a little code as possible, keeping the library structure virtually identical but with small strategic changes which which break the dependency on a global object.

It should be straightforward to read the commit comments and understand the reason for each change.

Testing

I tested manually after each commit to ensure nothing broke along the way

Checklist

[] Ran eslint/prettier formatting [] Tests are passing (no tests yet) [x] Feature is considered complete

Issues this resolves

closes #123

yonahforst avatar Jul 20 '21 08:07 yonahforst

hey @yonahforst thanks for the idea and the pr, the main maintainer has been unwell lately so he may take a while to respond/ review,

just as a heads up this will fight my latest set of changes in https://github.com/SwapnilSoni1999/spotify-dl/pull/116

just be ready for a refactor when those changes come through :) but i will review it in its current state for now

phyzical avatar Jul 21 '21 11:07 phyzical

i cant see any issues with what you have done :).

but i wonder should we instead simply convert the runner exports into a class and then we can just pass the options to the construct and set them as a class property?

then in theory it can work as it did before (within runner.js) but instead of the global object it is just a class object?

what do you think @yonahforst ?

but again i would hold off making any chances until the main maintainer merges my other prs to reduce your reworks

phyzical avatar Jul 21 '21 11:07 phyzical

Branch has some conflicts Please check it Also im assigning @phyzical to check for upcoming changes :)

SwapnilSoni1999 avatar Aug 10 '21 15:08 SwapnilSoni1999