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

refactor!(dev): remove deprecated cli args and flags #6962

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/rich-months-search.md
Original file line number Diff line number Diff line change
@@ -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
35 changes: 2 additions & 33 deletions packages/remix-dev/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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 {
Expand Down
35 changes: 0 additions & 35 deletions packages/remix-dev/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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"];
Expand All @@ -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;
}
Expand Down