Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit bc8197c

Browse files
committed
fix: streamline index.ts by removing chalk and enhancing konsola usage
- Removed the `chalk` dependency to simplify the code and improve performance. - Updated the logging mechanism to utilize `konsola` for consistent message formatting. - Added version output option to the program for better user feedback. - Cleaned up the command error handling to enhance readability and maintainability.
1 parent c3faa77 commit bc8197c

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/index.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env node
2-
import chalk from 'chalk';
32
import dotenv from 'dotenv';
43

5-
import { formatHeader, handleError, konsola } from './utils';
4+
import { handleError, konsola } from './utils';
65
import { getProgram } from './program';
76
import './commands/login';
87
import './commands/logout';
@@ -11,25 +10,24 @@ import './commands/components';
1110
import './commands/languages';
1211
import './commands/migrations';
1312
import './commands/types';
13+
import pkg from '../package.json';
1414

1515
import { colorPalette } from './constants';
1616

1717
export * from './types/storyblok';
1818

1919
dotenv.config(); // This will load variables from .env into process.env
2020
const program = getProgram();
21-
console.clear();
22-
const introText = chalk.bgHex(colorPalette.PRIMARY).bold(` Storyblok CLI `);
23-
const messageText = ` `;
24-
console.log(formatHeader(`
25-
${introText} ${messageText}`));
2621

27-
program.option('-v, --verbose', 'Enable verbose output');
22+
konsola.title(` Storyblok CLI `, colorPalette.PRIMARY);
23+
24+
program.option('--verbose', 'Enable verbose output');
25+
program.version(pkg.version, '-v, --vers', 'output the current version');
2826

2927
program.on('command:*', () => {
3028
console.error(`Invalid command: ${program.args.join(' ')}`);
29+
konsola.br();
3130
program.help();
32-
konsola.br(); // Add a line break
3331
});
3432

3533
/* console.log(`

0 commit comments

Comments
 (0)