Skip to content

Commit b1d97f8

Browse files
Copilotlucferbux
andauthored
Move MUI dependencies to peerDependencies to resolve integration challenges (#17)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: lucferbux <[email protected]>
1 parent 268df68 commit b1d97f8

File tree

3 files changed

+114
-9
lines changed

3 files changed

+114
-9
lines changed

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,39 @@
77
## Installation
88

99
```bash
10-
npm install mod-arch-shared
10+
npm install mod-arch-shared @mui/material @mui/icons-material @mui/types sass sass-loader
1111
```
1212

13+
The library requires peer dependencies to be installed alongside the main package:
14+
- **MUI dependencies** (`@mui/material`, `@mui/icons-material`, `@mui/types`) are required for both PatternFly and MUI theme support
15+
- **SASS dependencies** (`sass`, `sass-loader`) are required to process SCSS files used by the library components
16+
17+
### SASS/SCSS Processing Requirements
18+
19+
This library contains SCSS files that need to be processed by your application's build system. You must:
20+
21+
1. **Install the required dependencies:**
22+
```bash
23+
npm install sass sass-loader
24+
```
25+
26+
2. **Configure your webpack to handle SCSS files** by adding this rule to your webpack configuration:
27+
```js
28+
{
29+
test: /\.s[ac]ss$/i,
30+
use: [
31+
// Creates `style` nodes from JS strings
32+
'style-loader',
33+
// Translates CSS into CommonJS
34+
'css-loader',
35+
// Compiles Sass to CSS
36+
'sass-loader',
37+
],
38+
}
39+
```
40+
41+
If you're using Create React App, Vite, or similar build tools, SCSS support is typically included by default when you install the `sass` package.
42+
1343
## Usage
1444

1545
Import components and utilities as needed:
@@ -154,6 +184,8 @@ root.render(
154184
- **`Theme.Patternfly`**: Red Hat PatternFly design system (default)
155185
- **`Theme.MUI`**: Material-UI design system with CSS variables
156186

187+
Both themes require the MUI peer dependencies to be installed.
188+
157189
### Using the Context in Components
158190

159191
Once providers are set up, you can access the configuration and state throughout your application:

package-lock.json

Lines changed: 73 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@
4343
"license": "Apache-2.0",
4444
"peerDependencies": {
4545
"react": ">=16.8.0",
46-
"react-dom": ">=16.8.0"
46+
"react-dom": ">=16.8.0",
47+
"@mui/icons-material": "^6.0.0",
48+
"@mui/material": "^6.0.0",
49+
"@mui/types": "^7.0.0",
50+
"sass": "^1.83.0",
51+
"sass-loader": "^16.0.0"
4752
},
4853
"devDependencies": {
4954
"@babel/preset-env": "^7.21.5",
@@ -70,6 +75,8 @@
7075
"expect": "^29.7.0",
7176
"jest": "^29.7.0",
7277
"jest-environment-jsdom": "^29.7.0",
78+
"sass": "^1.83.0",
79+
"sass-loader": "^16.0.0",
7380
"ts-jest": "^29.2.6",
7481
"tsc-alias": "^1.8.15",
7582
"typescript": "^5.0.4"
@@ -91,7 +98,6 @@
9198
"react-dom": ">=16.8.0",
9299
"react-router": "^7.1.5",
93100
"react-router-dom": "^7.1.5",
94-
"sass": "^1.83.0",
95101
"showdown": "^2.1.0"
96102
},
97103
"optionalDependencies": {

0 commit comments

Comments
 (0)