Skip to content

Commit

Permalink
fix(output): edit log output and colours
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Jun 25, 2022
1 parent 7e61f5c commit 3623c41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/bin-list-mismatches/list-mismatches.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('listMismatches', () => {
);
expect(scenario.log.mock.calls).toEqual(
[
[`- c 0.0.1 is developed in this repo at ${normalize(c)}`],
[`- c: 0.0.1 is developed in this repo at ${normalize(c)}`],
[` 0.1.0 in dependencies of ${normalize(a)}`],
[` 0.2.0 in devDependencies of ${normalize(b)}`],
[` 0.0.1 in version of ${normalize(c)}`],
Expand All @@ -46,7 +46,7 @@ describe('listMismatches', () => {
);
expect(scenario.log.mock.calls).toEqual(
[
[`- c 0.0.1 is developed in this repo at ${normalize(bc)}`],
[`- c: 0.0.1 is developed in this repo at ${normalize(bc)}`],
[` 0.1.0 in dependencies of ${normalize(aa)}`],
[` 0.2.0 in devDependencies of ${normalize(bb)}`],
[` 0.0.1 in version of ${normalize(bc)}`],
Expand All @@ -65,7 +65,7 @@ describe('listMismatches', () => {
const d = 'packages/d/package.json';
listMismatches(getInput(scenario.disk, scenario.config), scenario.disk);
expect(scenario.log.mock.calls).toEqual([
['- foo 0.3.0 is the highest valid semver version in use'],
['- foo: 0.3.0 is the highest valid semver version in use'],
[` link:vendor/foo-0.1.0 in dependencies of ${normalize(a)}`],
[` link:vendor/foo-0.2.0 in dependencies of ${normalize(b)}`],
[` 0.3.0 in dependencies of ${normalize(c)}`],
Expand Down
18 changes: 6 additions & 12 deletions src/bin-list-mismatches/list-mismatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ export function listMismatches(input: ProgramInput, disk: Disk): void {
);
} else if (workspaceMatch) {
const shortPath = relative(CWD, workspaceMatch.wrapper.filePath);
console.log(
chalk`{dim -} ${name} {green.dim ${expected} is developed in this repo at ${shortPath}}`,
);
const reason = chalk`{dim : ${expected} is developed in this repo at ${shortPath}}`;
console.log(chalk`{dim -} ${name}${reason}`);
} else {
console.log(
chalk`{dim -} ${name} {green.dim ${expected} is the highest valid semver version in use}`,
);
const reason = chalk`{dim : ${expected} is the highest valid semver version in use}`;
console.log(chalk`{dim -} ${name}${reason}`);
}

instances.forEach(({ dependencyType, version, wrapper }) => {
Expand All @@ -62,13 +60,9 @@ export function listMismatches(input: ProgramInput, disk: Disk): void {
const shortPath = relative(CWD, wrapper.filePath);
const loc = isLocal ? 'version' : dependencyType;
if (isMatch) {
console.log(
chalk`{green ${version} {dim in ${loc} of ${shortPath}}}`,
);
console.log(chalk`{green ${version} in ${loc} of ${shortPath}}`);
} else {
console.log(
chalk`{red ${version} {dim in ${loc} of ${shortPath}}}`,
);
console.log(chalk`{red ${version} in ${loc} of ${shortPath}}`);
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/bin-list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function list(input: ProgramInput, disk: Disk): void {
.map((version) =>
version === expected
? chalk.green(version)
: chalk.dim.red(version),
: chalk.red(version),
)
.join(chalk.dim(', '))}`
: chalk`{dim -} {white ${name}} {dim ${versionList}}`,
Expand Down

0 comments on commit 3623c41

Please sign in to comment.