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

feat(remix-dev): add deprecation warning about devServerBroadcastDelay & devServerPort #7064

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
5 changes: 5 additions & 0 deletions .changeset/moody-seals-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Show deprecation warning when using `devServerBroadcastDelay` and `devServerPort` config options
16 changes: 10 additions & 6 deletions docs/file-conventions/remix-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,23 @@ The path to the browser build, relative to remix.config.js. Defaults to
The path to a directory Remix can use for caching things in development,
relative to `remix.config.js`. Defaults to `".cache"`.

## devServerBroadcastDelay (deprecated)
## devServerBroadcastDelay

<docs-warning>This option is deprecated and will likely be removed in a future
stable release. Enable `v2_dev` to eliminate the race conditions that necessitated
this option.</docs-warning>

The delay, in milliseconds, before the dev server broadcasts a reload event.
There is no delay by default.

For `v2_dev`, the race conditions that necesitated this option have been eliminated.
## devServerPort

## devServerPort (deprecated)
<docs-warning>This option is deprecated and will likely be removed in a future
stable release. Enable `v2_dev` and use [`--port` / `v2_dev.port` option][port]
instead.</docs-warning>

The port number to use for the dev websocket server. Defaults to 8002.

For `v2_dev`, use [`--port` / `v2_dev.port` option][port].

## ignoredRouteFiles

This is an array of globs (via [minimatch][minimatch]) that Remix will match to
Expand Down Expand Up @@ -316,4 +320,4 @@ There are a few conventions that Remix uses you should be aware of.
[tailwind-functions-and-directives]: https://tailwindcss.com/docs/functions-and-directives
[jspm]: https://github.com/jspm/jspm-core
[esbuild-plugins-node-modules-polyfill]: https://www.npmjs.com/package/esbuild-plugins-node-modules-polyfill
[port]: ../other-api/dev-v2#option-1
[port]: ../other-api/dev-v2#options-1
38 changes: 38 additions & 0 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,17 @@ export interface AppConfig {

/**
* The port number to use for the dev server. Defaults to 8002.
*
* @deprecated Use {@link AppConfig.future.v2_dev.port} instead.
*/
devServerPort?: number;

/**
* The delay, in milliseconds, before the dev server broadcasts a reload
* event. There is no delay by default.
*
* @deprecated Enable {@link AppConfig.future.v2_dev} to eliminate the race
* conditions that necessitated this option.
*/
devServerBroadcastDelay?: number;

Expand Down Expand Up @@ -296,11 +301,16 @@ export interface RemixConfig {

/**
* The port number to use for the dev (asset) server.
*
* @deprecated Use {@link RemixConfig.future.v2_dev.port} instead.
*/
devServerPort: number;

/**
* The delay before the dev (asset) server broadcasts a reload event.
*
* @deprecated Enable {@link RemixConfig.future.v2_dev} to eliminate the race
* conditions that necessitated this option.
*/
devServerBroadcastDelay: number;

Expand Down Expand Up @@ -804,6 +814,13 @@ export async function readConfig(
assetsBuildDirectory
);

if (appConfig.devServerPort) {
devServerPortWarning();
}
if (appConfig.devServerBroadcastDelay) {
devServerBroadcastDelayWarning();
}

let devServerPort =
Number(process.env.REMIX_DEV_SERVER_WS_PORT) ||
(await getPort({ port: Number(appConfig.devServerPort) || 8002 }));
Expand Down Expand Up @@ -1036,6 +1053,27 @@ let browserBuildDirectoryWarning = () =>
}
);

let devServerBroadcastDelayWarning = () =>
logger.warn(
"The `devServerBroadcastDelay` config option will be removed in v2",
{
details: [
"Enable `v2_dev` to eliminate the race conditions that necessitated this option.",
"-> https://remix.run/docs/en/v1.19.3/pages/v2#devserverbroadcastdelay",
],
key: "devServerBroadcastDelayWarning",
}
);

let devServerPortWarning = () =>
logger.warn("The `devServerPort` config option will be removed in v2", {
details: [
"Enable `v2_dev` and use `--port` / `v2_dev.port` option instead.",
"-> https://remix.run/docs/en/v1.19.3/pages/v2#devserverport",
],
key: "devServerPortWarning",
});

let serverBuildDirectoryWarning = () =>
logger.warn(
"The `serverBuildDirectory` config option will be removed in v2",
Expand Down