Replies: 9 comments 4 replies
-
Hi! Thank you for your feedback. Contributions are of course welcome! Now that the library has gained some traction, versioned docs would make sense. I am happy to create a v3.0.0 canary branch for breaking changes, however I'm inclined to believe that as soon as those changes are in we should just ship 3.0.0. This would render the creation of such a branch as a moot point. It might be best to add exports with the new names and mark the existing ones as deprecated in a patch release. If you are looking for a first PR, this would be a great candidate. |
Beta Was this translation helpful? Give feedback.
-
Other thoughts on a potential v3:
I have recently built https://github.com/RetroAchievements/retroachievements-api-js, where I had great success with both of these. This library originally began as a fork of psn-api. |
Beta Was this translation helpful? Give feedback.
-
Not my library so none of my business how you run it, but I think we still have a bunch of good features we could add that could be ported to 2.x.x, like universal game search from #88. I don't think we have any big changes yet that justify going to 3.0.0 right away? Maybe you could provide some clarification here about the 2 things you mentioned, as I trust you know more about them. I've created my own singleton component that handles the entire connection management process behind the scenes and reconnects and refreshes when necessary, which I think could be a great addition to this library as well. We can discuss this better halfway through March, as I'm currently laser-focused on creating my backend. Maybe I can even bring some other upgrades I'm yet to discover by then. |
Beta Was this translation helpful? Give feedback.
-
My perception is these function renames would not be earth-shattering changes, especially if a deprecation notice lands in 2.x.x. Of course I am happy to minimize breaking changes as much as possible. The best path forward might be to rename the functions themselves, then re-export them under the old names with a
microbundle is generally better maintained than dts-cli and I've seen a ~45% reduction in bundle sizes using it over dts-cli. Docusaurus is kind of a pain to work with; I've found VitePress to generally be a faster and more productive docs site generator. |
Beta Was this translation helpful? Give feedback.
-
Yeah, this sounds like the perfect solution to me!
Alright man, looks exciting. Looking forward to getting to work on this with you soon. :) PS: I forgot to suggest this, but one of the ideas I had for 3.0.0 is removing entirely the need to pass the authorization as a parameter to functions, also being able to set a set user to fetch data from (that is not the same as the logged-in user, as I know some people are afraid of using this with their actual gaming account, doing something wrong, getting rate limited or even banned from PSN for API abuse). |
Beta Was this translation helpful? Give feedback.
-
Likewise!
I would definitely be open to suggestions on this. One reason it currently works this way is to keep the functions pure so dead code elimination can work properly when someone imports the library. By keeping everything pure, if someone only uses two functions from psn-api, those will be the only two functions that make it into their build. One potential approach could be to have some kind of authorized client class, where authorization is handled in the constructor. Then users could decide if they want better DX for slightly larger bundle sizes. |
Beta Was this translation helpful? Give feedback.
-
Oh, that's cool, you had tree shaking in mind when you did it this way.
Yeah that sounds like a good compromise, that way users can opt for smaller bundle sizes or DX comfort. |
Beta Was this translation helpful? Give feedback.
-
As a heads-up, I'm mocking this library on Postman so people (and us too!) can easily test stuff without constantly having to start a node server, change code, save, restart the server, etc. Maybe this is something you will want to add to the V3 milestone docs? |
Beta Was this translation helpful? Give feedback.
-
@wescopeland Ok, so here is my idea for V3.0.0. V2 stays tree-shakeable as it is, very low level and controllable. Most features brought over to V3 will be backported to be used in V2 if users prefer to not need to update their code / keep functions low level. V3 should be high-level. The authorization will be completely handled behind the scenes automatically, as it was requested here and it's how I use it myself. Needing to manage the authentication state is some really boring chore, I don't see the reason to enforce our users to do that. In fact, being low-level as it is was what pushed me away from even trying the library for the past several months, but then I had no choice when my Discord bot got killed by PSN Profiles' Cloudflare DDoS protection last month. Do or die it was, and I'm not dying. While I do understand the reasoning behind tree-shaking, this is not a library that will be shipped to clients, so it really shouldn't be our biggest worry if our bundle size is 3kb or 7kb. Instead, we should worry about developer experience and make the library fun/intuitive to use. The Python library uses an approach that I think would also benefit us a lot, which is the ability to chain commands one after the other with the Builder Design Pattern. A design pattern like that would probably fit our use case as well. Let me know what you think, for now, I'm gonna start the branch to add the functionality of getting Gamer playtime in games. |
Beta Was this translation helpful? Give feedback.
-
A few of the issues opened here (#30, #29) require a change in the name of some functions, which would break the current version.
I guess this would mean that we also need to separate the documentation website in v2 and v3, with a section for breaking changes for new, incoming users.
Lastly, should we put a deprecation warning on the current functions so users looking into upgrading to v3 are ready for the change?
PS: Amazing library. I intend to contribute a lot here starting mid-March. Currently building a massive trophy database backend using this. Flawless work.
Beta Was this translation helpful? Give feedback.
All reactions