Switch from yarn classic to pnpm (#31971)
* Switch shared-components from yarn classic to pnpm Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch element-web from yarn classic to pnpm Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch CI to pnpm Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update docs & comments Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Hold back postcss to match yarn.lock & use workspace protocol Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tweak CI Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Rid the world of `$(res)` Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch to type=module Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix module import Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make knip happy Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update playwright imports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make docker build happy Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove stale params Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix badly formatted logging Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch to lodash-es Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make jest happier Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Switch element-web to ESM Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update testcontainers imports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix modernizr cjs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix modernizr cjs ignore files Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move modernizr sonar exclusion to exclude everything Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update playwright tests for esm compat Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add pnpm-link utility Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Test matrix-web-i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Discard changes to src/vector/index.ts * Update playwright-common Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use catalogs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Improve pnpm-link script Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use pnpm import to regenerate lockfile from yarn.lock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9360f0e5e2
commit
ffd4270051
@@ -16,8 +16,8 @@ When adding this library to a new project, as well as installing
|
||||
dependency:
|
||||
|
||||
```bash
|
||||
yarn add @element-hq/web-shared-components
|
||||
yarn add @vector-im/compound-web
|
||||
pnpm add @element-hq/web-shared-components
|
||||
pnpm add @vector-im/compound-web
|
||||
```
|
||||
|
||||
(This avoids problems where we end up with different versions of compound-web in the
|
||||
@@ -99,22 +99,22 @@ function MyApp() {
|
||||
### Prerequisites
|
||||
|
||||
- Node.js >= 20.0.0
|
||||
- Yarn 1.22.22+
|
||||
- pnpm => 10
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
yarn install
|
||||
pnpm install
|
||||
|
||||
# Build the library
|
||||
yarn prepare
|
||||
pnpm prepare
|
||||
```
|
||||
|
||||
### Running Storybook
|
||||
|
||||
```bash
|
||||
yarn storybook
|
||||
pnpm storybook
|
||||
```
|
||||
|
||||
### Write components
|
||||
@@ -300,7 +300,7 @@ export const Docs = {
|
||||
|
||||
1. Write TsDoc in your utility function
|
||||
2. Export the function from `src/index.ts`
|
||||
3. Run `yarn build:doc` to generate TypeDoc markdown
|
||||
3. Run `pnpm build:doc` to generate TypeDoc markdown
|
||||
4. Create a `.stories.tsx` file importing the generated markdown
|
||||
5. The documentation appears automatically in Storybook
|
||||
|
||||
@@ -314,7 +314,7 @@ These tests cover the logic of the components and utilities. Built with Vitest
|
||||
and React Testing Library.
|
||||
|
||||
```bash
|
||||
yarn test:unit
|
||||
pnpm test:unit
|
||||
```
|
||||
|
||||
### Visual Regression Tests
|
||||
@@ -323,7 +323,7 @@ These tests ensure the UI components render correctly.
|
||||
Built with Storybook and run under vitest using playwright.
|
||||
|
||||
```bash
|
||||
yarn test:storybook:update
|
||||
pnpm test:storybook:update
|
||||
```
|
||||
|
||||
Each story will be rendered and a screenshot will be taken and compared to the
|
||||
@@ -341,7 +341,7 @@ First see our [translation guide](../../docs/translating.md) and [translation de
|
||||
To generate translation strings for this package, run:
|
||||
|
||||
```bash
|
||||
yarn i18n
|
||||
pnpm i18n
|
||||
```
|
||||
|
||||
## Publish a new version
|
||||
|
||||
@@ -35,17 +35,17 @@
|
||||
"package.json"
|
||||
],
|
||||
"scripts": {
|
||||
"i18n": "matrix-gen-i18n src && yarn i18n:sort && yarn i18n:lint",
|
||||
"i18n": "matrix-gen-i18n src && pnpm i18n:sort && pnpm i18n:lint",
|
||||
"i18n:sort": "matrix-sort-i18n src/i18n/strings/en_EN.json",
|
||||
"i18n:lint": "matrix-i18n-lint && prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
|
||||
"test:unit": "vitest --project=unit",
|
||||
"test:storybook": "yarn build:doc && vitest --project=storybook",
|
||||
"test:storybook": "pnpm build:doc && vitest --project=storybook",
|
||||
"test:storybook:update": "playwright-screenshots --entrypoint /work/scripts/storybook-screenshot-update.sh --with-node-modules",
|
||||
"prepare": "patch-package && vite build",
|
||||
"prepare": "vite build",
|
||||
"storybook": "storybook dev -p 6007",
|
||||
"build:storybook": "yarn build:doc && storybook build && node scripts/storybook-build-i18n.ts",
|
||||
"build:storybook": "pnpm build:doc && storybook build && node scripts/storybook-build-i18n.ts",
|
||||
"build:doc": "typedoc",
|
||||
"lint": "yarn lint:types && yarn lint:js",
|
||||
"lint": "pnpm lint:types && pnpm lint:js",
|
||||
"lint:js": "eslint --max-warnings 0 src && prettier --check .",
|
||||
"lint:types": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json"
|
||||
},
|
||||
@@ -79,8 +79,8 @@
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/counterpart": "^0.18.4",
|
||||
"@types/lodash": "^4.17.20",
|
||||
"@types/react": "^19.2.2",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "catalog:",
|
||||
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
||||
"@typescript-eslint/parser": "^8.53.1",
|
||||
"@vector-im/compound-web": "^8.3.6",
|
||||
@@ -101,14 +101,13 @@
|
||||
"eslint-plugin-storybook": "^10.0.7",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"expect": "^30.2.0",
|
||||
"patch-package": "^8.0.1",
|
||||
"prettier": "^3.6.2",
|
||||
"storybook": "^10.0.7",
|
||||
"storybook-addon-vis": "^3.1.2",
|
||||
"typedoc": "^0.28.16",
|
||||
"typedoc-plugin-markdown": "^4.9.0",
|
||||
"typedoc-plugin-missing-exports": "^4.1.2",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^7.3.1",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-node-polyfills": "^0.25.0",
|
||||
@@ -119,7 +118,7 @@
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
||||
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264",
|
||||
"peerDependencies": {
|
||||
"@vector-im/compound-web": "^8.3.5"
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
diff --git a/node_modules/@types/mdx/types.d.ts b/node_modules/@types/mdx/types.d.ts
|
||||
index 498bb69..4e89216 100644
|
||||
--- a/node_modules/@types/mdx/types.d.ts
|
||||
+++ b/node_modules/@types/mdx/types.d.ts
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
// @ts-ignore JSX runtimes may optionally define JSX.ElementType. The MDX types need to work regardless whether this is
|
||||
// defined or not.
|
||||
-type ElementType = any extends JSX.ElementType ? never : JSX.ElementType;
|
||||
+type ElementType = any extends JSX.ElementType ? never : React.JSX.ElementType;
|
||||
|
||||
/**
|
||||
* This matches any function component types that ar part of `ElementType`.
|
||||
@@ -20,12 +20,12 @@ type ClassElementType = Extract<ElementType, new(props: Record<string, any>) =>
|
||||
/**
|
||||
* A valid JSX string component.
|
||||
*/
|
||||
-type StringComponent = Extract<keyof JSX.IntrinsicElements, ElementType extends never ? string : ElementType>;
|
||||
+type StringComponent = Extract<keyof React.JSX.IntrinsicElements, ElementType extends never ? string : ElementType>;
|
||||
|
||||
/**
|
||||
* A JSX element returned by MDX content.
|
||||
*/
|
||||
-export type Element = JSX.Element;
|
||||
+export type Element = React.JSX.Element;
|
||||
|
||||
/**
|
||||
* A valid JSX function component.
|
||||
@@ -44,7 +44,7 @@ type FunctionComponent<Props> = ElementType extends never
|
||||
*/
|
||||
type ClassComponent<Props> = ElementType extends never
|
||||
// If JSX.ElementType isn’t defined, the valid return type is a constructor that returns JSX.ElementClass
|
||||
- ? new(props: Props) => JSX.ElementClass
|
||||
+ ? new(props: Props) => React.JSX.ElementClass
|
||||
: ClassElementType extends never
|
||||
// If JSX.ElementType is defined, but doesn’t allow constructors, function components are disallowed.
|
||||
? never
|
||||
@@ -70,7 +70,7 @@ interface NestedMDXComponents {
|
||||
export type MDXComponents =
|
||||
& NestedMDXComponents
|
||||
& {
|
||||
- [Key in StringComponent]?: Component<JSX.IntrinsicElements[Key]>;
|
||||
+ [Key in StringComponent]?: Component<React.JSX.IntrinsicElements[Key]>;
|
||||
}
|
||||
& {
|
||||
/**
|
||||
@@ -3,7 +3,7 @@
|
||||
# Update storybook screenshots
|
||||
#
|
||||
# This script should be used as the entrypoint parameter of the `playwright-screenshots` script. It
|
||||
# installs the yarn dependencies, and then runs `vitest --run --update --project=storybook` to update the storybook screenshots.
|
||||
# installs the pnpm dependencies, and then runs `vitest --run --update --project=storybook` to update the storybook screenshots.
|
||||
#
|
||||
# It requires that `playwright-screenshots` is given the `--with-node-modules` parameter.
|
||||
|
||||
@@ -13,7 +13,7 @@ set -e
|
||||
# because we have which must be built for the right architecture (and some environments use a VM
|
||||
# to run docker containers, meaning that things inside a container use a different architecture than
|
||||
# those on the host).
|
||||
yarn
|
||||
pnpm install
|
||||
|
||||
# Now run the screenshot update, we set CI=1 to inform vis to update the real baselines
|
||||
CI=1 /work/node_modules/.bin/vitest --run --update --project=storybook "$@"
|
||||
|
||||
@@ -94,7 +94,7 @@ const translateWithFallback = (text: string, options?: IVariables): { translated
|
||||
// Even the translation via FALLBACK_LOCALE failed; this can happen if
|
||||
//
|
||||
// 1. The string isn't in the translations dictionary, usually because you're in develop
|
||||
// and haven't run yarn i18n
|
||||
// and haven't run pnpm i18n
|
||||
// 2. Loading the translation resources over the network failed, which can happen due to
|
||||
// to network or if the client tried to load a translation that's been removed from the
|
||||
// server.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user