-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Show warning console if version.js file is missing #678
Conversation
Deploy preview for docusaurus-preview ready! Built with commit 86615cd |
Some suggestion. Instead of just a warning when |
@endiliey i agree with u, but can u give me the example of how to create a default @JoelMarcey @yangshun do u've any comments about this? |
Refer to https://docusaurus.io/docs/en/versioning.html, running
|
Showing For prompting and creating a default |
Yeah I agree. Showing https://docusaurus.io/docs/en/versioning.html as a reference guide is more important. Nice work 😄 |
@endiliey @supasate @JoelMarcey @yangshun
if everything's ok, I'll continue to add the link message |
@sujono91 That definitely seems reasonable to me. Much better than what we have now -- which is nothing 😄. We can always do any minor tweaking later, if we want. |
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.
Just some minor comments before we can merge this. Thanks a lot @sujono91!
lib/version.js
Outdated
if (!hasVersionFile) { | ||
console.error( | ||
`${chalk.yellow( | ||
'No version.js file founded!' |
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.
Should it be versions.js
or version.js
? The code checks for versions.js
but the error message suggests version.js
.
Grammatical nit - The error message should be "No versions.js file found" not founded.
Could you also shift the const hasVersionFile
declaration to just above the check here? We would like to co-locate the variables to where they are being referenced, especially when this file is only being referenced once.
lib/version.js
Outdated
console.error( | ||
`${chalk.yellow( | ||
'No version.js file founded!' | ||
)}\nPlease create your version.js file in pages/en directory.` |
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.
Sync filename with above.
Updated @yangshun @JoelMarcey |
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.
Looking good!
Motivation
As discussed in #369, we have to give better error message if
version.js
file is missing inpages/en
directory.The solution was to add warning console if someone ran the version script before creating the
versions.js
pageHave you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Warning console example if
version.js
file is not foundSuccess example if
version.js
file is foundRun
yarn test
and it pass all unit testRelated PRs
No