Skip to content

Commit

Permalink
feat(remix-dev): add deprecation warning about `devServerBroadcastDel…
Browse files Browse the repository at this point in the history
…ay` & `devServerPort`
  • Loading branch information
MichaelDeBoey committed Aug 4, 2023
1 parent ac34018 commit 3bd85b3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
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: [
"You should enable `v2_dev` instead.",
"-> 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: [
"You should enable `v2_dev` and use the `v2_dev.port` config 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

0 comments on commit 3bd85b3

Please sign in to comment.