-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(nx-plugin): refactor plugin options normalization to common method with defaultOptions (normalizeOptions) #31658
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
function normalizeOptions( | ||
options: StorybookPluginOptions | ||
): Required<StorybookPluginOptions> { | ||
return { |
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.
all other options pretty much had this pattern
options ??= {};
but here no empy object is filled with the defaults
buildTargetName: 'build', | ||
devTargetName: 'dev', | ||
startTargetName: 'start', | ||
}; |
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.
ommited the deprecated value here since the startTargetName is also in the defaults
serveStaticTargetName?: string;
serveStaticTargetName?: string; | ||
buildStaticTargetName?: string; | ||
buildDepsTargetName?: string; | ||
watchDepsTargetName?: 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.
buildDepsTargetName
watchDepsTargetName
are missing from the defaults, see also webpack options behavior
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.
they got added in this commit but only webpack got an update to the defaultOptions:
0ae8665#diff-8ea87d5fdfbfcec0fc69136da5a959e64f7e2747a01611c16227183d06b24eabR33-R331
7443b6a
to
ccb0e04
Compare
ccb0e04
to
8c3c9ca
Compare
const defaultOptions: VitePluginOptions = { | ||
buildTargetName: 'build', | ||
testTargetName: 'test', | ||
devTargetName: 'dev', | ||
previewTargetName: 'preview', | ||
serveStaticTargetName: 'serve-static', | ||
typecheckTargetName: 'typecheck', | ||
}; |
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.
The serveTargetName
option is defined in the old normalizeOptions
function but is missing from the new defaultOptions
object. Please add serveTargetName: 'serve'
to maintain backward compatibility with existing configurations.
const defaultOptions: VitePluginOptions = { | |
buildTargetName: 'build', | |
testTargetName: 'test', | |
devTargetName: 'dev', | |
previewTargetName: 'preview', | |
serveStaticTargetName: 'serve-static', | |
typecheckTargetName: 'typecheck', | |
}; | |
const defaultOptions: VitePluginOptions = { | |
buildTargetName: 'build', | |
testTargetName: 'test', | |
devTargetName: 'dev', | |
previewTargetName: 'preview', | |
serveStaticTargetName: 'serve-static', | |
serveTargetName: 'serve', | |
typecheckTargetName: 'typecheck', | |
}; | |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
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.
/**
- @deprecated Use devTargetName instead. This option will be removed in Nx 22.
*/
intentionally removed so the deprecated option stays unset.
8c3c9ca
to
d1b629a
Compare
…od with defaultOptions (normalizeOptions)
d1b629a
to
6876b50
Compare
This is a refactor for plugin option handling. Further plugin-specific improvements.
found some likely inconsistencies in the process.
Current Behavior
in nx.json
ommiting options
causes failure in processin project graph
this works:
Expected Behavior
should just run with all default Options
Related Issue(s)
could not find any open issues in that context
Fixes #