Skip to content

Commit

Permalink
Convert demo application to Vite (#10510)
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
jonkoops authored Jun 5, 2024
1 parent ca93007 commit f4228be
Show file tree
Hide file tree
Showing 80 changed files with 607 additions and 3,336 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ packages/react-docs/.cache
packages/react-docs/static
packages/react-docs/public
packages/react-integration/results
packages/react-integration/demo-app-ts/public
packages/react-integration/demo-app-ts/dist

# package managers
yarn-error.log
Expand Down
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@
"react/jsx-key": "off",
"no-console": "off"
}
},
{
"files": ["packages/react-integration/demo-app-ts/**/*"],
"rules": {
"patternfly-react/no-anonymous-functions": "off",
"react/react-in-jsx-scope": "off",
"spaced-comment": "off"
}
}
]
}
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: demo-app
path: packages/react-integration/demo-app-ts/public
path: packages/react-integration/demo-app-ts/dist

integration-tests:
name: Integration tests
Expand All @@ -87,7 +87,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: demo-app
path: packages/react-integration/demo-app-ts/public
path: packages/react-integration/demo-app-ts/dist

- name: Print environment variables
run: printenv
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"build": "yarn clean && yarn build:generate && yarn build:esm && yarn build:cjs && yarn build:subpaths && yarn build:single:packages",
"build:cjs": "tsc --build --verbose packages/tsconfig.cjs.json",
"build:esm": "tsc --build --verbose packages/tsconfig.json",
"build:integration": "lerna run build:demo-app --stream",
"build:integration": "lerna run build --scope=demo-app-ts --stream",
"build:docs": "yarn workspace @patternfly/react-docs build:docs",
"build:generate": "lerna run generate --parallel --stream",
"build:subpaths": "lerna run subpaths --parallel --stream",
Expand All @@ -93,11 +93,10 @@
"lint:tests": "yarn lint packages/*/src/components/*/__tests__/*.test.*",
"prepare": "ts-patch install -s",
"serve:docs": "yarn workspace @patternfly/react-docs serve",
"serve:integration": "lerna run serve:demo-app",
"serve:integration": "lerna run preview --scope=demo-app-ts",
"start": "yarn build && concurrently --kill-others \"yarn watch\" \"yarn workspace @patternfly/react-docs develop\"",
"start:cypress": "lerna run cypress:open",
"start:demo-app": "lerna run start:demo-app --stream",
"start:demo-app:hot": "lerna run start:demo-app:hot --stream",
"start:demo-app": "lerna run dev --scope=demo-app-ts --stream",
"test": "TZ=EST LC_ALL=en_US.UTF8 jest packages",
"test:a11y": "lerna run test:a11y --stream",
"test:integration": "yarn workspace @patternfly/react-integration test:integration",
Expand Down
1 change: 0 additions & 1 deletion packages/react-integration/demo-app-ts/.env

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-integration/demo-app-ts/.gitignore

This file was deleted.

13 changes: 13 additions & 0 deletions packages/react-integration/demo-app-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>React Demo App</title>
<link rel="icon" type="image/svg+xml" href="/vite.svg">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
33 changes: 7 additions & 26 deletions packages/react-integration/demo-app-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "demo-app-ts",
"private": true,
"version": "5.1.1-prerelease.122",
"type": "module",
"scripts": {
"build:demo-app": "webpack --mode production",
"start:demo-app": "webpack-dev-server",
"start:demo-app:hot": "webpack-dev-server --hot=true",
"serve:demo-app": "node scripts/serve"
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview --port 3000"
},
"dependencies": {
"@patternfly/react-core": "^5.4.0-prerelease.15",
Expand All @@ -16,28 +16,9 @@
"react-router-dom": "^5.3.4"
},
"devDependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"classnames": "^2.5.1",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.4.1",
"css-loader": "^4.3.0",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "6.5.3",
"html-webpack-plugin": "^5.5.0",
"local-web-server": "^2.6.1",
"mini-css-extract-plugin": "^0.12.0",
"react-hot-loader": "4.13.1",
"react-refresh": "0.14.0",
"react-refresh-typescript": "2.0.9",
"style-loader": "3.3.4",
"ts-loader": "^8.3.0",
"url-loader": "^4.1.0",
"webpack": "5.91.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.15.2"
"@types/react-router": "^5.1.20",
"@vitejs/plugin-react-swc": "^3.5.0",
"vite": "^5.2.0"
}
}
1 change: 1 addition & 0 deletions packages/react-integration/demo-app-ts/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions packages/react-integration/demo-app-ts/scripts/serve.js

This file was deleted.

10 changes: 0 additions & 10 deletions packages/react-integration/demo-app-ts/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
color: #61dafb;
}

#webpack-dev-server-client-overlay,
#react-refresh-overlay {
height: 75px !important;
min-height: 75px !important;
left: 50% !important;
top: 0px !important;
width: 400px !important;
position: absolute !important;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
Expand Down
14 changes: 0 additions & 14 deletions packages/react-integration/demo-app-ts/src/App.test.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AboutModalDemo extends React.Component<{}, AboutModalState> {
const { isModalOpen } = this.state;

return (
<React.Fragment>
<>
<Button id="modal-button" variant="primary" onClick={this.handleModalToggle}>
Show About Modal
</Button>
Expand Down Expand Up @@ -56,7 +56,7 @@ export class AboutModalDemo extends React.Component<{}, AboutModalState> {
</TextList>
</TextContent>
</AboutModal>
</React.Fragment>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class AlertDemo extends React.Component<{}, AlertDemoState> {
render() {
const { alertOneVisible, alertTwoVisible } = this.state;
return (
<React.Fragment>
<>
{alertOneVisible && (
<Alert
id="info-alert"
Expand Down Expand Up @@ -65,7 +65,7 @@ export class AlertDemo extends React.Component<{}, AlertDemoState> {
<Alert id="expandable-alert" title="Expandable alert title" isExpandable>
Expandable alert description
</Alert>
</React.Fragment>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AlertTimeoutCloseButtonDemo extends React.Component<{}, AlertTimeou
render() {
const { isOpenAlert } = this.state;
return (
<React.Fragment>
<>
<Button id="close-button-alert-button" onClick={this.onClick}>
Open Alert
</Button>
Expand All @@ -37,7 +37,7 @@ export class AlertTimeoutCloseButtonDemo extends React.Component<{}, AlertTimeou
Alert with close button and timeout
</Alert>
)}
</React.Fragment>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AlertGroupDemo extends React.Component<{}, AlertGroupDemoState> {
this.setState({ timer: timerValue });
};
return (
<React.Fragment>
<>
<InputGroup style={{ marginBottom: '16px' }}>
<InputGroupItem>
<button onClick={startAsyncAlerts} type="button" className={btnClasses}>
Expand All @@ -87,7 +87,7 @@ export class AlertGroupDemo extends React.Component<{}, AlertGroupDemoState> {
/>
))}
</AlertGroup>
</React.Fragment>
</>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const AlertGroupTimeoutFromBottomDemo: React.FunctionComponent = () => {
title={`Alert no. ${count}`}
timeout={timeout}
actionLinks={
<React.Fragment>
<>
<AlertActionLink component="a" href="#">
View details
</AlertActionLink>
Expand All @@ -20,7 +20,7 @@ export const AlertGroupTimeoutFromBottomDemo: React.FunctionComponent = () => {
>
Ignore
</AlertActionLink>
</React.Fragment>
</>
}
key={`Alert no. ${count}`}
id={`Alert no. ${count}`}
Expand All @@ -33,12 +33,12 @@ export const AlertGroupTimeoutFromBottomDemo: React.FunctionComponent = () => {
};

return (
<React.Fragment>
<>
<Button variant="secondary" onClick={onClick}>
Add alert
</Button>
<AlertGroup>{alerts}</AlertGroup>
</React.Fragment>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
BackToTop,
Card,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
Brand,
Button,
Expand All @@ -18,10 +17,12 @@ import {
MenuToggle
} from '@patternfly/react-core';
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
import { Component } from 'react';

const pfLogo = '../../../assets/images/pfLogo.svg';

interface CardDemoState {
selected: string;
selected: string | null;
isExpanded: boolean;
isOpen: boolean;
selectableChecked1: boolean;
Expand All @@ -33,7 +34,7 @@ interface CardDemoState {
selectaleClickableDrawerIsExpanded: boolean;
}

class CardDemo extends React.Component {
class CardDemo extends Component {
static displayName = 'CardDemo';

state: CardDemoState = {
Expand Down Expand Up @@ -153,7 +154,7 @@ class CardDemo extends React.Component {
);

return (
<React.Fragment>
<>
<Card id="cardWithActions">
<CardHeader actions={{ actions, hasNoOffset: true }}>
<Brand src={pfLogo} alt="PatternFly" style={{ height: '50px' }} />
Expand Down Expand Up @@ -345,7 +346,7 @@ class CardDemo extends React.Component {
</DrawerContent>
</Drawer>
</div>
</React.Fragment>
</>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Badge, Chip, ChipGroup } from '@patternfly/react-core';
import React, { Component } from 'react';
import { Component } from 'react';

interface BadgeChipState {
badgeChipArray: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Badge, Chip, ChipGroup } from '@patternfly/react-core';
import React, { Component } from 'react';
import { Component } from 'react';

interface BadgeChipState {
badgeChipArray: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { Component } from 'react';
import { Chip, ChipGroup } from '@patternfly/react-core';

interface ChipWithCategoryGroupState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
import { Component } from 'react';
import { Chip, ChipGroup } from '@patternfly/react-core';
import { css } from '@patternfly/react-styles';
import titleStyles from '@patternfly/react-styles/css/components/Title/title';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class ClipboardCopyDemo extends React.Component {
static displayName = 'ClipboardCopyDemo';
render() {
return (
<React.Fragment>
<>
<ClipboardCopy variant={ClipboardCopyVariant.expansion}>
Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
expansion.
Expand Down Expand Up @@ -55,7 +55,7 @@ export class ClipboardCopyDemo extends React.Component {
>
Some random text.
</ClipboardCopy>
</React.Fragment>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Divider
} from '@patternfly/react-core';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
import React, { Component } from 'react';
import { Component } from 'react';

export class DescriptionListBreakpointsDemo extends Component {
componentDidMount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Popover
} from '@patternfly/react-core';
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
import React, { Component } from 'react';
import { Component } from 'react';

export class DescriptionListDemo extends Component {
componentDidMount() {
Expand Down
Loading

0 comments on commit f4228be

Please sign in to comment.