Skip to content
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

feat(app-tools): enable Rsbuild CLI shortcuts #6610

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/afraid-socks-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/app-tools': patch
'@modern-js/uni-builder': patch
'@modern-js/utils': patch
---

feat(app-tools): enable Rsbuild CLI shortcuts
4 changes: 2 additions & 2 deletions packages/cli/uni-builder/src/shared/parseCommonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ export async function parseCommonConfig(
};
}

const { dev: RsbuildDev, server } = transformToRsbuildServerOptions(
const { dev: rsbuildDev, server } = transformToRsbuildServerOptions(
dev || {},
devServer || {},
);

rsbuildConfig.server = removeUndefinedKey(server);

rsbuildConfig.dev = removeUndefinedKey(RsbuildDev);
rsbuildConfig.dev = removeUndefinedKey(rsbuildDev);
rsbuildConfig.html = html;
rsbuildConfig.output = output;

Expand Down
6 changes: 6 additions & 0 deletions packages/solutions/app-tools/src/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export function createDefaultConfig(
// `dev.port` should not have a default value
// because we will use `server.port` by default
port: undefined,
cliShortcuts: {
help: false,
// does not support restart server and print urls yet
custom: (shortcuts = []) =>
shortcuts.filter(({ key }) => key !== 'r' && key !== 'u'),
},
};

const output: AppUserConfig['output'] = {
Expand Down
6 changes: 6 additions & 0 deletions packages/toolkit/utils/src/cli/prettyInstructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,11 @@ export const prettyInstructions = (appContext: any, config: any) => {
);
}

if (config.dev?.cliShortcuts) {
message += ` ${chalk.dim('> press')} ${chalk.bold(
'h + enter',
)} ${chalk.dim('to show shortcuts')}\n`;
}

return message;
};
Loading