-
Notifications
You must be signed in to change notification settings - Fork 28
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
chore(cli): add --clean option to build command #87
Conversation
8737379
to
189356b
Compare
packages/core/src/cli/commands.ts
Outdated
.description('build the library for production') | ||
.action(async (options: BuildOptions) => { | ||
try { | ||
const rslibConfig = await loadConfig(options.config, options.envMode); | ||
|
||
if (options.clean) { | ||
const distDir = rslibConfig.output?.distPath?.root ?? OUTPUT_DIST_DIR; |
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.
It's raw Rslib config, we should get distDir
from final Rsbuild environment config.
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.
Rsbuild already support clean output.cleanDistPath, may be you should implemeny clean feature in plugin-dts, to add an option of clean, and in default rslib core logic, when we use builtin plugin-dts, pass clean: true
to it.
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 issue was written early and may have some problems now.
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.
Would it be confusing to include the clean
option in plugin-dts
?
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.
Because clean
is a global build option, not plugin-dts
.
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.
Js output will be cleaned according to Rsbuild output.cleanDistPath
by default, the DTS output should align with this behaviour. Maybe we don't need a cli option to do that, just in built-in logic.
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.
Maybe we don't need a cli option to do that, just in built-in logic.
Agree
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.
However, Rsbuild
seems to default to clear dist
. What is the significance of doing so? Does plugin-dts
not support default clear?
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 dist
maybe dirty in local development, clean behavihour can ensure the new output will not be influenced by existed output.
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.
plugin-dts
have not supported it yet.
We should clean:
- bundleless mode: the tsc emit path
- bundle mode: the tsc emit temp path
.rslib/declarations
and api-extractor emit path
189356b
to
4e20196
Compare
I tried to rewrite, but it seems that an empty commit caused PR to close. |
Feel free to re-create one and link to this PR. |
Related Links
Related to #46
Checklist