node-yahoo-finance2 icon indicating copy to clipboard operation
node-yahoo-finance2 copied to clipboard

v3 umbrella issue for breaking changes

Open gadicc opened this issue 1 year ago • 2 comments

IN PROGRESS in devel branch (merged in from devel-next-major on 2025-03-14)

TODO

  • recent PRs that are fairly big even if no real breaking changes? to think about.
  • gadicc to tag relevant contributors after i've thought about this a bit more.

OTHER

  • [X] Consider using Deno v2 as the main engine for development for much better integrated tooling and faster testing. To be clear, node, bun, deno and edge/cloudflare/vercel will all be supported.

  • [X] Package will be ESM only (I guess the base already kind of is, but we can finally drop all the conversion scripts and any complicated things we needed to make both targets possible. However, if we switch to Deno, and publish to npm with their dnt tool, we can get a CJS version too for free.

  • [X] Drop fetchDevel for fetch-mock-cache (also mine, borne out of fetchDevel but more generalized and works better with mocks in testing, see also https://github.com/gadicc/node-yahoo-finance2/pull/767).

  • [X] one big architectural change I really wanted to do was to initiate with options, e.g. const yf = new YahooFinance(opts). Originally all the modules were completely isolated and could be imported just as needed, but, over time, we found the need for setGlobalOptions() etc which really is a bit messy.

  • [X] Drop browser support

    Browser support was a result of a lot of pressure from users although from experience, all the warnings about this were lost on the user until they actually tried to implement it themselves and realise it was a no go. I refer specifically to CORS issues, but more recently, to cookie issues which can't be worked around as they are part of the browser's security model.

    • [X] Drop browser support but continue to support browser-like environments (e.g. V8 / edge / non-browser web-workers).
    • [ ] Provide helpful functions to relay yf2 requests via a server/edge/workers while maintaining type safety (a lot these already exist in the codesandbox demo, but could be cleaned up and packaged officially).
    • [X] TODO: make this it's own issue and linked back to this umbrella issue.
  • [ ] Convert remaining .spec tests to new format

  • [ ] Update docs

  • [ ] Move from global to per instance:

    • [ ] setGlobalConfig - partially done
    • [ ] supressNotices
    • [ ] disallowAdditionalProps - less NB since it's only during testing
  • [ ] Any other cloudflare blockers?

  • [x] Rename branches to dev (devel) and main (master)

  • [ ] Proxy support https://github.com/gadicc/node-yahoo-finance2/issues/872

gadicc avatar Aug 19 '24 11:08 gadicc

@eddie-atkinson, not much for discussion here, but moved my relevant comments from #826 on this issue here (editing the above post), notably: ESM-only, drop fetchDevel for fetch-mock-cache, mention using Deno v2 for as the main (dev) engine.

gadicc avatar Oct 24 '24 07:10 gadicc

Completely agree with all the points.

  • Browser support is not at all needed. On full stack apps like Nuxt, one can use the server api. For other small apps, one can spin up Cloudflare worker for own server.
  • ESM is the way to go.
  • Not 100% sure about using Deno here, but if it doesn't affect the lib output, definitely go for it.

ManasMadrecha avatar Nov 02 '24 21:11 ManasMadrecha