Skip to content

chore(deps): replace camelcase with a local helper in SVG transforms - #21029

Open
vbudhram wants to merge 1 commit into
mainfrom
fxa-13929
Open

chore(deps): replace camelcase with a local helper in SVG transforms#21029
vbudhram wants to merge 1 commit into
mainfrom
fxa-13929

Conversation

@vbudhram

Copy link
Copy Markdown
Contributor

Because

  • We pull in camelcase for one job: turning an SVG basename into a PascalCase component name, in two Jest transforms.
  • FXA-13929, part of the dependency reduction work.

This pull request

  • Adds a local toPascalCase helper to svg-transform.js (fxa-react) and fileTransform.js (fxa-settings).
  • Drops camelcase from both package.json files and updates yarn.lock.
  • Leaves the two helpers as copies. Sharing one means a new cross-package export, which this does not justify. A follow-up can merge them if anyone wants that.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13929

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: the toPascalCase helper, which is identical in both transforms.
  • Suggested review order: the helper, then the package.json and yarn.lock removal.
  • Risky or complex parts: these transforms name the generated React component. Any string the helper gets wrong renames a component and breaks whatever refers to it. So I checked it against the real data rather than by reasoning: for all 353 tracked .svg basenames, the helper returns the same string as camelcase(name, { pascalCase: true }). That covers the three separators the repo uses (-, _, .), digits before letters (123Done-blue-logo gives 123DoneBlueLogo), and names already in camelCase (infoBlack gives InfoBlack).

Screenshots (Optional)

Other information (Optional)

  • One case the helper does not copy: an acronym run followed by a lowercase word. camelcase turns ABCDef into AbcDef, the helper gives Abcdef. No filename in the repo looks like that, and the ticket asks for a helper scoped to the real input instead of a reimplementation of the library.
  • Checked locally: the fxa-react unit suite (12 suites, 100 tests, 0 failures), one fxa-settings test that renders SVG components (Settings/ButtonIcon, 2 passed), and nx lint on both packages (exit 0). I added no tests, so that checklist row stays unticked. Functional tests were skipped at the operator's request.

## Because

- We pull in `camelcase` for one job: turning an SVG basename into a PascalCase component name, in two Jest transforms.
- FXA-13929, part of the dependency reduction work.

## This pull request

- Adds a local `toPascalCase` helper to `svg-transform.js` (fxa-react) and `fileTransform.js` (fxa-settings).
- Drops `camelcase` from both `package.json` files and updates `yarn.lock`.
- Leaves the two helpers as copies. Sharing one means a new cross-package export, which this does not justify. A follow-up can merge them if anyone wants that.

## Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13929
@vbudhram
vbudhram requested a review from a team as a code owner August 13, 2026 19:13
@vbudhram vbudhram added the auto label Aug 13, 2026
Copilot AI balanced review requested due to automatic review settings August 13, 2026 19:13
@vbudhram vbudhram added the auto label Aug 13, 2026

Copilot AI left a comment

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.

Pull request overview

Replaces camelcase with package-local SVG basename conversion helpers to reduce dependencies.

Changes:

  • Adds identical toPascalCase helpers to both Jest SVG transforms.
  • Removes direct camelcase dependencies and updates the lockfile.
  • Direct regression coverage for the helpers is still needed.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/fxa-react/svg-transform.js Adds local PascalCase conversion.
packages/fxa-react/package.json Removes camelcase.
packages/fxa-settings/config/jest/fileTransform.js Adds local PascalCase conversion.
packages/fxa-settings/package.json Removes camelcase.
yarn.lock Updates workspace dependency records.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


// Turns an SVG basename into PascalCase. Twin of the helper in
// packages/fxa-settings/config/jest/fileTransform.js.
function toPascalCase(name) {

// Turns an SVG basename into PascalCase. Twin of the helper in
// packages/fxa-react/svg-transform.js.
function toPascalCase(name) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants