Skip to content

Commit 0138a6c

Browse files
authored
Merge pull request #19 from nicolethoen/general-pf-cleanup
fix: PatternFly compliance cleanup and component architecture improvements
2 parents 85c6957 + a18a249 commit 0138a6c

30 files changed

+1541
-777
lines changed

.github/workflows/build-lint-test.yml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
- run: |
12-
if [[ ! -z "${GH_PR_NUM}" ]]; then
12+
if [[ ! -z "${GH_PR_NUM}" ]]; then
1313
echo "Checking out PR"
1414
git fetch origin pull/$GH_PR_NUM/head:tmp
1515
git checkout tmp
@@ -22,14 +22,16 @@ jobs:
2222
run: corepack enable
2323
- uses: actions/cache@v4
2424
id: yarn-cache
25-
name: Cache npm deps
25+
name: Load Yarn cache
2626
with:
2727
path: |
28-
node_modules
29-
**/node_modules
30-
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
31-
- run: yarn install --immutable
32-
if: steps.yarn-cache.outputs.cache-hit != 'true'
28+
.yarn/cache
29+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-yarn-cache-
32+
- name: Install dependencies
33+
shell: bash
34+
run: yarn install --immutable --network-timeout 100000
3335
- uses: actions/cache@v4
3436
id: dist
3537
name: Cache dist
@@ -48,7 +50,7 @@ jobs:
4850
steps:
4951
- uses: actions/checkout@v4
5052
- run: |
51-
if [[ ! -z "${GH_PR_NUM}" ]]; then
53+
if [[ ! -z "${GH_PR_NUM}" ]]; then
5254
echo "Checking out PR"
5355
git fetch origin pull/$GH_PR_NUM/head:tmp
5456
git checkout tmp
@@ -61,23 +63,22 @@ jobs:
6163
run: corepack enable
6264
- uses: actions/cache@v4
6365
id: yarn-cache
64-
name: Cache npm deps
66+
name: Load Yarn cache
6567
with:
6668
path: |
67-
node_modules
68-
**/node_modules
69-
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
70-
- run: yarn install --immutable
71-
if: steps.yarn-cache.outputs.cache-hit != 'true'
69+
.yarn/cache
70+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
71+
restore-keys: |
72+
${{ runner.os }}-yarn-cache-
73+
- name: Install dependencies
74+
shell: bash
75+
run: yarn install --immutable --network-timeout 100000
7276
- uses: actions/cache@v4
7377
id: lint-cache
7478
name: Load lint cache
7579
with:
7680
path: '.eslintcache'
7781
key: ${{ runner.os }}-lint-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
78-
- name: Enable Corepack
79-
shell: bash
80-
run: corepack enable
8182
- name: ESLint
8283
run: yarn lint:js
8384
- name: MDLint
@@ -91,7 +92,7 @@ jobs:
9192
- uses: actions/checkout@v4
9293
# Yes, we really want to checkout the PR
9394
- run: |
94-
if [[ ! -z "${GH_PR_NUM}" ]]; then
95+
if [[ ! -z "${GH_PR_NUM}" ]]; then
9596
echo "Checking out PR"
9697
git fetch origin pull/$GH_PR_NUM/head:tmp
9798
git checkout tmp
@@ -104,23 +105,22 @@ jobs:
104105
run: corepack enable
105106
- uses: actions/cache@v4
106107
id: yarn-cache
107-
name: Cache npm deps
108+
name: Load Yarn cache
108109
with:
109110
path: |
110-
node_modules
111-
**/node_modules
112-
~/.cache/Cypress
113-
~/.cache/puppeteer
114-
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
115-
- run: yarn install --immutable
116-
if: steps.yarn-cache.outputs.cache-hit != 'true'
111+
.yarn/cache
112+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
113+
restore-keys: |
114+
${{ runner.os }}-yarn-cache-
115+
- name: Install dependencies
116+
shell: bash
117+
run: yarn install --immutable --network-timeout 100000
117118
- uses: actions/cache@v4
118119
id: dist
119120
name: Cache dist
120121
with:
121122
path: |
122123
packages/*/dist
123-
packages/react-styles/css
124124
key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }}
125125
- name: Build dist
126126
run: yarn build
@@ -136,7 +136,7 @@ jobs:
136136
- uses: actions/checkout@v4
137137
# Yes, we really want to checkout the PR
138138
- run: |
139-
if [[ ! -z "${GH_PR_NUM}" ]]; then
139+
if [[ ! -z "${GH_PR_NUM}" ]]; then
140140
echo "Checking out PR"
141141
git fetch origin pull/$GH_PR_NUM/head:tmp
142142
git checkout tmp
@@ -149,23 +149,23 @@ jobs:
149149
run: corepack enable
150150
- uses: actions/cache@v4
151151
id: yarn-cache
152-
name: Cache npm deps
152+
name: Load Yarn cache
153153
with:
154154
path: |
155-
node_modules
156-
**/node_modules
157-
~/.cache/Cypress
158-
~/.cache/puppeteer
159-
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
160-
- run: yarn install --immutable
161-
if: steps.yarn-cache.outputs.cache-hit != 'true'
155+
.yarn/cache
156+
~/.cache/puppeteer
157+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
158+
restore-keys: |
159+
${{ runner.os }}-yarn-cache-
160+
- name: Install dependencies
161+
shell: bash
162+
run: yarn install --immutable --network-timeout 100000
162163
- uses: actions/cache@v4
163164
id: dist
164165
name: Cache dist
165166
with:
166167
path: |
167168
packages/*/dist
168-
packages/react-styles/css
169169
key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }}
170170
- name: Build dist
171171
run: yarn build

.github/workflows/build.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/pr-preview.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
### WARNING -- this file was generated by generate-workflows
31
name: pr-preview
42
on: pull_request_target
53
jobs:
@@ -23,36 +21,39 @@ jobs:
2321
git rev-parse origin/main..HEAD
2422
git log origin/main..HEAD --format="%b"
2523
26-
# Yes, we really want to checkout the PR
27-
# Injected by generate-workflows.js
2824
- uses: actions/setup-node@v4
2925
with:
3026
node-version: '20'
27+
- name: Enable Corepack
28+
shell: bash
29+
run: corepack enable
3130
- uses: actions/cache@v4
32-
id: npm-cache
33-
name: Load npm deps from cache
31+
id: yarn-cache
32+
name: Load Yarn cache
3433
with:
35-
path: '**/node_modules'
36-
key: ${{ runner.os }}-npm-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }}
37-
- run: npm install --frozen-lockfile --legacy-peer-deps
38-
if: steps.yarn-cache.outputs.cache-hit != 'true'
39-
- run: npm run build
34+
path: |
35+
.yarn/cache
36+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-yarn-cache-
39+
- name: Install dependencies
40+
shell: bash
41+
run: yarn install --immutable --network-timeout 100000
42+
- run: yarn build
4043
name: Build component groups
4144
- uses: actions/cache@v4
4245
id: docs-cache
4346
name: Load webpack cache
4447
with:
4548
path: '.cache'
4649
key: ${{ runner.os }}-v4-${{ hashFiles('yarn.lock') }}
47-
- run: npm run build:docs
50+
- run: yarn build:docs
4851
name: Build docs
49-
- run: node .github/upload-preview.js packages/module/public
50-
name: Upload docs
51-
if: always()
52-
- run: npx puppeteer browsers install chrome
53-
name: Install Chrome for Puppeteer
54-
- run: npm run serve:docs & npm run test:a11y
55-
name: a11y tests
56-
- run: node .github/upload-preview.js packages/module/coverage
57-
name: Upload a11y report
58-
if: always()
52+
- name: Deploy preview to surge
53+
if: env.SURGE_LOGIN != '' && env.SURGE_TOKEN != ''
54+
run: |
55+
npx surge packages/module/public --domain pr-${{ github.event.number }}-widgetized-dashboard.surge.sh
56+
- name: Install Chrome for Puppeteer
57+
run: npx puppeteer browsers install chrome
58+
- name: a11y tests
59+
run: yarn serve:docs & yarn test:a11y

.github/workflows/release.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,22 @@ jobs:
2222
run: corepack enable
2323
- uses: actions/cache@v4
2424
id: yarn-cache
25-
name: Cache npm deps
25+
name: Load Yarn cache
2626
with:
2727
path: |
28-
node_modules
29-
**/node_modules
30-
~/.cache/Cypress
31-
~/.cache/puppeteer
32-
key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
33-
- run: yarn install --immutable
34-
if: steps.yarn-cache.outputs.cache-hit != 'true'
28+
.yarn/cache
29+
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-yarn-cache-
32+
- name: Install dependencies
33+
shell: bash
34+
run: yarn install --immutable --network-timeout 100000
3535
- uses: actions/cache@v4
3636
id: dist
3737
name: Cache dist
3838
with:
3939
path: |
4040
packages/*/dist
41-
packages/react-styles/css
4241
key: ${{ runner.os }}-dist-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock', 'package.json', 'packages/*/*', '!packages/*/dist', '!packages/*/node_modules') }}
4342
- name: Build dist
4443
run: yarn build

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,23 @@ This library requires React 18+ and React DOM 18+ as peer dependencies. Make sur
2929
yarn add react@^18 react-dom@^18
3030
```
3131

32+
## Styles
33+
34+
Import the required stylesheet in your application entry point:
35+
36+
```ts
37+
import '@patternfly/widgetized-dashboard/dist/esm/styles.css';
38+
```
39+
40+
This stylesheet is required for the dashboard layout, drag-and-drop, and widget tile styling. You will also need PatternFly's base styles — see the [PatternFly getting started guide](https://www.patternfly.org/get-started/develop/) for details.
41+
3242
## Quick Start
3343

3444
```tsx
3545
import React from 'react';
3646
import { WidgetLayout, WidgetMapping, ExtendedTemplateConfig } from '@patternfly/widgetized-dashboard';
37-
import { CubeIcon } from '@patternfly/react-icons';
47+
import '@patternfly/widgetized-dashboard/dist/esm/styles.css';
48+
import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
3849

3950
// Define your widgets
4051
const widgetMapping: WidgetMapping = {
@@ -86,7 +97,7 @@ function App() {
8697

8798
- [Basic Example](./packages/module/patternfly-docs/content/examples/BasicExample.tsx) - Complete dashboard with drawer
8899
- [Locked Layout Example](./packages/module/patternfly-docs/content/examples/LockedLayoutExample.tsx) - Dashboard with locked widgets
89-
- [Without Drawer Example](./packages/module/patternfly-docs/content/examples/WithoutDrawerExample.tsx) - Grid layout without widget drawer
100+
- [Custom Toolbar Example](./packages/module/patternfly-docs/content/examples/CustomToolbarExample.tsx) - Dashboard with custom toolbar controls
90101

91102
## Key Components
92103

babel.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module.exports = {
22
presets: [
33
['@babel/preset-env', { targets: { node: 'current' } }],
44
['@babel/preset-react', { runtime: 'automatic' }],
5-
'@babel/preset-flow',
65
'@babel/preset-typescript'
76
]
87
};

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ module.exports = {
1010
transform: {
1111
'^.+\\.[jt]sx?$': 'babel-jest'
1212
},
13+
transformIgnorePatterns: [
14+
'node_modules/(?!@patternfly)'
15+
],
1316
moduleNameMapper: {
1417
'\\.(css|less)$': '<rootDir>/styleMock.js'
1518
},

0 commit comments

Comments
 (0)