From 03778870ca1fd42e0a844c24d71e57c5ac056225 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Wed, 26 Jul 2023 09:25:44 -0400 Subject: [PATCH] refactor!(dev): remove deprecated cli args and flags --- .changeset/rich-months-search.md | 8 +++++++ packages/remix-dev/cli/commands.ts | 35 ++---------------------------- packages/remix-dev/cli/run.ts | 35 ------------------------------ 3 files changed, 10 insertions(+), 68 deletions(-) create mode 100644 .changeset/rich-months-search.md diff --git a/.changeset/rich-months-search.md b/.changeset/rich-months-search.md new file mode 100644 index 00000000000..332238910ed --- /dev/null +++ b/.changeset/rich-months-search.md @@ -0,0 +1,8 @@ +--- +"@remix-run/dev": major +--- + +remove deprecated cli args and flags + +- `--no-restart`/`restart` 👉 use `--manual`/`manual` instead +- `--scheme`/`scheme` and `--host`/`host` 👉 use `REMIX_DEV_ORIGIN` instead diff --git a/packages/remix-dev/cli/commands.ts b/packages/remix-dev/cli/commands.ts index bacb94477a0..28f7505a161 100644 --- a/packages/remix-dev/cli/commands.ts +++ b/packages/remix-dev/cli/commands.ts @@ -163,9 +163,6 @@ export async function dev( port?: number; tlsKey?: string; tlsCert?: string; - scheme?: string; // TODO: remove in v2 - host?: string; // TODO: remove in v2 - restart?: boolean; // TODO: remove in v2 } = {} ) { console.log(`\n 💿 remix dev\n`); @@ -390,10 +387,6 @@ let resolveDev = async ( port?: number; tlsKey?: string; tlsCert?: string; - /** @deprecated */ - scheme?: string; // TODO: remove in v2 - /** @deprecated */ - host?: string; // TODO: remove in v2 } = {} ) => { let dev = config.future.v2_dev; @@ -413,17 +406,8 @@ let resolveDev = async ( let REMIX_DEV_ORIGIN = process.env.REMIX_DEV_ORIGIN; if (REMIX_DEV_ORIGIN === undefined) { - // prettier-ignore - let scheme = - flags.scheme ?? // TODO: remove in v2 - (dev === true ? undefined : dev.scheme) ?? // TODO: remove in v2 - isTLS ? "https" : "http"; - // prettier-ignore - let hostname = - flags.host ?? // TODO: remove in v2 - (dev === true ? undefined : dev.host) ?? // TODO: remove in v2 - "localhost"; - REMIX_DEV_ORIGIN = `${scheme}://${hostname}:${port}`; + let scheme = isTLS ? "https" : "http"; + REMIX_DEV_ORIGIN = `${scheme}://localhost:${port}`; } return { @@ -442,9 +426,6 @@ let resolveDevServe = async ( port?: number; tlsKey?: string; tlsCert?: string; - scheme?: string; // TODO: remove in v2 - host?: string; // TODO: remove in v2 - restart?: boolean; // TODO: remove in v2 } = {} ) => { let dev = config.future.v2_dev; @@ -457,22 +438,10 @@ let resolveDevServe = async ( flags.command ?? (dev === true ? undefined : dev.command) - // TODO: remove in v2 - let restart = dev === true ? undefined : dev.restart; - if (restart !== undefined) { - logger.warn("The `v2_dev.restart` option is deprecated", { - details: [ - "Use `v2_dev.manual` instead.", - "-> https://remix.run/docs/en/main/guides/development-performance#manual-mode", - ], - }); - } - // prettier-ignore let manual = flags.manual ?? (dev === true ? undefined : dev.manual) ?? - restart !== undefined ? !restart : // TODO: remove in v2 false; return { diff --git a/packages/remix-dev/cli/run.ts b/packages/remix-dev/cli/run.ts index b74b003ef1d..ed0eb703133 100644 --- a/packages/remix-dev/cli/run.ts +++ b/packages/remix-dev/cli/run.ts @@ -3,7 +3,6 @@ import semver from "semver"; import * as colors from "../colors"; import * as commands from "./commands"; -import { logger } from "../tux"; const helpText = ` ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow( @@ -122,11 +121,6 @@ export async function run(argv: string[] = process.argv.slice(2)) { "-p": "--port", "--tls-key": String, "--tls-cert": String, - - // deprecated, remove in v2 - "--no-restart": Boolean, - "--scheme": String, - "--host": String, }, { argv, @@ -151,25 +145,6 @@ export async function run(argv: string[] = process.argv.slice(2)) { return; } - // TODO: remove in v2 - if (flags["scheme"]) { - logger.warn("`--scheme` flag is deprecated", { - details: [ - "Use `REMIX_DEV_ORIGIN` instead", - "-> https://remix.run/docs/en/main/other-api/dev-v2#how-to-integrate-with-a-reverse-proxy", - ], - }); - } - // TODO: remove in v2 - if (flags["host"]) { - logger.warn("`--host` flag is deprecated", { - details: [ - "Use `REMIX_DEV_ORIGIN` instead", - "-> https://remix.run/docs/en/main/other-api/dev-v2#how-to-integrate-with-a-reverse-proxy", - ], - }); - } - if (flags["tls-key"]) { flags.tlsKey = flags["tls-key"]; delete flags["tls-key"]; @@ -183,16 +158,6 @@ export async function run(argv: string[] = process.argv.slice(2)) { flags.delete = false; } flags.interactive = flags.interactive ?? require.main === module; - if (args["--no-restart"]) { - logger.warn("`--no-restart` flag is deprecated", { - details: [ - "Use `--manual` instead.", - "-> https://remix.run/docs/en/main/guides/development-performance#manual-mode", - ], - }); - flags.manual = true; - delete flags["no-restart"]; - } if (args["--no-typescript"]) { flags.typescript = false; }