|
| 1 | +--- |
| 2 | +applyTo: "**" |
| 3 | +--- |
| 4 | +# HPCC Visualization Framework - GitHub Copilot Instructions |
| 5 | + |
| 6 | +## Project Overview |
| 7 | + |
| 8 | +This is the **HPCC Visualization Framework** (also known as "Viz Framework 2.0"), a TypeScript/JavaScript-based data visualization library that provides comprehensive charting, graphing, and dashboard capabilities. The project is published as scoped NPM packages under `@hpcc-js`. |
| 9 | + |
| 10 | +## VSCode Terminal |
| 11 | +- **Use the built-in git bash terminal** in VSCode for all commands |
| 12 | + |
| 13 | +## Architecture & Structure |
| 14 | + |
| 15 | +### Monorepo Organization |
| 16 | +- **Lerna-based monorepo** with packages in `/packages/` directory |
| 17 | +- Each package has its own `package.json`, build configuration, and TypeScript setup |
| 18 | +- Packages are published independently to NPM under the `@hpcc-js/` scope |
| 19 | +- Use `npm` commands in the root folder for common actions like `clean`, `build` and `lint` |
| 20 | +- All sources code is written in TypeScript |
| 21 | + |
| 22 | +### Build System |
| 23 | +- **Vite** is the primary compiler + bundler for all packages |
| 24 | +- **Support for multiple module formats**: ESM + UMD |
| 25 | +- **Source maps** are generated for all builds |
| 26 | + |
| 27 | +### Key Dependencies & Patterns |
| 28 | +- **D3.js ecosystem** - Core visualization dependency, aliased through `@hpcc-js/common` |
| 29 | +- **Widget pattern** - Most components extend base Widget classes |
| 30 | +- **Property-driven APIs** - Components use property setters/getters for configuration |
| 31 | +- **TypeScript interfaces** - Strong typing with API interfaces in `@hpcc-js/api` package |
| 32 | + |
| 33 | +## Package Categories |
| 34 | + |
| 35 | +### Core Packages |
| 36 | +- **`@hpcc-js/common`** - Base widgets, utilities, and D3 re-exports |
| 37 | +- **`@hpcc-js/api`** - TypeScript interfaces and API definitions |
| 38 | +- **`@hpcc-js/util`** - Utility functions and helpers |
| 39 | + |
| 40 | +### Visualization Packages |
| 41 | +- **`@hpcc-js/chart`** - Charts (Bar, Line, Pie, Scatter, etc.) |
| 42 | +- **`@hpcc-js/graph`** - Graph visualizations and network diagrams |
| 43 | +- **`@hpcc-js/map`** - Geographic visualizations with Leaflet integration |
| 44 | +- **`@hpcc-js/tree`** - Tree and hierarchy visualizations |
| 45 | +- **`@hpcc-js/timeline`** - Timeline and temporal visualizations |
| 46 | + |
| 47 | +### UI & Layout Packages |
| 48 | +- **`@hpcc-js/layout`** - Layout containers and dashboard components |
| 49 | +- **`@hpcc-js/form`** - Form controls and input widgets |
| 50 | +- **`@hpcc-js/html`** - HTML-based components and React integration |
| 51 | + |
| 52 | +### Integration Packages |
| 53 | +- **`@hpcc-js/marshaller`** - Data marshalling and dashboard orchestration |
| 54 | +- **`@hpcc-js/comms`** - Communication with HPCC Systems platform |
| 55 | +- **`@hpcc-js/codemirror`** - Code editors for various languages |
| 56 | + |
| 57 | +## Coding Standards & Conventions |
| 58 | + |
| 59 | +### TypeScript |
| 60 | +- Use **strict TypeScript** configuration |
| 61 | +- Export all public APIs through `index.ts` files |
| 62 | +- Import from `@hpcc-js/*` packages, not from internal paths |
| 63 | +- Use proper typing with interfaces from `@hpcc-js/api` |
| 64 | + |
| 65 | +### Class Structure |
| 66 | +- Extend appropriate base classes (`Widget`, `SVGWidget`, `HTMLWidget`) |
| 67 | +- Use property decorators for configurable properties |
| 68 | +- Follow the Widget lifecycle: `enter()`, `update()`, `exit()` |
| 69 | +- Implement proper `render()` methods |
| 70 | + |
| 71 | +### CSS & Styling |
| 72 | +- Use CSS classes with package-specific prefixes |
| 73 | +- Bundle CSS through PostCSS in Rollup configuration |
| 74 | +- Support theming through CSS custom properties |
| 75 | +- Minimize CSS in production builds |
| 76 | + |
| 77 | +### Dependencies |
| 78 | +- **Avoid direct D3 imports** - use re-exports from `@hpcc-js/common` |
| 79 | +- Use rollup aliases to map D3 modules to `@hpcc-js/common` |
| 80 | +- External dependencies should be added to rollup `external` configuration |
| 81 | +- Use the `@hpcc-js/bundle` for consistent external/globals configuration |
| 82 | + |
| 83 | +## Testing & Development |
| 84 | + |
| 85 | +### Test Structure |
| 86 | +- Tests are in `/tests/` directory organized by package |
| 87 | +- Use Vitest as the test runner |
| 88 | +- Browser and Node.js test configurations in `vitest.workspace.ts` |
| 89 | +- Visual regression testing for visualization components |
| 90 | + |
| 91 | +### Demo Applications |
| 92 | +- `/demos/gallery/` - Interactive gallery with live code examples |
| 93 | +- `/demos/imdb/` - Real-world application example |
| 94 | +- Use SystemJS for dynamic module loading in demos |
| 95 | + |
| 96 | +### Development Workflow |
| 97 | +- Use `npm run build` to build all packages |
| 98 | +- Use `lerna run <command>` for package-specific operations |
| 99 | +- Follow semantic versioning for releases |
| 100 | +- Use conventional commits for changelog generation |
| 101 | + |
| 102 | +## Browser & Module Support |
| 103 | + |
| 104 | +### Target Environments |
| 105 | +- **Modern browsers** (IE 11+, Chrome, Firefox, Edge) |
| 106 | +- **Multiple module systems**: UMD, CommonJS, AMD, ES6 |
| 107 | +- **CDN delivery** via unpkg with IIFE builds |
| 108 | +- **Bundler compatibility** (Webpack, Rollup, Parcel) |
| 109 | + |
| 110 | +### Bundle Configuration |
| 111 | +- Use `@hpcc-js/bundle` for consistent externals/globals |
| 112 | +- Generate both development and minified builds |
| 113 | +- Include source maps for debugging |
| 114 | +- Support tree-shaking with ES6 modules |
| 115 | + |
| 116 | +## Common Tasks & Patterns |
| 117 | + |
| 118 | +When working with this codebase: |
| 119 | + |
| 120 | +1. **Adding new visualizations**: Extend appropriate base widget class, implement required interfaces |
| 121 | +2. **Package dependencies**: Always use the monorepo's shared dependencies and build configuration |
| 122 | +3. **CSS styling**: Use PostCSS processing and minimize for production |
| 123 | +4. **Data handling**: Follow the property-driven API pattern for data binding |
| 124 | +5. **TypeScript**: Maintain strict typing and export proper interfaces |
| 125 | +6. **Testing**: Include both unit tests and visual regression tests |
| 126 | +7. **Documentation**: Update gallery examples and README files |
| 127 | +8. **Build configuration**: Use consistent Rollup setup across packages |
| 128 | + |
| 129 | +## HPCC Platform Integration |
| 130 | + |
| 131 | +This framework is designed to work with the **HPCC Systems** big data platform: |
| 132 | +- ECL (Enterprise Control Language) integration |
| 133 | +- Roxie query integration through `@hpcc-js/comms` |
| 134 | +- Workunit result visualization |
| 135 | +- ESP (Enterprise Services Platform) connectivity |
0 commit comments