Skip to content

chore(shared): replace esbuild with tsc/ts-node in libs/*#20520

Open
dschom wants to merge 3 commits intomainfrom
esbuild-removal/libs
Open

chore(shared): replace esbuild with tsc/ts-node in libs/*#20520
dschom wants to merge 3 commits intomainfrom
esbuild-removal/libs

Conversation

@dschom
Copy link
Copy Markdown
Contributor

@dschom dschom commented May 5, 2026

Because

  • We want to test & develop with what we deploy.

This pull request

Issue that this pull request solves

Closes: (Bunch of Issues will update soon)

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Initially I tried to break this down top-level section, but it ended up causing issues. Combining all upgrades into single ticket.

Because:
- We want to test & develop with what we deploy.

This commit:
- Part of the esbuild -> tsc/ts-node migration (split of a6d1a55, PR #20390).
- Pulls in libs/*, which are essentially 'shared' libs
- Deletes libs/shared/nestjs/customs. This was not referenced, and created an atypical dependency direction with /libs/accounts/rate-limit.
@dschom dschom requested a review from a team as a code owner May 5, 2026 22:26
import { throwIntentFailedError } from './util/throwIntentFailedError';
import type { SubscriptionAttributionParams } from './checkout.types';
import { handleException } from 'libs/shared/error/src/lib/sanitizeExceptionsDecorator';
import { handleException } from '@fxa/shared/error';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaberindeZA Please verify change.

PaymentMethodErrorType,
SubPlatPaymentMethodType,
} from '@fxa/payments/customer';
} from '../..';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaberindeZA Please verify.

* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import type { ResultCart } from '@fxa/payments/cart';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaberindeZA This was resulting in circular dep. Metrics will be at the bottom of the dependency graph. Therefore it shouldn't reference 'higher level' packages. You'll see I created a CartMetrics type below to invert this dependency chain. Please verify.

Also worth noting / kind of interesting. It turns out esbuild masked this problem; however, typescript would not build due to the circular ref, which is probably a good thing.

@@ -28,7 +28,7 @@ import type {
StripePrice,
StripeSubscription,
} from '@fxa/payments/stripe';
import { getPriceFromSubscription } from 'libs/payments/customer/src/lib/util/getPriceFromSubscription';
import { getPriceFromSubscription } from '@fxa/payments/customer';
Copy link
Copy Markdown
Contributor Author

@dschom dschom May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaberindeZA Just trying to clean this up. Two comments though.

  1. Just double checkign there wasn't a reason to not to use the alias... Using the alias seems correct to me.
  2. As noted, metrics should be at the very bottom of the dependency graph. So I actually don't like seeing a dependency flowing in this direction. For now, it appears that @fxa/payments/customer doesn't depend on @fxa/payments/metrics, so this doesn't create circular ref, however, in general I don't think the metrics lib should need to reference the customer lib. This seems like it might cause some tangles down the road. Perhaps something you all want to address in a follow up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, metrics should be at the bottom of the dependency graph.

I'm thinking maybe the best move her would be to move glean.service.ts out of @fxa/payments/metrics. I like the idea of having a class, PaymentsGleanService in this case, that you can call with minimal data that will automatically fetch whatever data it can before emitting the metric. Now it's just about where to put it.

type StripeMetricsData,
type SubPlatCmsMetricsData,
} from './glean.types';
import { ResultCartFactory } from '@fxa/payments/cart';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaberindeZA Same deal, resulted in circular dependency.

@dschom dschom requested a review from StaberindeZA May 6, 2026 23:19
Because:

* The libs/payments/metrics library has the potential to cause additional
  ciruclar dependencies due to the modules imported from `payments-customer` by
  the PaymentsGleanService

This commit:

* Move the PaymentsGleanService to a new library, rename it and update the
  various dependencies.
* Remove remaining circular dependencies from `payments-metrics` lib.

Closes #PAY-3698
feat(payments): resolve circular dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants