Skip to content

Commit

Permalink
Reworked the CLI output when adding a changeset (#698)
Browse files Browse the repository at this point in the history
* Make cli log message clear, reduce noise "boxen" style, unify visual style of text font, discussion in #560

* Tweak changeset

* Fix linting problems

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
  • Loading branch information
zthxxx and Andarist committed Dec 21, 2021
1 parent 6f9c9d6 commit 9e14a9a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 79 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-glasses-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@changesets/cli": minor
---

Reworked the CLI output when adding a changeset. This includes fixing broken formatting in certain terminal width, reducing visual noise and making other small adjustments.
1 change: 0 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@manypkg/get-packages": "^1.1.3",
"@types/is-ci": "^3.0.0",
"@types/semver": "^6.0.0",
"boxen": "^1.3.0",
"chalk": "^2.1.0",
"enquirer": "^2.3.0",
"external-editor": "^3.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/add/createChangeset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ export default async function createChangeset(
}

log(
"Please enter a summary for this change (this will be in the changelogs). Submit empty line to open external editor"
"Please enter a summary for this change (this will be in the changelogs)."
);
log(chalk.gray(" (submit empty line to open external editor)"));

let summary = await cli.askQuestion("Summary");
if (summary.length === 0) {
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/src/commands/add/messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import chalk from "chalk";
import boxen from "boxen";
import outdent from "outdent";
import { log } from "@changesets/logger";
import { Release, VersionType } from "@changesets/types";
Expand All @@ -16,27 +15,28 @@ export default function printConfirmationMessage(
.filter(release => release.type === type)
.map(release => release.name);
}
log("=== Releasing the following packages ===");
log("\n=== Summary of changesets ===");
const majorReleases = getReleasesOfType("major");
const minorReleases = getReleasesOfType("minor");
const patchReleases = getReleasesOfType("patch");

if (majorReleases.length > 0)
log(`${chalk.green("[Major]")}\n ${majorReleases.join(", ")}`);
log(`${chalk.bold.green("major")}: ${majorReleases.join(", ")}`);
if (minorReleases.length > 0)
log(`${chalk.green("[Minor]")}\n ${minorReleases.join(", ")}`);
log(`${chalk.bold.green("minor")}: ${minorReleases.join(", ")}`);
if (patchReleases.length > 0)
log(`${chalk.green("[Patch]")}\n ${patchReleases.join(", ")}`);
log(`${chalk.bold.green("patch")}: ${patchReleases.join(", ")}`);

log("");

if (repoHasMultiplePackages) {
const message = outdent`
${chalk.red("========= NOTE ========")}
All dependents of these packages that will be incompatible with the new version will be ${chalk.red(
Note: All dependents of these packages that will be incompatible with
the new version will be ${chalk.redBright(
"patch bumped"
)} when this changeset is applied.`;
const prettyMessage = boxen(message, {
borderStyle: "double",
align: "center"
});
log(prettyMessage);
)} when this changeset is applied.
`;

log(message + "\n");
}
}
66 changes: 2 additions & 64 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1910,13 +1910,6 @@ ajv@^6.12.3:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"

ansi-align@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f"
integrity sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=
dependencies:
string-width "^2.0.0"

ansi-colors@^3.2.1:
version "3.2.4"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf"
Expand Down Expand Up @@ -2234,19 +2227,6 @@ binary-extensions@^1.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65"
integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==

boxen@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b"
integrity sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==
dependencies:
ansi-align "^2.0.0"
camelcase "^4.0.0"
chalk "^2.0.1"
cli-boxes "^1.0.0"
string-width "^2.0.0"
term-size "^1.2.0"
widest-line "^2.0.0"

brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
Expand Down Expand Up @@ -2376,11 +2356,6 @@ camelcase-keys@^6.2.2:
map-obj "^4.0.0"
quick-lru "^4.0.1"

camelcase@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=

camelcase@^5.0.0, camelcase@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
Expand Down Expand Up @@ -2519,11 +2494,6 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"

cli-boxes@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143"
integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM=

cli-cursor@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307"
Expand Down Expand Up @@ -2694,7 +2664,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=

cross-spawn@^5.0.1, cross-spawn@^5.1.0:
cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=
Expand Down Expand Up @@ -3291,19 +3261,6 @@ exec-sh@^0.3.2:
resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b"
integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg==

execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=
dependencies:
cross-spawn "^5.0.1"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
Expand Down Expand Up @@ -3709,11 +3666,6 @@ get-stdin@^6.0.0:
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==

get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=

get-stream@^4.0.0, get-stream@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
Expand Down Expand Up @@ -7033,7 +6985,7 @@ string-width@^1.0.1:
is-fullwidth-code-point "^1.0.0"
strip-ansi "^3.0.0"

"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1:
"string-width@^1.0.2 || 2":
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
Expand Down Expand Up @@ -7246,13 +7198,6 @@ tempy@^0.2.1:
temp-dir "^1.0.0"
unique-string "^1.0.0"

term-size@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69"
integrity sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=
dependencies:
execa "^0.7.0"

term-size@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.1.0.tgz#3aec444c07a7cf936e157c1dc224b590c3c7eef2"
Expand Down Expand Up @@ -7788,13 +7733,6 @@ wide-align@^1.1.0:
dependencies:
string-width "^1.0.2 || 2"

widest-line@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.1.tgz#7438764730ec7ef4381ce4df82fb98a53142a3fc"
integrity sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==
dependencies:
string-width "^2.1.1"

wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
Expand Down

0 comments on commit 9e14a9a

Please sign in to comment.