Skip to content

Conversation

@dbkr
Copy link
Member

@dbkr dbkr commented Oct 22, 2025

This now also changes EW s it consumes the shared components via their exported, built bundle rather than the source, and, as a result, is quite large.

Some of the changes that might seem more surprising:

  • Screenshots change because CSS was being overridden for audio messages but was previously being overridden to a line-height of 22.5px. I couldn't see where though, and this is a really strange line-height to use, so I updated it to use 1.5rem (24px). (This is also why the !important changes re necessary: for the other overrides that we do still want).
  • Snapshots change because the Flex component is now external and gets a hash added to its CSS classes.
  • build:res steps are removed as this is now included in shared components prepare step

Summary of changes prior to switching shared components to be consumed from the built package:

  • Add deps that were missing because they were getting picked up from element-web main but shared-components needs itself
  • Exclude test files from dts generation
  • Bump version

Checklist

 * Add deps that were missing because they were getting picked up
   from element-web main but shared-components needs itself
 * Exclude test files from dts generation
 * Bump version
@dbkr dbkr added the T-Task Tasks for the team like planning label Oct 22, 2025
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

Can we take this opportunity to tidy the deps, e.g. temporal-polyfill is now depended on by both shared-components and element-web but actually only used by shared-components... Or is this needed because we bypass the dependencies of the subpackage and its build system? in which case that feels super brittle and we should stop doing that otherwise we might end up with shared components in isolation working but within element web not due to dep version mismatches

@dbkr
Copy link
Member Author

dbkr commented Oct 22, 2025

Indeed, we do need the dependencies as we import the typescript source directly, like we do with js-sdk, although that has fewer dependencies so I assume it's never been an issue. We can certainly switch to consuming the built output of shared-components, it will mean more steps to run for dev but is probably the "right" choice - wdyt?

@t3chguy
Copy link
Member

t3chguy commented Oct 22, 2025

like we do with js-sdk

We install js-sdk as a dependency so we get its dependencies transitively, we don't git clone it and reference it by fs path. We need certain additional dev deps because we use the src, rather than lib but no runtime deps.

it will mean more steps to run for dev but is probably the "right" choice - wdyt?

I think it is the right choice, we could use concurrently as we already do and add a vite build/watch step into it. Using yarn link for the shared package to avoid needing to run yarn to reinstall the dep

@dbkr
Copy link
Member Author

dbkr commented Oct 22, 2025

I suppose if we just added it as a dependency then we'd still get the dependencies transitively and we could continue importing the ts directly?

@t3chguy
Copy link
Member

t3chguy commented Oct 22, 2025

Yes that is an option, there is always potential for inconsistency between ew and other consumers given the build system is being bypassed

DIST_VERSION=$("$DIR"/normalize-version.sh "$DIST_VERSION")

# Build resources as the shared components need them
yarn run build:res
Copy link
Member

Choose a reason for hiding this comment

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

should this maybe be in shared-component prepare script?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, possibly - trying it

dbkr added 2 commits October 23, 2025 15:11
 * build:res on the parent as part of shared component prepare
 * link shared component repo inn docker build
so it gets bundled rather than left as a relative import to the json
file

import React, { type ReactNode } from "react";
import { STABLE_MSC4133_EXTENDED_PROFILES, UNSTABLE_MSC4133_EXTENDED_PROFILES } from "matrix-js-sdk/src/matrix";
// Import i18n.tsx instead of languageHandler to avoid circular deps
Copy link
Member

Choose a reason for hiding this comment

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

This comment seems outdated

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully better now

Co-authored-by: Michael Telatynski <[email protected]>
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

looks plausible from the crypto PoV

@dbkr dbkr added this pull request to the merge queue Nov 3, 2025
Merged via the queue into develop with commit b0cdbf5 Nov 3, 2025
36 checks passed
@dbkr dbkr deleted the dbkr/shared_component_deps branch November 3, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Tasks for the team like planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants