Skip to content

Commit 08870f6

Browse files
committed
feat: improve CLI messaging and user experience
- Add centralized messaging utilities with consistent symbols and formatting - Show file tree summary after component generation with status icons - Improve dry-run output to clearly show what would be created vs skipped - Add helpful error messages with actionable suggestions - Update config setup flow with cleaner headers and success messages - Fix Node version check to require Node 22+
1 parent a55fea1 commit 08870f6

8 files changed

Lines changed: 702 additions & 1019 deletions

File tree

bin/generate-react.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
#!/usr/bin/env node
22
import cli from '../src/cli.js';
3+
import { error } from '../src/utils/messagesUtils.js';
34

4-
const isNotValidNodeVersion = () => {
5+
function isNotValidNodeVersion() {
56
const currentNodeVersion = process.versions.node;
67
const semver = currentNodeVersion.split('.');
78
const major = semver[0];
89

9-
if (major < 18) {
10-
console.error(
11-
// eslint-disable-next-line
12-
'You are running Node ' +
13-
currentNodeVersion +
14-
' Generate React CLI requires Node 18 or higher. Please update your version of Node.'
15-
);
10+
if (major < 22) {
11+
error(`Node ${currentNodeVersion} is not supported`, {
12+
details: 'Generate React CLI requires Node 22 or higher',
13+
suggestions: [
14+
'Update your Node.js version to 22 or higher',
15+
'Use nvm to manage multiple Node versions: nvm install 22',
16+
],
17+
});
1618

1719
return true;
1820
}
1921

2022
return false;
21-
};
23+
}
2224

2325
// --- Check if user is running Node 12 or higher.
2426

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ export default antfu({
2424
rules: {
2525
'no-console': 'off', // CLI tool - console output is expected
2626
'node/prefer-global/process': 'off', // process is always available in Node.js
27+
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
2728
},
2829
});

0 commit comments

Comments
 (0)