Skip to content

add support for Bun and Deno#33

Merged
joshunrau merged 8 commits intomainfrom
dev
Apr 2, 2025
Merged

add support for Bun and Deno#33
joshunrau merged 8 commits intomainfrom
dev

Conversation

@joshunrau
Copy link
Collaborator

@joshunrau joshunrau commented Apr 2, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a configuration file for the Deno runtime that enables experimental decorators.
    • Added a new command-line option to select the JavaScript runtime (node, bun, or deno), enhancing execution flexibility.
  • Refactor

    • Updated runtime scripts to conditionally assign execution flags and module initialization based on the chosen runtime, ensuring smoother operation across environments.

@joshunrau joshunrau merged commit 3ba405f into main Apr 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented Apr 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This set of changes introduces a new deno.json configuration file that enables experimental decorators in the Deno runtime. Additionally, the CLI build and development scripts have been updated to select the appropriate runtime (bun, node, or deno) based on the LIBNEST_JAVASCRIPT_RUNTIME environment variable. This update includes setting runtime-specific flags, conditionally registering the @swc-node/register/esm module for Node.js, and adding a new command-line option (-r, --runtime) for runtime specification in the CLI.

Changes

File(s) Change Summary
deno.json New configuration file added with "experimentalDecorators": true to enable decorators in Deno.
src/cli/bin/libnest-build
src/cli/bin/libnest-dev
Updated scripts to determine runtime arguments via the LIBNEST_JAVASCRIPT_RUNTIME variable. For node, specific flags like --enable-source-maps are set; for deno and bun, appropriate flags are applied. An error is raised for invalid values.
src/cli/libnest-build.js
src/cli/libnest-dev.js
Modified control flow to conditionally register the @swc-node/register/esm module only when the runtime is set to 'node', ensuring selective module loading.
src/cli/libnest.js Added a new CLI option (-r, --runtime) with choices ['bun', 'deno', 'node'] (defaulting to node). Also adjusted module registration logic based on the context and sets the environment variable accordingly.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as "CLI (libnest.js)"
    participant Script as "Build/Dev Script"
    participant Runtime as "JS Runtime (node/bun/deno)"
    
    User->>CLI: Run command with runtime option
    CLI->>CLI: Parse CLI options and set LIBNEST_JAVASCRIPT_RUNTIME
    CLI->>Script: Invoke build/dev script with environment variable
    Script->>Script: Check LIBNEST_JAVASCRIPT_RUNTIME and set RUNTIME_ARGS
    alt Runtime is node
        Script->>Script: Conditionally register @swc-node/register/esm
    end
    Script->>Runtime: Execute script via eval with constructed flags
Loading

Suggested labels

released

Poem

Hop, skip, and jump through code,
A new config has hit the road!
Options for runtime now on the run,
Node, bun, or Deno – oh what fun!
I twirl and nibble in glee,
As changes hop into our tree.
🐇✨ Happy coding from me!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e58e951 and aa38943.

📒 Files selected for processing (6)
  • deno.json (1 hunks)
  • src/cli/bin/libnest-build (1 hunks)
  • src/cli/bin/libnest-dev (1 hunks)
  • src/cli/libnest-build.js (1 hunks)
  • src/cli/libnest-dev.js (1 hunks)
  • src/cli/libnest.js (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@github-actions
Copy link

github-actions bot commented Apr 2, 2025

🎉 This PR is included in version 4.3.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