Skip to content

Commit 1385671

Browse files
authored
Merge branch 'main' into copilot/fix-4206
2 parents 5ade4a3 + 6385172 commit 1385671

File tree

12 files changed

+220
-19
lines changed

12 files changed

+220
-19
lines changed

.github/copilot-instructions.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# DB UX Design System v3 Core Web
2+
3+
DB UX Design System v3 Core Web is a monorepo containing CSS/SCSS styles, components, and framework-specific implementations (Angular, React, Vue, Web Components) for the Deutsche Bahn design system.
4+
5+
**Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.**
6+
7+
## Working Effectively
8+
9+
### Required Prerequisites
10+
- **Node.js 24**: Check `.nvmrc` file. Use `node --version` to verify current version.
11+
- **npm**: Package manager for dependency management and build scripts.
12+
13+
### Bootstrap and Setup
14+
1. **CRITICAL**: Copy `.env.template` to `.env` and add your email:
15+
```bash
16+
cp .env.template .env
17+
# Edit .env file: Set COMMIT_MAIL=your.email@example.com
18+
```
19+
20+
2. **Install dependencies**:
21+
```bash
22+
npm install --ignore-scripts
23+
```
24+
**NOTE**: Use the `--ignore-scripts` flag because the chromedriver package attempts to download binaries during installation, which fails in restricted corporate networks (e.g., behind firewalls or proxies). This workaround prevents installation errors in such environments.
25+
26+
3. **Decode DB Theme assets** (optional for basic development):
27+
```bash
28+
node node_modules/@db-ux/db-theme-fonts/build/scripts/index.js
29+
node node_modules/@db-ux/db-theme-icons/build/scripts/index.js
30+
node node_modules/@db-ux/db-theme-illustrative-icons/build/scripts/index.js
31+
```
32+
**NOTE**: These will fail with placeholder credentials in `.env` but are not required for basic development.
33+
34+
### Build and Test
35+
- **Build core packages**:
36+
```bash
37+
npm run build
38+
```
39+
**TIMING**: Takes ~30 seconds. NEVER CANCEL. Set timeout to 120+ seconds.
40+
41+
- **Build all framework outputs**:
42+
```bash
43+
npm run build-outputs
44+
```
45+
**TIMING**: Takes ~2 minutes. NEVER CANCEL. Set timeout to 300+ seconds.
46+
47+
- **Run tests**:
48+
```bash
49+
npm run test
50+
```
51+
**TIMING**: Takes ~10 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
52+
53+
### Development
54+
- **Start interactive development server**:
55+
```bash
56+
npm run dev
57+
```
58+
**Interactive**: Will prompt to select frameworks (plain-html, angular, react, vue, stencil, etc.). Default selection is plain-html.
59+
**TIMING**: Takes ~30 seconds to start. Runs on http://localhost:5173/
60+
61+
- **Start documentation site (Patternhub)**:
62+
```bash
63+
npm run start
64+
```
65+
**TIMING**: Takes ~2 minutes to start. NEVER CANCEL. Set timeout to 300+ seconds.
66+
**ACCESS**: Runs on http://localhost:3000 - full design system documentation and examples.
67+
68+
## Validation
69+
70+
### Always Run These Commands Before Committing
71+
```bash
72+
npm run build # Verify core packages build
73+
npm run test # Verify all tests pass
74+
npm run lint # NOTE: May fail if Nuxt showcase hasn't been run yet - this is known
75+
npm run build-outputs # Verify framework outputs build
76+
```
77+
78+
### Manual Validation Scenarios
79+
**ALWAYS test actual functionality after making changes:**
80+
81+
1. **Component Development Validation**:
82+
- Run `npm run dev` and select `plain-html`
83+
- Open http://localhost:5173/ in browser
84+
- Navigate to components and verify visual rendering
85+
- Test interactive components (buttons, forms, etc.)
86+
87+
2. **Documentation Site Validation**:
88+
- Run `npm run start`
89+
- Open http://localhost:3000 in browser
90+
- Navigate through component documentation
91+
- Verify code examples render correctly
92+
93+
3. **Framework-Specific Validation**:
94+
- Run `npm run dev` and select target framework (react, vue, angular)
95+
- Test component integration in selected framework
96+
- Verify framework-specific showcase builds: `npm run build-showcases`
97+
98+
### Visual Regression Testing
99+
**E2E testing with Playwright** (requires Docker):
100+
```bash
101+
# Generate/update screenshots:
102+
npm run regenerate:screenshots
103+
# Test visual regression:
104+
docker-compose --file ./e2e/docker-compose.yml up
105+
```
106+
**TIMING**: Visual tests take 10+ minutes. NEVER CANCEL. Set timeout to 1800+ seconds.
107+
108+
## Common Tasks
109+
110+
### Working with Components
111+
- **Generate new component**: `npm run generate:component`
112+
- **Component build location**: `packages/components/build/`
113+
- **Framework outputs**: `output/react/`, `output/vue/`, `output/angular/`, `output/stencil/`
114+
115+
### Working with Styles
116+
- **Foundation styles**: `packages/foundations/`
117+
- **Component styles**: `packages/components/src/styles/`
118+
- **Build artifacts**: `packages/foundations/build/` and `packages/components/build/`
119+
120+
### Key Repository Locations
121+
```
122+
├── packages/
123+
│ ├── foundations/ # Base CSS/SCSS styles and design tokens
124+
│ ├── components/ # Component CSS and build definitions
125+
│ ├── migration/ # Migration utilities between versions
126+
│ └── stylelint/ # DB UX Design System Stylelint plugin for QS
127+
├── output/ # Framework-specific generated code
128+
│ ├── angular/ # Angular components (@db-ux/ngx-core-components)
129+
│ ├── react/ # React components (@db-ux/react-core-components)
130+
│ ├── vue/ # Vue 3 components (@db-ux/v-core-components)
131+
│ └── stencil/ # Web Components (@db-ux/wc-core-components)
132+
├── showcases/ # Example applications for each framework
133+
├── e2e/ # End-to-end testing with Playwright
134+
└── docs/ # Documentation files
135+
```
136+
137+
### Package Scripts Reference
138+
```bash
139+
# Development
140+
npm run dev # Interactive dev server (framework selection)
141+
npm run start # Start Patternhub documentation site
142+
143+
# Building
144+
npm run build # Build core packages (~30 seconds)
145+
npm run build-outputs # Build all framework outputs (~2 minutes)
146+
npm run build-showcases # Build example applications
147+
148+
# Testing & Quality
149+
npm run test # Run test suite (~10 seconds)
150+
npm run lint # Run all linters (known issue: may fail if Nuxt showcase hasn't been run yet; see "Known Issues and Workarounds" below)
151+
npm run regenerate:screenshots # Update visual regression tests material
152+
153+
# Utilities
154+
npm run clean # Clean build artifacts
155+
npm run generate:component # Generate new component scaffolding
156+
```
157+
158+
## Known Issues and Workarounds
159+
160+
### Installation Issues
161+
- **chromedriver fails**: Use `npm install --ignore-scripts` - this is expected in restricted network environments
162+
- **Font decoding fails**: Expected with placeholder credentials - does not affect basic development
163+
164+
### Build Issues
165+
- **Nuxt-related linting failures**: May fail if Nuxt showcase hasn't been run yet (requires `showcases/nuxt-showcase/.nuxt/tsconfig.json` to be generated)
166+
- **Stencil warnings**: Component prop name conflicts are expected and documented
167+
168+
### Network Restrictions
169+
- **Docker registry access**: E2E testing requires Docker and may need proxy configuration
170+
- **Asset downloads**: DB Theme assets require valid credentials from Deutsche Bahn Marketing Portal
171+
172+
## Development Workflows
173+
174+
### Adding a New Component
175+
1. `npm run generate:component` - Follow interactive prompts
176+
2. Implement component in `packages/components/src/components/[name]/`
177+
3. Build and test: `npm run build && npm run test`
178+
4. Generate framework outputs: `npm run build-outputs`
179+
5. Test in development server: `npm run dev`
180+
181+
### Modifying Existing Components
182+
1. Make changes in `packages/components/src/components/[name]/`
183+
2. Adapt those changes into the `showcases/vue-showcase`, `showcases/angular-showcase` and `showcases/react-showcase` folders.
184+
3. **Always run**: `npm run build && npm run dev`
185+
4. **Manual validation**: Test component behavior in browser
186+
5. **Before committing**: `npm run test && npm run build-outputs`
187+
188+
### Debugging Build Issues
189+
1. **Check Node.js version**: Must be v24 (see `.nvmrc`)
190+
2. **Clean rebuild**: `npm run clean && npm run build`
191+
3. **Check dependencies**: `npm install --ignore-scripts`
192+
4. **Isolate issue**: Build individual packages using workspace commands
193+
194+
Remember: This is a design system used by Deutsche Bahn applications. Always ensure changes maintain accessibility, consistency, and brand compliance.
0 Bytes
Loading
902 Bytes
Loading
931 Bytes
Loading

package-lock.json

Lines changed: 6 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"vite": "6.3.5"
146146
},
147147
"validate-branch-name": {
148-
"pattern": "((dbux-3)|(dependabot-)|^((test|feat|fix|chore|docs|refactor|style|ci|perf|alert|[0-9]+)\\-[a-zA-Z0-9\\-]+)$)",
148+
"pattern": "((copilot/)|(dependabot-)|^((test|feat|fix|chore|docs|refactor|style|ci|perf|alert|[0-9]+)\\-[a-zA-Z0-9\\-]+)$)",
149149
"errorMsg": "There is something wrong with your branch name. You should rename your branch to a valid name and try again. See the Pattern below."
150150
}
151151
}

packages/components/src/components/input/input.lite.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export default function DBInput(props: DBInputProps) {
279279
{props.children}
280280
<Show when={stringPropVisible(props.message, props.showMessage)}>
281281
<DBInfotext
282-
size="small"
282+
size={props.messageSize || 'small'}
283283
icon={props.messageIcon}
284284
id={state._messageId}>
285285
{props.message}
@@ -289,15 +289,15 @@ export default function DBInput(props: DBInputProps) {
289289
<Show when={state.hasValidState()}>
290290
<DBInfotext
291291
id={state._validMessageId}
292-
size="small"
292+
size={props.validMessageSize || 'small'}
293293
semantic="successful">
294294
{props.validMessage || DEFAULT_VALID_MESSAGE}
295295
</DBInfotext>
296296
</Show>
297297

298298
<DBInfotext
299299
id={state._invalidMessageId}
300-
size="small"
300+
size={props.invalidMessageSize || 'small'}
301301
semantic="critical">
302302
{state._invalidMessage}
303303
</DBInfotext>

packages/components/src/components/input/model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
ShowIconLeadingProps,
2020
ShowIconProps,
2121
ShowIconTrailingProps,
22+
SizeType,
2223
ValueLabelType
2324
} from '../../shared/model';
2425

@@ -76,6 +77,18 @@ export type DBInputDefaultProps = {
7677
* Sets [step value](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step).
7778
*/
7879
step?: number | string;
80+
/**
81+
* The size of the message infotext. Defaults to "small".
82+
*/
83+
messageSize?: SizeType;
84+
/**
85+
* The size of the valid message infotext. Defaults to "small".
86+
*/
87+
validMessageSize?: SizeType;
88+
/**
89+
* The size of the invalid message infotext. Defaults to "small".
90+
*/
91+
invalidMessageSize?: SizeType;
7992
};
8093

8194
export type DBInputProps = DBInputDefaultProps &

showcases/angular-showcase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"watch": "ng build --watch --configuration development"
1818
},
1919
"dependencies": {
20-
"sa11y": "4.1.10"
20+
"sa11y": "4.2.0"
2121
},
2222
"devDependencies": {
2323
"typescript": "5.8.3"

showcases/react-showcase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"react": "18.3.1",
2626
"react-dom": "18.3.1",
2727
"react-router-dom": "7.6.3",
28-
"sa11y": "4.1.10"
28+
"sa11y": "4.2.0"
2929
},
3030
"devDependencies": {
3131
"@types/react": "18.3.13",

0 commit comments

Comments
 (0)