feat(cli): improve changelog log message

This commit is contained in:
陈嘉涵 2020-01-14 19:12:17 +08:00
parent 26f2884fbb
commit 1706c375fa
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import { join } from 'path';
import { ROOT } from '../common/constant';
import { logger } from '../common/logger';
import { logger, simplifyPath } from '../common/logger';
import { createWriteStream, readFileSync } from 'fs-extra';
// @ts-ignore
import conventionalChangelog from 'conventional-changelog';
@ -66,7 +66,7 @@ export async function changelog() {
)
.pipe(createWriteStream(DIST_FILE))
.on('close', () => {
logger.success(`Generated changelog at ${DIST_FILE}`);
logger.success(`Changelog generated successfully at ${simplifyPath(DIST_FILE)}`);
resolve();
});
});

View File

@ -1,4 +1,6 @@
import chalk from 'chalk';
import logger from 'signale';
import { ROOT } from '../common/constant';
logger.config({
displayTimestamp: true
@ -33,4 +35,8 @@ export function getInteractiveLogger() {
return interactive;
}
export function simplifyPath(path: string) {
return chalk.yellow(path.replace(ROOT, '.'));
}
export { logger };