Skip to content
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

Merged
merged 1 commit into from May 11, 2019

Conversation

pdeona
Copy link
Contributor

@pdeona pdeona commented May 2, 2019

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 in utils/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.

  • adds utils/collect-uncommitted with tests
  • require collectUncommitted in check-working-tree, when tree is dirty collectUncommitted 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 in utils/check-working-tree, run npx jest, npm run integration. All tests pass in CI.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@pdeona pdeona force-pushed the master branch 9 times, most recently from 99e8f8a to 3cf26c5 Compare May 2, 2019 20:24
Copy link
Member

@evocateur evocateur left a 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
Copy link
Member

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
Copy link
Member

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));
Copy link
Member

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);
Copy link
Member

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.

@evocateur evocateur merged commit ea41fe9 into lerna:master May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants