-
Notifications
You must be signed in to change notification settings - Fork 29
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
Update skuba managed sections when merging ignore files #58
Conversation
🦋 Changeset is good to goLatest commit: cb7a8cb We got this. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
(line) => !templateSet.has(line), | ||
const replacedSkubaSection = inputFile?.replace( | ||
/# managed by skuba[\s\S]*# end managed by skuba/, | ||
'', |
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.
Can we do the replacement inline here?
How about inverting this to be more like:
if (typeof inputFile === 'undefined') {
return templateFile;
}
return inputFile.replace('...', templateFile);
You could even one-liner it, but we might add some extra hacks in here later to make the migration less jarring.
Co-authored-by: Ryan Ling <ryan@outlook.com.au>
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.
Awesome, the snapshots are looking good.
if (inputFile.includes('# managed by skuba')) { | ||
const replacedSkubaSection = inputFile.replace( | ||
/# managed by skuba[\s\S]*# end managed by skuba/, | ||
templateFile, | ||
); | ||
|
||
const inputLines = splitIntoSanitisedLines(inputFile ?? '').filter( | ||
(line) => !templateSet.has(line), | ||
); | ||
return `${replacedSkubaSection}`; | ||
} |
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.
What do you think about:
const replacedFile = inputFile.replace(/.../, templateFile);
if (replacedFile.includes(templateFile)) {
return replacedFile;
}
It's probably overly-paranoid, but it avoids mismatches between the .replace
pattern and .includes
string
Co-authored-by: Ryan Ling <ryan@outlook.com.au>
This should leave repos migrated from `seek-module-toolkit` and pre-#58 ignore files in a better state instead of littering old patterns everywhere.
This should leave repos migrated from `seek-module-toolkit` and pre-#58 ignore files in a better state instead of littering old patterns everywhere.
Added skuba managed section to ignore files in the base template. So,
skuba configure
can update those sections without overwriting any existing files.