Skip to content

Commit

Permalink
Make yarn link with toolkit work (#612)
Browse files Browse the repository at this point in the history
* Set up the package.json files, the ci and vitejs for yarn linking to work

Signed-off-by: MTRNord <[email protected]>

Fix formatting

Signed-off-by: MTRNord <[email protected]>

* [DO NOT ADD TO MAIN BRANCH!] Add temporary ref for CI testing

Signed-off-by: MTRNord <[email protected]>

Fix formatting

Signed-off-by: MTRNord <[email protected]>

* Add missing dedup sections

Signed-off-by: MTRNord <[email protected]>

* Adds react-i18next as a peer dependency and dedupes for widget vitest config

Signed-off-by: Milton Moura <[email protected]>

* Rolling back linked toolkit packages and path specific changes

* Revert CI workflow to previous state

Signed-off-by: Milton Moura <[email protected]>

---------

Signed-off-by: MTRNord <[email protected]>
Signed-off-by: Milton Moura <[email protected]>
Co-authored-by: Milton Moura <[email protected]>
  • Loading branch information
MTRNord and mgcm authored Nov 11, 2024
1 parent 7f4b851 commit b7d3906
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 16 deletions.
18 changes: 5 additions & 13 deletions matrix-neoboard-widget/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

import basicSsl from '@vitejs/plugin-basic-ssl';
import react from '@vitejs/plugin-react-swc';
import {
Plugin,
PluginOption,
defineConfig,
searchForWorkspaceRoot,
} from 'vite';
import { Plugin, PluginOption, defineConfig } from 'vite';

const plugins: [Plugin | PluginOption] = [react()];
let port = 5273;
Expand All @@ -47,19 +42,16 @@ export default defineConfig({
dedupe: [
'react',
'react-dom',
'@matrix-widget-toolkit/react',
'react-i18next',
'react-use',
'react-redux',
'@mui/material',
'@matrix-widget-toolkit/react',
],
},
server: {
fs: {
allow: [
searchForWorkspaceRoot(process.cwd()),
'../matrix-neoboard/packages/react-sdk/src/components/BoardBar/pdf/',
'../matrix-neoboard/node_modules/@fontsource/',
'../matrix-neoboard/node_modules/pdfmake/build/',
],
strict: false,
},
port,
strictPort: true,
Expand Down
10 changes: 10 additions & 0 deletions matrix-neoboard-widget/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
import { defineConfig } from 'vite';

export default defineConfig({
resolve: {
dedupe: [
'react',
'react-dom',
'react-i18next',
'react-use',
'react-redux',
'@mui/material',
],
},
test: {
environment: 'jsdom',
setupFiles: ['./src/setupTests.ts'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"matrix-neoboard-widget",
"packages/*"
],
"type": "module",
"devDependencies": {
"@changesets/cli": "^2.27.9",
"@eslint/compat": "^1.2.2",
Expand Down
7 changes: 5 additions & 2 deletions packages/react-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"loglevel": "^1.9.2",
"matrix-widget-api": "^1.9.0",
"pdfmake": "^0.2.13",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.3.1",
"react-draggable": "^4.4.6",
"react-dropzone": "^14.2.9",
"react-hotkeys-hook": "^4.5.0",
Expand All @@ -48,6 +46,11 @@
"tinycolor2": "^1.6.0",
"yjs": "^13.6.19"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.0.1"
},
"devDependencies": {
"@matrix-widget-toolkit/testing": "^3.0.1",
"@testing-library/jest-dom": "^6.6.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-sdk/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
import { defineConfig } from 'vite';

export default defineConfig({
resolve: {
dedupe: [
'react',
'react-dom',
'react-use',
'react-redux',
'@mui/material',
// Needed as both projects run in the same context and otherwise might cause issues sometimes
'@nordeck/matrix-neoboard-widget',
],
},
test: {
// Happy-Dom has no support for the blob: scheme. So we need to use jsdom
environment: 'jsdom',
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@
dependencies:
"@babel/types" "^7.25.6"

"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.2", "@babel/runtime@^7.24.8", "@babel/runtime@^7.25.0", "@babel/runtime@^7.25.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.1.2":
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.9.tgz#65884fd6dc255a775402cc1d9811082918f4bf00"
integrity sha512-4zpTHZ9Cm6L9L+uIqghQX8ZXg8HKFcjYO3qHoO8zTmRm6HQUJ8SSJ+KRvbMBZn0EGVlT4DRYeQ/6hjlyXBh+Kg==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.18.3", "@babel/runtime@^7.23.2", "@babel/runtime@^7.24.8", "@babel/runtime@^7.25.0", "@babel/runtime@^7.25.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.25.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.6.tgz#9afc3289f7184d8d7f98b099884c26317b9264d2"
integrity sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==
Expand Down

0 comments on commit b7d3906

Please sign in to comment.