Skip to content

Commit

Permalink
fix(remix-dev): Allow debugging for the remix shorthand (#3391)
Browse files Browse the repository at this point in the history
* fix(remix-dev): Allow debugging for the remix shorthand

* Remove break for default statement

Co-authored-by: Michaël De Boey <info@michaeldeboey.be>

* refactor dev/default case shared code
and fix silly oversight

* Use TS shorthand

Co-authored-by: Pedro Cattori <pcattori@gmail.com>

Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Pedro Cattori <pcattori@gmail.com>
  • Loading branch information
3 people authored Jun 7, 2022
1 parent 7979551 commit bc1ee1d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/remix-dev/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ const npxInterop = {
pnpm: "pnpm exec",
};

async function dev(projectDir: string, flags: { debug?: boolean }) {
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
if (flags.debug) inspector.open();
await commands.dev(projectDir, process.env.NODE_ENV);
}

/**
* Programmatic interface for running the Remix CLI with the given command line
* arguments.
Expand Down Expand Up @@ -426,13 +432,10 @@ export async function run(argv: string[] = process.argv.slice(2)) {
break;
}
case "dev":
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
if (flags.debug) inspector.open();
await commands.dev(input[1], process.env.NODE_ENV);
await dev(input[1], flags);
break;
default:
// `remix ./my-project` is shorthand for `remix dev ./my-project`
if (!process.env.NODE_ENV) process.env.NODE_ENV = "development";
await commands.dev(input[0], process.env.NODE_ENV);
await dev(input[0], flags);
}
}

0 comments on commit bc1ee1d

Please sign in to comment.