Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: build-lint-test
# PR workflows are path-scoped in check-pr.yml so CI does not run for unrelated-only changes.
on:
workflow_call:
jobs:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ on:
branches:
- main
- v6
paths:
- 'packages/**'
- 'scripts/**'
- 'fed-mini-modules.js'
- '.gitignore'
- 'renovate.json'
- 'LICENSE'
- 'package.json'
- 'yarn.lock'
- 'jest.config.js'
- 'jest.setup.js'
- 'jest.setup-after-env.js'
- 'styleMock.js'
- 'babel.config.js'
- '.eslintrc.json'
- '.eslintrc-md.json'
- '.eslintignore'
- '.prettierrc.json'
- '.prettierignore'
- '.husky/**'
- '.github/workflows/**'
- 'AGENTS.md'
- 'README.md'
jobs:
call-build-lint-test-workflow:
uses: ./.github/workflows/build-lint-test.yml
43 changes: 43 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Agent and contributor context

This repository is a **Yarn v1 workspace** with a single published package.

## Layout

| Path | Package / role |
|------|----------------|
| Repo root | `@patternfly/react-user-feedback-root` — shared tooling (ESLint, Prettier, Jest, Babel), CI entrypoints, and workspace scripts. |
| `packages/module/` | `@patternfly/react-user-feedback` — the extension source, TypeScript build, PatternFly docs (examples + generated assets), and `semantic-release` config. |

Generated or framework-owned files under `packages/module/patternfly-docs/generated/` should be treated as build output unless you are intentionally updating the docs pipeline.

## Commands (run from repo root)

| Task | Command |
|------|---------|
| Install | `yarn install` |
| Build library (`dist/`) | `yarn build` (delegates to `yarn workspace @patternfly/react-user-feedback build`) |
| Dev server (docs + examples) | `yarn start` |
| Unit tests (Jest + RTL) | `yarn test` |
| Lint (JS/TS + Markdown) | `yarn lint` |
| Docs production build | `yarn build:docs` |
| Serve built docs | `yarn serve:docs` |
| A11y tests | `yarn build:docs && yarn serve:docs` (separate shell) then `yarn test:a11y` |

**Node:** CI uses Node 20. The root `package.json` includes a `packageManager` field for Yarn 1.22.x.

## CI scope (path filters)

`.github/workflows/check-pr.yml` limits `build-lint-test` to pull requests that touch **listed paths** (see that file for the exact set). Examples that **do** trigger CI include `packages/**`, root Jest/Babel/ESLint config, `package.json`, `yarn.lock`, `.gitignore`, `renovate.json`, `agentready-checklist-report-*.md`, `LICENSE`, workflows, `README.md`, and `AGENTS.md`.

**Not every root file is listed.** If your PR only changes paths outside the filter (for example a new root dotfile or doc not yet added to the list), the PR check may **not** run automatically. To get a green check: touch any listed path (e.g. add a trivial comment to `AGENTS.md`—prefer updating `check-pr.yml` if the omission was an oversight), or ask a maintainer to run the workflow. When extending the list, prefer explicit paths over broad `**` globs so unrelated edits do not spam CI.

When the workflow runs, jobs use a **full** `yarn build` (single publishable package—no Turborepo/Nx graph). Scoping is intentionally **path-based on the PR** rather than per-task “affected” builds.

## Release

`packages/module/release.config.js` configures **semantic-release** for npm publishing. Commit messages follow [Angular / semantic-release conventions](https://github.com/semantic-release/semantic-release).

## External guidelines

- [PatternFly AI-assisted development / contributing](https://github.com/patternfly/.github/blob/main/CONTRIBUTING.md)
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This project is a [PatternFly](https://github.com/patternfly/patternfly-react) React extension that products can use to collect feedback from users. To view examples of this extension’s use, [view its documentation on PatternFly](https://www.patternfly.org/v4/extensions/user-feedback).

## Repository layout (Yarn workspaces)

This repo uses **[Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/)** (`package.json` → `"workspaces": ["packages/*"]`).

| Location | NPM name | Purpose |
|----------|-----------|---------|
| Repository root | `@patternfly/react-user-feedback-root` | Workspace root: shared lint/test/build tooling and scripts that delegate into packages. |
| `packages/module/` | `@patternfly/react-user-feedback` | Library source, `dist/` build output, PatternFly docs site for examples, and release configuration. |

Most product code and docs examples live under **`packages/module/`**. For agent-oriented notes (commands, CI behavior, boundaries), see **[`AGENTS.md`](./AGENTS.md)**.

## Installing dependencies

[Yarn](https://yarnpkg.com/) is used to develop and build user feedback. To install dependencies for this project, use the `yarn install` terminal command:
Expand All @@ -12,7 +23,7 @@ yarn install

## Building the extension

Once dependencies are installed, you can build user feedback locally using the `yard build` terminal command:
Once dependencies are installed, you can build user feedback locally using the `yarn build` terminal command (runs the workspace package build):

```
yarn build
Expand Down
9 changes: 7 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ module.exports = {
transform: {
'^.+\\.[jt]sx?$': 'babel-jest'
},
// Transpile @patternfly/* ESM in node_modules; extend the (?!...) group if another
// dependency ships untranspiled ESM that Jest must transform.
transformIgnorePatterns: ['/node_modules/(?!(@patternfly)/)'],
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/styleMock.js'
'\\.(css|less)$': '<rootDir>/styleMock.js',
'\\.svg$': '<rootDir>/styleMock.js'
},
testEnvironment: 'jsdom',
setupFiles: ['./jest.setup.js']
setupFiles: ['./jest.setup.js'],
setupFilesAfterEnv: ['./jest.setup-after-env.js']
};
1 change: 1 addition & 0 deletions jest.setup-after-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('@testing-library/jest-dom');
41 changes: 20 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,47 @@
"lint:js": "node --max-old-space-size=4096 node_modules/.bin/eslint packages --ext js,jsx,ts,tsx --cache",
"lint:md": "yarn eslint packages --ext md --no-eslintrc --config .eslintrc-md.json --cache",
"lint": "yarn lint:js && yarn lint:md",
"test": "echo 'Disabled JEST testing'",
"_test": "TZ=EST jest packages",
"test": "TZ=EST jest packages/module --maxWorkers=2",
"test:a11y": "yarn workspace @patternfly/react-user-feedback test:a11y",
"serve:a11y": "yarn workspace @patternfly/react-user-feedback serve:a11y",
"prepare": "husky install"
},
"devDependencies": {
"babel-jest": "^29.2.2",
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-flow": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"react": "^18",
"react-dom": "^18",
"typescript": "^4.7.4",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@testing-library/dom": "9.0.0",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "14.4.3",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"babel-jest": "^29.2.2",
"concurrently": "^5.3.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "8.5.0",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-markdown": "^1.0.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.4",
"eslint-config-standard-with-typescript": "^23.0.0",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-config-prettier": "8.5.0",
"prettier": "2.7.1",
"jest": "^29.2.2",
"husky": "^8.0.3",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "14.4.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/dom": "9.0.0",
"jest-environment-jsdom": "^29.2.2",
"jest": "^29.2.2",
"jest-canvas-mock": "^2.4.0",
"jest-environment-jsdom": "^29.2.2",
"prettier": "2.7.1",
"react": "^18",
"react-dom": "^18",
"rimraf": "^2.6.2",
"serve": "^14.1.2",
"rimraf": "^2.6.2"
"typescript": "^4.7.4"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
28 changes: 28 additions & 0 deletions packages/module/src/Feedback/FeedbackModal.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { render, screen } from '@testing-library/react';
import { FeedbackModal } from './FeedbackModal';

describe('FeedbackModal', () => {
it('does not expose a dialog in the accessibility tree when closed', () => {
const onClose = jest.fn();
render(
<FeedbackModal
isOpen={false}
onClose={onClose}
onShareFeedback="https://example.com/feedback"
/>
);
expect(screen.queryByRole('dialog', { name: 'Feedback modal' })).not.toBeInTheDocument();
});

it('exposes the feedback modal to assistive technologies when open', () => {
const onClose = jest.fn();
render(
<FeedbackModal
isOpen
onClose={onClose}
onShareFeedback="https://example.com/feedback"
/>
);
expect(screen.getByRole('dialog', { name: 'Feedback modal' })).toBeInTheDocument();
});
});
9 changes: 9 additions & 0 deletions packages/module/src/locales/Locale.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defaultFeedback } from './Locale';

describe('defaultFeedback', () => {
it('includes core UI strings for the feedback flow', () => {
expect(defaultFeedback.shareFeedback).toBeTruthy();
expect(defaultFeedback.close).toBeTruthy();
expect(defaultFeedback.tellAboutExperience).toBeTruthy();
});
});
3 changes: 2 additions & 1 deletion packages/module/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": ["src/@types/assets.d.ts", "./src/*", "./src/**/*", "../../index.d.ts"]
"include": ["src/@types/assets.d.ts", "./src/*", "./src/**/*", "../../index.d.ts"],
"exclude": ["**/*.test.ts", "**/*.test.tsx", "**/__tests__/**"]
}
Loading