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

Add --debug flag to the CLI dev command #869

Merged
merged 2 commits into from
May 15, 2023
Merged

Conversation

frandiox
Copy link
Contributor

WHY are these changes introduced?

Related: #866 (comment)

To support the --debug flag that the Remix CLI already has.

WHAT is this pull request doing?

Opens a Node inspector when the --debug flag is provided, similar to what Remix CLI does.

image

HOW to test your changes?

  1. Run h2 dev --debug in a template directory.
  2. Open chrome://inspect and choose the only target that should appear.
  3. Optionally add debugger; lines to server.ts or other parts of the code.
  4. Open localhost:3000 in the browser and play with it.

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@frandiox frandiox requested a review from frehner May 11, 2023 04:15
'@shopify/cli-hydrogen': patch
---

New `--debug` flag for the `dev` command that attaches a Node inspector to the development server.
Copy link
Contributor

@frehner frehner May 11, 2023

Choose a reason for hiding this comment

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

I don't mind doing it this way, but I feel like it would be a better long-term solution if we could just pass any extra flags we get to the remix cli, and that way we're not reimplementing flags that already exist in remix.

Thoughts? @blittle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not using the Remix CLI directly, but its internals.
Unfortunately, the usage of --debug in Remix CLI is in a very early point in their code that we can't reuse, that's why I'm just replicating that functionality here.
I agree that ideally we'd just reuse their whole CLI, but there are some limitations in that area (integration with MiniOxygen, custom logs, etc).

Copy link
Contributor

Choose a reason for hiding this comment

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

We are not using the Remix CLI directly, but its internals.

Ah, that's unfortunate. Thanks for the context.

@frandiox frandiox merged commit 33f33ed into 2023-04 May 15, 2023
@frandiox frandiox deleted the fd-node-inspector branch May 15, 2023 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants