New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(publish): display uncommitted changes in check-working-tree #2066
Conversation
99e8f8a
to
3cf26c5
Compare
… utils/collect-uncommitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work, thanks!
@@ -3,6 +3,12 @@ | |||
All notable changes to this project will be documented in this file. | |||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | |||
|
|||
## Unpublished |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is automatically generated during lerna publish --conventional-commits
. I appreciate the motivation, though!
|
||
> Check git working tree status and collect uncommitted changes for display | ||
|
||
## Usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant example, thanks!
|
||
const filterEmpty = (strings = []) => strings.filter(s => s.length !== 0); | ||
|
||
const o = (l, r) => x => l(r(x)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, fancy.
const transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats)); | ||
|
||
function collectUncommitted(options = {}) { | ||
return exec("git", "status -s", options).then(transformOutput); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module looks fine as-is, though I am a little concerned that the -s
option of git status
doesn't guarantee stability across versions (--porcelain
v1 claims to do that, otherwise identical to the short format with colors always off and paths always relative).
Anyway, we can cross that bridge when we come to it, if at all.
Description
This PR attempts to remedy (#1860) by adding a
utils/collect-uncommitted
that will resolve an array of uncommitted changes, for use in the error message inutils/check-working-tree
, and anywhere else it may come in handy.I am not 100% on the formatting for the error message and would love input on the best way to display the uncommitted changes to the user.
utils/collect-uncommitted
with testscollectUncommitted
in check-working-tree, when tree is dirtycollectUncommitted
changes for display to user in error message.Motivation and Context
See (#1680)
How Has This Been Tested?
Add tests in
utils/collect-uncommitted
, modify existing test inutils/check-working-tree
, runnpx jest
,npm run integration
. All tests pass in CI.Types of changes
Checklist: