How chithiraiselvan/primeng works
Project type and purpose
• PrimeNG is an open-source Angular UI component library plus a live “showcase” Angular application demonstrating usage of those components.
• The library provides 80+ UI widgets (accordion, datatable, dialog, etc.) packaged for distribution via NPM. The showcase app is a consumer of the library that loads sample data and renders all components.
File structure
• Top-level build/config dirs and files:
• angular.json, tsconfig*.json, tslint.json – Angular CLI and TypeScript compiler settings
• gulpfile.js – custom build tasks (bundling, copying assets)
• package.json – NPM metadata, dependencies, scripts
• travis.yml – CI pipeline
• “exports” folder: the compiled and packaged JS (.js) and TypeScript declaration (.d.ts) files for each component, plus primeng.js/d.ts entry points
• src/app/components: the source code for each Angular UI component, organized into sub-directories by component name. A “common” folder holds shared services/utilities.
• src/app/showcase: an Angular CLI application consuming the library. It has its own modules, routing, components for each demo page, plus services that load JSON data under src/assets/showcase/data.
• src/environments: environment.ts/prod – build‐time flags for the showcase app
• e2e: Protractor end-to-end tests for the showcase
Key details from README
• PrimeNG is distributed as an NPM package for Angular.
• Consumers install via npm install primeng primeicons, then configure styles in angular.json.
• The library is optimized for tree-shaking: each component is a separate NgModule, and you import only what you need.
a. Main components:
• Developer machine (Node.js + Angular CLI + Gulp)
• Source code:
– Library sources (src/app/components + common utilities)
– Showcase application (src/app/showcase + assets + environment configs)
– E2E tests (e2e folder)
• Build pipeline:
– TypeScript compiler & Angular compiler (ngc)
– Gulp tasks: bundle, copy assets, generate exports
– Angular CLI build for the showcase app
• Distribution artifacts (exports folder + primeng.js/.d.ts)
• NPM registry (publishes primeng package)
• Consumer application (the showcase itself, or any external Angular app)
• CI/CD (Travis CI executing lint, unit tests, build, publish)
• External services: JSON data under assets (for demo), social/chat (GitHub, Gitter)
b. Relationships and flows:
1. Developer edits library source → runs “npm run build” → TypeScript → .js/.d.ts output → gulp bundles into exports
2. Developer runs “ng serve” on showcase → Angular CLI uses local exports folder as library → loads assets/data via HTTP from assets folder → renders components
3. E2E runner launches showcase on localhost → executes Protractor scripts against UI
4. CI pipeline on GitHub push → triggers Travis → runs unit tests (Karma/Jasmine), lint, e2e, then publish to NPM
c. Architectural patterns/design principles:
• Modular design: each UI widget is an independent Angular Module facilitating tree-shaking.
• Separation of concerns: common utilities and services in a “common” folder, demo data/services in a separate namespace.
• Consumer-provider pattern: library provides services, showcase injects them.
• Build-time code generation: Angular compiler (ngc) and bundling via Gulp.
d. Key technologies/frameworks:
• Angular CLI, Angular Compiler (@angular/compiler, @angular/core)
• TypeScript & tsconfig configurations (AOT, release builds)
• Gulp for custom bundling tasks
• Karma/Jasmine for unit tests, Protractor for e2e
• NPM for distribution, Travis CI for continuous integration
Final pointers
• Be very detailed and capture each essential element: individual component modules, common utilities, build scripts, test suites, demo services, and deployment targets.
• Versioning/configuration nodes (tsconfig, angular.json) to highlight how build options flow through the pipeline.