cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

`app-store create` doesn't add import to the `appStore` object

Open AbleLincoln opened this issue 1 year ago • 8 comments

Issue Summary

All app store packages are exported from /packages/app-store/index.ts. When creating a new app using the CLI (app-store create), the resulting package is not automatically added to this exports list.

Steps to Reproduce

  1. yarn app-store create and make an app called example
  2. open /packages/app-store/index.ts -> example: import("./example") not there

Maybe this is intentional, as most apps might not need their stuff exported in this way. But this tripped me up when I tried developing an app. It's not clear that the package needs to be manually added to this object.

AbleLincoln avatar May 02 '23 08:05 AbleLincoln

Can you please assign me this issue

shohan2001 avatar May 02 '23 17:05 shohan2001

hi @AbleLincoln I have don this Issues ,can you can you assign

elhadis avatar May 02 '23 18:05 elhadis

I'm sorry I don't have the power to assign. Ask @PeerRich

AbleLincoln avatar May 02 '23 22:05 AbleLincoln

That is actually intentional. We don't want to use packages/app-store/index.ts. It has some legacy apps exports there but no new app should need it. If you can explain why you needed to add your export there, maybe I can suggest an alternate way or maybe that creates a new requirement that I would like to consider.

hariombalhara avatar May 03 '23 04:05 hariombalhara

I'm working on the new PayPal payment app. The PaymentService is handled via this appStore object, as seen here https://github.com/calcom/cal.com/blob/99f736b317cf5a0e404f176ec7281a03d4765540/packages/lib/payment/handlePayment.ts#L27-L33

AbleLincoln avatar May 03 '23 06:05 AbleLincoln

Ah got it. The payment app is pretty old and that's why it's like this. There are many generated files that are exposing certain modules for each app. Maybe we can generate apps.lib.generated.ts. We don't want to use barrel files(like app-store/index.ts) as they bring with them unneeded depdencies increasing bundle size. Screenshot 2023-05-03 at 3 28 58 PM

hariombalhara avatar May 03 '23 10:05 hariombalhara

I think that would work. As far as I can the only reason the barrel file exists now is to import some apps' libs. I've seen it in:

  • packages/app-store/_utils/getCalendar.ts
  • packages/core/videoClient.ts
  • packages/lib/payment/deletePayment.ts
  • packages/trpc/server/routers/viewer/bookings/confirm.handler.ts
  • packages/trpc/server/routers/viewer/payments/chargeCard.handler.ts

AbleLincoln avatar May 04 '23 01:05 AbleLincoln

I do want to note that apparently this file was changed in a recent pull request to allow async imports of the appStore packages. Not sure if the change you're suggesting would interfere with any of this?

AbleLincoln avatar May 04 '23 01:05 AbleLincoln