Skip to content

Commit 3bc6a3e

Browse files
vishalshrm539Sharma
andauthored
Upgrade typedefs, storybook, removed vulnerabilities (#558)
* Upgrade typedefs, storybook, removed vulnerabilities * Fix package.lock * Remove oveerides * Moved Storybook to 8 and moved tinymce to 6.8 * Fix for __docgenInfo property missing and having to add ts-nocheck --------- Co-authored-by: Sharma <[email protected]>
1 parent a3ed38b commit 3bc6a3e

File tree

15 files changed

+15784
-22847
lines changed

15 files changed

+15784
-22847
lines changed

.npmrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
registry = https://registry.npmjs.org/
33
# For now, turn off npm auto-install of peer dependencies to get rid of warnings
44
legacy-peer-deps=true
5-
# Turn off messages such as > [email protected] list and > dx-component-builder-sdk list
6-
loglevel=silent
5+
loglevel=notice
76
#

.storybook/main.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import type { StorybookConfig } from '@storybook/react-webpack5';
21
import path from 'path';
32

43
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
5-
const config: StorybookConfig = {
6-
stories: process.env.STORYBOOK_CONSTELLATION
7-
? ['../src/components/custom-constellation/**/*.stories.@(js|jsx|ts|tsx)']
8-
: ['../src/components/custom-sdk/**/*.stories.@(js|jsx|ts|tsx)'],
9-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
10-
framework: '@storybook/react-webpack5',
11-
docs: {
12-
autodocs: 'tag'
13-
},
14-
features: {
15-
storyStoreV7: true
4+
const config = {
5+
stories:
6+
process.env.STORYBOOK === 'constellation'
7+
? ['../src/components/custom-constellation/**/*.stories.@(js|jsx|ts|tsx)']
8+
: ['../src/components/custom-sdk/**/*.stories.@(js|jsx|ts|tsx)'],
9+
10+
typescript: {
11+
reactDocgen: 'react-docgen-typescript'
1612
},
13+
14+
addons: [
15+
'@storybook/addon-links',
16+
{
17+
name: '@storybook/addon-docs',
18+
options: { mdxBabelOptions: { babelrc: true, configFile: true } }
19+
}
20+
],
21+
framework: '@storybook/react-webpack5',
22+
1723
webpackFinal: async config => {
1824
if (config.resolve?.alias) {
1925
config.resolve.alias['@pega/react-sdk-components/lib/bridge/react_pconnect'] = path.resolve(__dirname, '../__mocks__/react_pconnect.jsx');
@@ -34,6 +40,11 @@ const config: StorybookConfig = {
3440
{
3541
test: /\.(map)$/,
3642
loader: 'null-loader'
43+
},
44+
{
45+
test: /\.tsx?$/,
46+
use: 'ts-loader',
47+
exclude: /node_modules/
3748
}
3849
);
3950
}

.storybook/preview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { Preview } from '@storybook/react';
32
import { Configuration, PopoverManager, Toaster, ModalManager, WorkTheme } from '@pega/cosmos-react-core';
43
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
@@ -8,7 +7,7 @@ import { theme } from '../src/theme';
87

98
import { decorator } from '../__mocks__/react_pconnect';
109

11-
const isConstellation = process.env.STORYBOOK_CONSTELLATION;
10+
const isConstellation = process.env.STORYBOOK === 'constellation';
1211

1312
if (!isConstellation) {
1413
getSdkComponentMap();
@@ -57,7 +56,8 @@ const parameters = {
5756
]
5857
},
5958
docs: {
60-
source: { type: 'code' }
59+
source: { type: 'code' },
60+
codePanel: true
6161
}
6262
};
6363

__mocks__/DetailsFields.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react/no-array-index-key */
12
import React, { createElement, isValidElement } from 'react';
23
import Grid from '@mui/material/Grid';
34
import Typography from '@mui/material/Typography';
@@ -46,7 +47,6 @@ export default function DetailsFields(props) {
4647
fieldComponents.push({
4748
type: theCompType,
4849
label,
49-
// eslint-disable-next-line react/no-array-index-key
5050
value: <React.Fragment key={index}>{createElement(createPConnectComponent(), thePConn.getReferencedViewPConnect())}</React.Fragment>
5151
});
5252
});
@@ -115,14 +115,12 @@ export default function DetailsFields(props) {
115115
}
116116
if (isValidElement(field?.value)) {
117117
return (
118-
// eslint-disable-next-line react/no-array-index-key
119118
<Grid container spacing={1} style={{ padding: '4px 0px' }} key={index}>
120119
{getGridItem(field, `${index}-item`)}
121120
</Grid>
122121
);
123122
}
124123
return (
125-
// eslint-disable-next-line react/no-array-index-key
126124
<Grid container spacing={1} style={{ padding: '4px 0px' }} key={index}>
127125
{getGridItemLabel(field, `${index}-label`)}
128126
{getGridItemValue(field, `${index}-value`)}

__mocks__/state-utils.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { connect, Provider, shallowEqual } from 'react-redux';
22

33
const connectToState = (mapStateToProps = () => {}) => {
4-
return (Component: any) => {
4+
return Component => {
55
const ConnectedComponent = connect(mapStateToProps, null, null, {
66
areStatePropsEqual: (next, prev: any) => {
77
// Compare visibility
@@ -29,7 +29,6 @@ const connectToState = (mapStateToProps = () => {}) => {
2929
const store = { getState: () => {}, subscribe: () => {}, dispatch: () => {} };
3030

3131
return (
32-
// @ts-ignore
3332
<Provider store={store}>
3433
<ConnectedComponent {...ownProps} />
3534
</Provider>

constellation-tsconfigs/tsconfig.build.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"../src/components/override-sdk/**/**/*.ts",
99
"../src/components/override-sdk/**/**/*.tsx",
1010
"../src/components/override-sdk/**/**/*.js",
11-
"../src/components/override-sdk/**/**/*.jsx"
11+
"../src/components/override-sdk/**/**/*.jsx",
12+
".stroybook"
1213
],
1314
"exclude": ["node_modules", "../src/**/*.stories.ts", "../src/**/*.stories.tsx", "../src/**/*.stories.js", "../src/**/*.stories.jsx"],
1415
"compilerOptions": {

0 commit comments

Comments
 (0)