feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.04k stars 751 forks source link

Bundling Typed Feathers Client #3245

Closed b-steel closed 1 year ago

b-steel commented 1 year ago

We're currently running V4 for our API and I've been looking into making the change to V5. One of the things that I'm most interested in is the typed client, but I have a couple questions about it that I'm having a hard time answering.

Setup

Setup blank app directly from the docs npm create feathers@latest feathers-chat Answer things the same as in the docs Docs CLI Answers

Run cd feathers-chat && npm run bundle:client which indeed creates a bundled package at ./public/feathers-chat-0.0.0.tgz

Question1: Extra Dependencies

If I unzip ./public/feathers-chat-0.0.0.tgz I get a package folder with lib/ and package.json. Looking at the /package.json I see that all the dependencies are included in there, but it seems to me that the client should not depend on things like knex and winston and some of the @feathersjs/package packages. If I install the client in some other project as advertised in the docs with npm install https://myapp.com/appname-x.x.x.tgz (I ran npm install ../feathers-chat/public/feathers-chat-0.0.0.tgz in an adjacent project) I can confirm that all those dependencies were installed via npm why knex etc.

I can manually remove the extraneous dependencies, but if I re-bundle the client I'll have to do that again. So it seems I'd need to write some sort of tooling to automate this.

So my question is, am I missing something here or is this just what's available out of the box. I totally understand if it's the latter, but I want to make sure I'm not missing something here before I start building a custom script to fix this.

Question 2: Separate Package

Additionally we've got everything in a monorepo so I think I'll have to write a script that bundles the client, (maybe strips out some deps) and then stuffs it into it's own package in our /packages/ folder to be used by other apps. Curious if there's any other way to extract the client to be a separate package instead of being part of the main feathers app and then bundling it off. This is kinda a vague question, but mostly curious if you'd had anyone else with a similar issue and could point me in a certain direction.

Thanks for any insight you can provide.

b-steel commented 1 year ago

Closing to move to the discussions section.