-
Notifications
You must be signed in to change notification settings - Fork 400
fix: fix incorrect dev config types and netlify dev
regression
#7135
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type { PollingStrategy, NetlifyTOML } from '@netlify/build-info' | ||
import type { NetlifyTOML } from '@netlify/build-info' | ||
|
||
import type { FrameworkNames } from '../../utils/types' | ||
|
||
|
@@ -8,23 +8,14 @@ export type BuildConfig = NonNullable<NetlifyTOML['build']> | |
export type DevConfig = NonNullable<NetlifyTOML['dev']> & { | ||
framework: FrameworkNames | ||
/** Directory of the functions */ | ||
functions?: string | ||
publish?: string | ||
/** Port to serve the functions */ | ||
port: number | ||
live: boolean | ||
functions?: string | undefined | ||
live?: boolean | undefined | ||
/** The base directory from the [build] section of the configuration file */ | ||
base?: string | ||
staticServerPort?: number | ||
functionsPort?: number | ||
autoLaunch?: boolean | ||
https?: { | ||
keyFile: string | ||
certFile: string | ||
} | ||
envFiles?: string[] | ||
base?: string | undefined | ||
staticServerPort?: number | undefined | ||
envFiles?: string[] | undefined | ||
|
||
jwtSecret: string | ||
jwtRolePath: string | ||
pollingStrategies?: PollingStrategy[] | ||
jwtSecret?: string | undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is normalized to a string before it gets here: https://github.com/netlify/build/blob/1b9f2f40de7ded6285e9b7c08a1adb43550a0ccf/packages/build-info/src/settings/get-build-settings.ts#L102 |
||
jwtRolePath?: string | undefined | ||
pollingStrategies?: string[] | undefined | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,7 +193,7 @@ const handleCustomFramework = ({ | |
frameworkPort: devConfig.targetPort, | ||
dist: devConfig.publish || getDefaultDist(workingDir), | ||
framework: '#custom', | ||
pollingStrategies: devConfig.pollingStrategies?.map((s) => s.name) ?? [], | ||
pollingStrategies: devConfig.pollingStrategies ?? [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the regression/fix |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Buffer } from 'buffer' | ||
import { IncomingMessage } from 'http' | ||
import type { Buffer } from 'buffer' | ||
import type { IncomingMessage } from 'http' | ||
|
||
import { Match } from 'netlify-redirector' | ||
import type { PollingStrategy, Settings } from '@netlify/build-info' | ||
import type { Match } from 'netlify-redirector' | ||
|
||
export type FrameworkNames = '#static' | '#auto' | '#custom' | string | ||
|
||
|
@@ -12,7 +13,7 @@ export type FrameworkInfo = { | |
dev: { | ||
commands: string[] | ||
port: number | ||
pollingStrategies: { name: string }[] | ||
pollingStrategies: PollingStrategy[] | ||
} | ||
Comment on lines
-15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one was correct. I made it reference the canonical type while I was here. |
||
name: FrameworkNames | ||
staticAssetsDirectory: string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see here we're extending this type, but we were duplicating most of it here. Most of this diff is cleaning up this unnecessary duplication + adding
undefined
to optional properties.