-
-
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
Add --skip-next-release option to yarn build #1292
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Deploy preview for docusaurus-2 ready! Built with commit 97c0b23 |
Deploy preview for docusaurus-preview ready! Built with commit 97c0b23 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
LGTM. LGTY @yangshun or @JoelMarcey ?
I've hesitant to add even more features to v1 which we will have to port over to v2. @endiliey if you're ok with that decision, we can merge this. |
I don't mind merging this over and include it in the next minor release. However, @parthpp do you want to try help porting this over to our current WIP v2 ? Otherwise, this PR might have to wait. Here are some pointers:
It should be something like module.exports = async function build(siteDir, cliOptions = {}) {
const skipNextRelease = {cliOptions};
const props = await load({siteDir, skipNextRelease});
// .....
All the related docs metadata is defined here. Nice to have a test on v2 |
What is the general mechanism used in V2 for build in the absence of metadata? Do you use just data structures? |
hmmm, we provide ‘addRoute’ API thats somewhat similar to gatsby ‘createPages’ API. So even docusaurus plugins can generate page. Its possible in v2 to get a .JSON or even .csv or any input file and get a pages created. it could be easier if u trace back the code. We might still change things out but either way, we plan to make it as flexible and modular as possible |
@endiliey I am trying to add this feature to V2 as well, but I could not get the information to run it locally. Since |
@parthpp You can go into |
@yangshun @endiliey Since v2 is not available in npm registry, I created
As far as I understand this issue happens when we try to |
we just recently moved to monorepo. have you used yarn workspaces before ? its a superior command to yarn link. it sort of made the “packages” available as npm module to you although its still unpublished as npm module. so here’s what needs to be done. rebase to master and ‘yarn’ at root directory. cd website and yarn start. But this ‘website’ doesnt have version. try utilizing this https://github.com/facebook/Docusaurus/tree/master/packages/docusaurus/test/__fixtures__/versioned-site |
note that npm i wont work because yarn workspaces is yarn specific feature. https://yarnpkg.com/lang/en/docs/workspaces/ Your dependencies can be linked together, which means that your workspaces can depend on one another while always using the most up-to-date code available. This is also a better mechanism than yarn link since it only affects your workspace tree rather than your whole system. Edit: just find out that |
I have implemented
{
"name": "docusaurus-2-versioned-website",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "docusaurus start",
"build": "docusaurus build",
"eject": "docusaurus eject",
"deploy": "docusaurus deploy"
},
"dependencies": {
"@docusaurus/plugin-content-blog": "^1.0.0",
"@docusaurus/plugin-content-pages": "^1.0.0",
"classnames": "^2.2.6",
"docusaurus-2": "^2.0.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-youtube": "^7.9.0"
}
}
and add cc: @endiliey |
thank you @parthpp. I will test it out and patch it later if needed. |
I wanted to patch it out but I can't seem to push to your branch 😢. Nvm, we'll fix it in master instead. Thank you for this. Regarding your question
This was a WIP command. We'll remove it hahaha. Don't take everything in v2 code as final, there is a lot of WIP internally.
Good idea. I wasn't the one who created that v1 test. It was done way before I contributed. Now that you mention it, i think its a good idea to use fixtures just like in v2
We still build static files, nothing need to be changed for server deploying from v1. |
Motivation
This patch resolves #1243. Docusaurus CLI command for building
HTML
files fromMarkDown
isdocusaurus-build
. After deploying the static website as a result of this build, the documentation for the next release can be accessed by visiting**/next*
. This is ideal for open source projects because it enables transperancy and encourages contribution. However, a closed source project will appreciate an option to skip building and deploying the next version documents. The proposed feature adds an option todocusaurus-build
command to skip the build for documents of the next release. Thus, whendocusaurus-build --skip-next-release
is executed, the resultingHTML
files are only for the already released version.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
I have added test case for the build option. In addition to that, I have done some manual testing. Please follow the ReadMe file in this demo repository to try it yourself.