Conversation
- Removed `express` dependency because it was adding a lot of different dependencies. - Added new dependencies: `@polka/send-type`, `body-parser`, `polka`, and `sirv` to improve server functionality. - Updated the `template-playground-server.ts` to utilize Polka for handling requests, replacing Express. - Enhanced error handling and response management in the server. - Introduced new utility classes for file and import management, improving code organization and maintainability. - Updated test configurations to reflect changes in the server setup and ensure compatibility with the new dependencies.
…ground - Added new configuration options to the CompoDocConfig interface, including options to disable lifecycle hooks, constructors, routes graph, search, dependencies, properties, DOM tree, template tab, style tab, overview, and file path. - Updated the template playground component to include checkboxes for the new configuration options, allowing users to customize their experience. - Modified the app.js and template-playground-server.ts files to accommodate the new configuration options, ensuring they are properly handled in the application logic. These enhancements provide users with greater control over the CompoDoc configuration, improving usability and customization.
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the server implementation from Express to Polka + sirv, achieving significant dependency reduction while maintaining full API compatibility. The migration also includes updates to test configurations and adds support for new CompoDoc configuration options.
Key Changes:
- Server Migration: Replace Express with Polka for routing and sirv for static file serving
- Test Configuration Updates: Update TypeScript test configuration and Mocha settings to support the new architecture
- Configuration Extensions: Add support for
disableFilePathanddisableOverviewoptions in CompoDoc configuration
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/template-playground/template-playground-server.ts | Main migration from Express to Polka+sirv with HTTP method compatibility |
| test/src/template-playground/*.spec.ts | Update test files to use getHttpServer() method for Supertest compatibility |
| package.json | Replace Express dependencies with Polka, sirv, and body-parser |
| tsconfig.test.json | Add wildcard test pattern and improve test file inclusion |
| test/.mocharc.json | Switch from TypeScript to compiled JavaScript execution |
| test/src/helpers.ts | Fix package.json path reference for test environment |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Changed the parameter type of the getClientIP method from Request to IncomingMessage for better compatibility with the underlying HTTP server. - Enhanced type assertion for accessing the remote address, ensuring more robust handling of socket properties. These changes improve the clarity and reliability of the IP address retrieval logic in the template playground server.
…nd server - Updated the middleware function signatures in the template-playground-server.ts file to specify the next parameter type as a function, improving type safety and clarity. - This change ensures better compatibility with TypeScript's type system, enhancing the overall robustness of the server's middleware handling.
- Modified the regex in the parseCodeFences method to allow for optional whitespace characters after the opening code fence, fixing the ReDOS vulnerabilty detected in SonarQube Cloud.
|
There is an issue with npm pretest script and angular expo bulk tests ;) |
On it! |
|
|
Thanks for the PR |


The Express to Polka + sirv migration has been completed successfully with the following key achievements:
🎯 Zero Breaking Changes: 100% functional equivalence maintained
📉 Dependency Reduction: 44 fewer packages in dependency tree
🚀 Performance Gains: Faster routing and static file serving
🛡️ Security Maintained: Zero vulnerabilities before and after
🧹 Cleaner Architecture: Simplified dependency graph
Core Application Changes
Compatibility Maintained
Files Modified
package.json- Updated dependenciessrc/template-playground/template-playground-server.ts- Core migrationWe cannot use
LiveServeras it was suggested because in the template playground we are not just serving an static website but providing a server with some API endpoints to perform different actions, like: