perf(cli): replace ora with nanospinner (#10779)

This commit is contained in:
neverland
2022-07-02 23:05:11 +08:00
committed by GitHub
parent 2e27c67c76
commit 5883d3e0c7
6 changed files with 24 additions and 16 deletions
+5 -3
View File
@@ -1,7 +1,7 @@
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { ROOT } from '../common/constant.js';
import { ora, slimPath } from '../common/logger.js';
import { createSpinner, slimPath } from '../common/logger.js';
import { createWriteStream, readFileSync } from 'fs';
import conventionalChangelog from 'conventional-changelog';
@@ -48,7 +48,7 @@ function transform(item: any) {
}
export async function changelog(): Promise<void> {
const spinner = ora('Generating changelog...').start();
const spinner = createSpinner('Generating changelog...').start();
return new Promise((resolve) => {
conventionalChangelog(
@@ -68,7 +68,9 @@ export async function changelog(): Promise<void> {
)
.pipe(createWriteStream(DIST_FILE))
.on('close', () => {
spinner.succeed(`Changelog generated at ${slimPath(DIST_FILE)}`);
spinner.success({
text: `Changelog generated at ${slimPath(DIST_FILE)}`,
});
resolve();
});
});