-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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 new github docs folder hosting option #520
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 - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
I think we should go with only docs folder as the simpler option. |
console.log(' ' + chalk.cyan('mv') + ' build/ docs/'); | ||
console.log(' ' + chalk.cyan('git') + ' add -f docs'); | ||
console.log(' ' + chalk.cyan('git') + ' commit -am ' + chalk.yellow('"Rebuild website"')); | ||
console.log(' ' + chalk.cyan('git') + ' filter-branch -f --prune-empty --subdirectory-filter docs'); |
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.
Do we need this command? I think it's only necessary for gh-pages
because we needed to make a nested folder to be pushed as top-level.
Left a few more comments, thanks again! |
Thanks for the input @gaearon! I'll see if I can carve out some time this weekend to clean it up! |
Sorry for the slow update. I've removed the old references and simplified the Github Pages documentation to focus only on deploying to a docs folder. |
console.log(' ' + chalk.cyan('mv') + ' build/ docs/'); | ||
console.log(' ' + chalk.cyan('git') + ' add -f docs'); | ||
console.log(' ' + chalk.cyan('git') + ' add docs'); |
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.
Would this need git add docs -A
to remove old files from git? Could you please try to run these commands on a project and nail down the exact sequence before we recommend it?
https://andyeskridge.github.io/docsTest/ is the result of running the commands through twice. The test was running through the commands after creating a clean The |
console.log(' ' + chalk.cyan('git') + ' add -f build'); | ||
console.log(' ' + chalk.cyan('rm') + ' -rf docs/'); | ||
console.log(' ' + chalk.cyan('mv') + ' build/ docs/'); | ||
console.log(' ' + chalk.cyan('git') + ' add docs -A'); | ||
console.log(' ' + chalk.cyan('git') + ' commit -am ' + chalk.yellow('"Rebuild website"')); |
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.
The -a
flag is probably not needed because we added the docs
in the previous command?
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.
Fine to keep for consistency so people don’t think it matters and stress over it.
console.log(); | ||
console.log(' ' + chalk.cyan('git') + ' commit -am ' + chalk.yellow('"Save local changes"')); | ||
console.log(' ' + chalk.cyan('git') + ' checkout -B gh-pages'); | ||
console.log(' ' + chalk.cyan('git') + ' add -f build'); | ||
console.log(' ' + chalk.cyan('rm') + ' -rf docs/'); |
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.
If ./docs/CNAME
file exists, we should preserve it. (Our current deployment code accidentally removes it, see #654.) When the custom domain is edited trough the GitHub Pages settings, GitHub saves it in this file.
git filter-branch -f --prune-empty --subdirectory-filter build | ||
git push -f origin gh-pages | ||
git checkout - | ||
git push origin master |
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.
An extra space between push
and origin
.
@fson @andyeskridge |
I tried to use this instead:
However even that won’t work on Windows because it doesn’t have At this point I think this is the wrong approach.
If a package like this already exists we should use it. Thanks everybody for discussion and sorry about long back and forth. |
This pull request fixes #501
The pull request adds instructions to the template readme and also adds a sequence of commands to the
npm run build
output.I am happy to hear suggestions for making this better. I am wondering if the output after running
npm run build
is getting a little too long after adding this option. Maybe it would be good to settle on one option that we support for GH Pages?