Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swagger UI dist #2676

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Fix swagger UI dist #2676

merged 2 commits into from
Apr 25, 2024

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Apr 24, 2024

Information

Type Breaking change
Feature/Fix No

Todos

  • Tests
  • Coverage
  • Example
  • Documentation

Summary by CodeRabbit

  • New Features

    • Added support for OpenSpec version "3.1.0" to the app.
    • Enhanced Swagger module with new constants for better path management and static file serving.
  • Enhancements

    • Updated Swagger UI dependency to version >=5.17.1.
    • Improved build process in Swagger package to include additional scripts and views.
  • Documentation

    • Added new constants documentation in Swagger module for clarity and ease of use.
  • Refactor

    • Cleaned up imports and updated constants in SwaggerModule for optimized performance and maintainability.

Copy link

coderabbitai bot commented Apr 24, 2024

Walkthrough

The recent updates encompass the swagger package, enhancing build scripts, updating dependencies, and refining the module's structure with new constants for improved path management. In parallel, the openspec package introduces version "3.1.0" to its versioning schema, reflecting ongoing development and standards evolution.

Changes

Files Change Summary
.../openspec/src/common/OpenSpecVersions.ts Added version "3.1.0" to OS3Versions type.
.../swagger/package.json Updated build script, swagger-ui-dist dependency, added ts-node, typescript as dev dependencies.
.../swagger/scripts/constants.js,
.../swagger/src/constants.ts
Introduced constants for Swagger UI distribution path and root directory.
.../swagger/src/SwaggerModule.ts,
.../swagger/src/index.ts
Updated import order, constants usage, paths; added export of new constants.

🐰✨
In the land of code, where the bits align,
A rabbit hopped through, leaving changes so fine.
"Version three-dot-one," it cheerily spake,
With paths now clear, and no mistake.
Hop, hop, hooray, for the code does shine! 🌟
🐰✨


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8381d27 and 4c46d75.
Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/*.lock
Files selected for processing (6)
  • packages/specs/openspec/src/common/OpenSpecVersions.ts (1 hunks)
  • packages/specs/swagger/package.json (3 hunks)
  • packages/specs/swagger/scripts/constants.js (1 hunks)
  • packages/specs/swagger/src/SwaggerModule.ts (3 hunks)
  • packages/specs/swagger/src/constants.ts (1 hunks)
  • packages/specs/swagger/src/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (6)
  • packages/specs/openspec/src/common/OpenSpecVersions.ts
  • packages/specs/swagger/package.json
  • packages/specs/swagger/scripts/constants.js
  • packages/specs/swagger/src/SwaggerModule.ts
  • packages/specs/swagger/src/constants.ts
  • packages/specs/swagger/src/index.ts

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Comment on lines 5 to 6
// @ts-expect-error
export const ROOT_DIR = import.meta.dirname;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect usage of import.meta.dirname for ROOT_DIR.

- export const ROOT_DIR = import.meta.dirname;
+ export const ROOT_DIR = dirname(fileURLToPath(import.meta.url));

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// @ts-expect-error
export const ROOT_DIR = import.meta.dirname;
// @ts-expect-error
export const ROOT_DIR = dirname(fileURLToPath(import.meta.url));

@Romakita Romakita force-pushed the fix-swagger-ui-dist branch from 38de70d to 4c46d75 Compare April 24, 2024 19:12
@tsedio tsedio deleted a comment from github-actions bot Apr 24, 2024
Copy link

Benchmarks

  • Machine: linux x64 | 4 vCPUs | 15.6GB Mem
  • Node: v18.20.2
  • Run: Wed Apr 24 2024 19:25:13 GMT+0000 (Coordinated Universal Time)
  • Method: autocannon -c 100 -d 10 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)
Version Router Requests/s Latency Throughput/Mb
koa 2.13.4 34099.6 28.78 6.08
tsed-koa 7.67.8 12140.7 81.61 10.28
express 4.19.2 10185.8 97.32 1.82
express-injector 4.19.2 9902.4 100.06 2.26
nest 8.4.3 9696.2 102.04 2.33
tsed-express 7.67.8 8323.5 118.89 1.52
express-morgan 4.19.2 5590.0 177.07 1.00
fastify-big-json 3.29.4 N/A N/A N/A
fastify-injector 3.29.4 N/A N/A N/A
fastify 3.29.4 N/A N/A N/A
nest-fastify 8.4.3 N/A N/A N/A

Explanation

The benchmark shows a performance difference between the frameworks. We note that Ts.ED is often last. In fact, Ts.ED uses features useful to a production application which reduce its performance.

For example, Ts.ED initializes a sandbox (async_hook) for each request in order to work in an isolated context if necessary.
It also initializes the elements necessary for monitoring requests in a log manager.

All this at a necessary cost that reflects the reality of a production application ;)

@Romakita Romakita merged commit 1a57e03 into production Apr 25, 2024
15 checks passed
@Romakita Romakita deleted the fix-swagger-ui-dist branch April 25, 2024 06:24
@Romakita
Copy link
Collaborator Author

🎉 This PR is included in version 7.68.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant