Skip to content

Commit 18f5798

Browse files
authored
chore: remove dev.port & source.disableEntryDirs (#7798)
1 parent 8995ac5 commit 18f5798

File tree

11 files changed

+8
-114
lines changed

11 files changed

+8
-114
lines changed

packages/cli/builder/src/shared/devServer.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ export const transformToRsbuildServerOptions = (
2424
rsbuildDev: DevConfig;
2525
rsbuildServer: ServerConfig;
2626
} => {
27-
const {
28-
port = 8080,
29-
host,
30-
https,
31-
startUrl,
32-
beforeStartUrl,
33-
...devConfig
34-
} = dev;
27+
const { host, https, startUrl, beforeStartUrl, ...devConfig } = dev;
3528

29+
const port = process.env.PORT ? Number(process.env.PORT) : 8080;
3630
const rsbuildDev: DevConfig = merge(defaultDevConfig, devConfig);
3731
// setupMiddlewares apply by @modern-js/server
3832
delete rsbuildDev.setupMiddlewares;
@@ -53,8 +47,8 @@ export const transformToRsbuildServerOptions = (
5347
headers: serverCofig.headers,
5448
historyApiFallback: serverCofig.historyApiFallback,
5549
proxy: serverCofig.proxy,
56-
port,
5750
host,
51+
port,
5852
https: https ? (https as ServerConfig['https']) : undefined,
5953
middlewareMode: true,
6054
};

packages/cli/builder/src/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ export type BuilderExtraConfig = {
144144
* After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server.
145145
*/
146146
https?: DevServerHttpsOptions;
147-
/**
148-
* Specify a port number for Dev Server to listen.
149-
*/
150-
port?: number;
151147
};
152148
source?: {
153149
transformImport?: SourceConfig['transformImport'] | false;

packages/cli/builder/tests/__snapshots__/parseConfig.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports[`parseCommonConfig > dev.xxx 1`] = `
4848
"key": "xxxx",
4949
},
5050
"middlewareMode": true,
51-
"port": 8081,
51+
"port": 8080,
5252
"printUrls": false,
5353
"publicDir": false,
5454
},

packages/cli/builder/tests/parseConfig.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ describe('parseCommonConfig', () => {
7878
key: 'xxxx',
7979
cert: 'xxx',
8080
},
81-
port: 8081,
8281
host: 'xxx.xxx',
8382
client: {
8483
path: '/aaaa',
@@ -107,7 +106,6 @@ describe('parseCommonConfig', () => {
107106
key: 'xxxx',
108107
cert: 'xxx',
109108
},
110-
port: 8081,
111109
host: 'xxx.xxx',
112110
},
113111
tools: {

packages/document/main-doc/docs/en/configure/app/source/disable-entry-dirs.mdx

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/document/main-doc/docs/zh/configure/app/source/disable-entry-dirs.mdx

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/solutions/app-tools/src/config/default.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ export function createDefaultConfig(
88
appContext: AppToolsContext,
99
): AppUserConfig {
1010
const dev: AppUserConfig['dev'] = {
11-
// `dev.port` should not have a default value
12-
// because we will use `server.port` by default
13-
port: undefined,
1411
cliShortcuts: {
1512
help: false,
1613
// does not support restart server and print urls yet

packages/solutions/app-tools/src/plugins/analyze/getFileSystemEntry.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,9 @@ export const getFileSystemEntry = async (
9797
const { appDirectory } = appContext;
9898

9999
const {
100-
source: { entriesDir, disableEntryDirs },
100+
source: { entriesDir },
101101
} = config;
102102

103-
let disabledDirs: string[] = [];
104-
if (disableEntryDirs && Array.isArray(disableEntryDirs)) {
105-
disabledDirs = disableEntryDirs?.map(dir =>
106-
ensureAbsolutePath(appDirectory, dir),
107-
);
108-
}
109103
const src = ensureAbsolutePath(appDirectory, entriesDir || '');
110104

111105
if (fs.existsSync(src)) {
@@ -119,8 +113,7 @@ export const getFileSystemEntry = async (
119113
const file = path.join(src, filename);
120114
if (
121115
fs.statSync(file).isDirectory() &&
122-
(await isBundleEntry(hooks, file)) &&
123-
!disabledDirs.includes(file)
116+
(await isBundleEntry(hooks, file))
124117
) {
125118
dirs.push(file);
126119
}

packages/solutions/app-tools/src/plugins/initialize/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function getServerPort(config: AppToolsNormalizedConfig) {
9191
const prodPort = Number(process.env.PORT) || config.server.port || 8080;
9292

9393
if (isDev() && isDevCommand()) {
94-
return getPort(Number(process.env.PORT) || config.dev.port || prodPort);
94+
return getPort(Number(process.env.PORT) || prodPort);
9595
}
9696

9797
return prodPort;

packages/solutions/app-tools/src/types/config/source.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ export interface SourceUserConfig extends NonNullable<BuilderConfig['source']> {
4545
* You can customize the directory used for identifying page entries with this option.
4646
*/
4747
entriesDir?: string;
48-
/**
49-
* By default, framework identifies the application entry point based on the `src` directory.
50-
* You can use this option to prevent some directories from being recognized as application entry points.
51-
*/
52-
disableEntryDirs?: string[];
5348
/**
5449
* Customize the directory of the framework configuration files.
5550
*/

0 commit comments

Comments
 (0)