Skip to content

Commit

Permalink
Noviny/improved add messaging (#45)
Browse files Browse the repository at this point in the history
* overall better messaging for add
  • Loading branch information
Noviny authored May 21, 2019
1 parent 355b4d0 commit 9fe9ecf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .changeset/529e0080/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"releases": [{ "name": "@changesets/cli", "type": "patch" }],
"dependents": []
}
1 change: 1 addition & 0 deletions .changeset/529e0080/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Print out the last changes.md path in terminal as last step of adding a changeset
25 changes: 23 additions & 2 deletions packages/cli/src/commands/add/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { green } from "chalk";
import { green, blue } from "chalk";
import path from "path";
import fs from "fs-extra";

Expand Down Expand Up @@ -53,7 +53,28 @@ export default async function add(opts) {
);
logger.log(green("Changeset added and committed"));
} else {
logger.log(green("Changeset added! - you can now commit it"));
logger.log(green("Changeset added! - you can now commit it\n"));
}

let hasMajorChange = [
...newChangeset.releases,
...newChangeset.dependents
].find(c => c.type === "major");

if (hasMajorChange) {
logger.warn(
"This Changeset includes a major change and we STRONGLY recommend adding more information to the changeset:"
);
logger.warn("WHAT the breaking change is");
logger.warn("WHY the change was made");
logger.warn("HOW a consumer should update their code");
} else {
logger.log(
green(
"If you want to modify or expand on the changeset summary, you can find it here"
)
);
}
logger.info(blue(path.resolve(changesetBase, changesetID, "changes.md")));
}
}

0 comments on commit 9fe9ecf

Please sign in to comment.