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(remove): Wrap controlled patterns in comment block #4

Merged
merged 7 commits into from
Oct 23, 2018

Conversation

michaeltaranto
Copy link
Contributor

Supports removing controlled patterns from .gitignore. The patterns are now written to the .gitignore file inside a comment block. This block is re-written on every run of the script, so any manual changes to the patterns inside the block will be discarded on subsequent runs.

BREAKING CHANGE: Now has a head and trailing comment which creates a block of controlled patterns.
Anything in the comment block will be re-written on each run of the script
README.md Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
? [`\n${startComment}`, ...sortedPatterns, endComment]
: [];

const outputPatterns = [...before, ...controlledPatterns, ...after]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻👏🏻👏🏻

README.md Outdated

Prepended to the list of provided pattens at the bottom of the file, to indicate which patterns are being controlled programmatically.
Allows you to document the list of patterns that are being controlled programmatically. This helps provide context as to why/what is controlling certain patterns within a `.gitignore` file. Anything inside the comment block will be re-written on each run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to document that this option is required if you want to be able to remove controlled patterns? Otherwise, this looks like it's merely cosmetic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given there is a default comment you get the removal behaviour out of the box rather than an opt-in. There is no way to opt-out of the block style.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha. So should we make it mandatory? Right now it's ?string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me. I need more coffee.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated Show resolved Hide resolved
Co-Authored-By: michaeltaranto <michael.taranto@gmail.com>
@michaeltaranto michaeltaranto merged commit 03a9197 into master Oct 23, 2018
@michaeltaranto michaeltaranto deleted the fix-comments branch October 23, 2018 22:36
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.

2 participants