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

fix(content-docs): warn when files are not tracked #6937

Merged
merged 7 commits into from Mar 21, 2022

Conversation

felipecrs
Copy link
Contributor

@felipecrs felipecrs commented Mar 18, 2022

@facebook-github-bot facebook-github-bot added the CLA Signed label Mar 18, 2022
@felipecrs
Copy link
Contributor Author

@felipecrs felipecrs commented Mar 18, 2022

@Josh-Cena there are some changes here related to devcontainer configuration. Please let me know if you would like me to detach them from this PR.

@netlify
Copy link

@netlify netlify bot commented Mar 18, 2022

@github-actions
Copy link

@github-actions github-actions bot commented Mar 18, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 42
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-6937--docusaurus-2.netlify.app/

@felipecrs
Copy link
Contributor Author

@felipecrs felipecrs commented Mar 18, 2022

jest.config.mjs Show resolved Hide resolved
.cspell.json Outdated Show resolved Hide resolved
packages/docusaurus-utils/src/gitUtils.ts Outdated Show resolved Hide resolved
packages/docusaurus-utils/src/gitUtils.ts Outdated Show resolved Hide resolved
@Josh-Cena Josh-Cena changed the title fix(docs): warn when files are not tracked fix(content-docs): warn when files are not tracked Mar 19, 2022
@Josh-Cena Josh-Cena added the tag: polish label Mar 19, 2022
@felipecrs felipecrs requested a review from Josh-Cena Mar 20, 2022
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Thanks, that looks great!

@Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Mar 21, 2022

BTW, it's great that we have people developing with dev containers/vscode jest extensions, etc. I've personally never figured out how that worked so I just have it disabled😅 If you want to write some contributing guides, or improve our infrastructure around that, it would be great!

@Josh-Cena Josh-Cena merged commit e19a4e2 into facebook:main Mar 21, 2022
26 checks passed
@felipecrs felipecrs deleted the err-to-warn branch Mar 21, 2022
@@ -31,8 +36,16 @@ export async function getFileLastUpdate(
if (err instanceof GitNotFoundError && !showedGitRequirementError) {
logger.warn('Sorry, the docs plugin last update options require Git.');
showedGitRequirementError = true;
} else if (
err instanceof FileNotTrackedError &&
!showedFileNotTrackedError
Copy link
Collaborator

@slorber slorber Mar 23, 2022

Choose a reason for hiding this comment

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

not 100% sure to understand the goal of this condition here

the 1st time you print a custom message, and the next times you fallback to the else branch that shows the raw FileNotTrackedError ? That looks a bit weird to me.

Can you add a test to cover the intended behavior please? (like having 2 untracked git files?

Copy link
Collaborator

@slorber slorber Mar 23, 2022

Choose a reason for hiding this comment

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

BTW not convinced that using global variables is the solution, but we can keep this for now

When building for i18n, those variables are not "reset" so a warning for the first i18n locale might not be shown for the 2nd i18n locale anymore

Copy link
Collaborator

@Josh-Cena Josh-Cena Mar 23, 2022

Choose a reason for hiding this comment

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

Oops, logic mistake there😅 To be fixed later

I think i18n is fine, since there's no "context" in this error about which file is not tracked. Before this error was silently swallowed anyways

Copy link
Contributor Author

@felipecrs felipecrs Mar 23, 2022

Choose a reason for hiding this comment

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

I can't believe I left this pass. 😅

If you guys haven't started to fix it yet, I can do it.

Copy link
Collaborator

@Josh-Cena Josh-Cena Mar 23, 2022

Choose a reason for hiding this comment

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

Yep, you can go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed tag: polish
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants