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

Always use PROJECT_NAME, even for user and org pages #384

Merged
merged 2 commits into from
Jan 9, 2018

Conversation

JoelMarcey
Copy link
Contributor

Motivation

The symptom was that if we had a user or org page (e.g., https://JoelMarcey.github.io), we would try to copy files to a directory within a directory, getting errors like:

Error: Copying build assets failed with error 'Error: Cannot copy '/Users/joelm/dev/JoelMarcey.github.io/website/build' to a subdirectory of itself, '/Users/joelm/dev/JoelMarcey.github.io/website/build/JoelMarcey.github.io-master'.'

This is because we were setting the end of fromPath to empty if we were using an org or user page.

But we don't need to do that. The PROJECT_NAME (set in siteConfig.js as projectName) is the user or org repo

e.g., https://github.com/JoelMarcey/JoelMarcey.github.io/ has a projectName of JoelMarcey.github.io with an organizationName of JoelMarcey.

So now the fromPath and toPath look like:

fromPath: build/JoelMarcey.github.io
toPath: buuid/JoelMarcey.github.io-master

Test Plan

Ran:

GIT_USER=JoelMarcey USE_SSH=true yarn docusaurus-publish

on two repos. One for an org/user site and one for a project site. Publish worked on both:

Org/user site: https://github.com/JoelMarcey/JoelMarcey.github.io/tree/master (https://JoelMarcey.github.io)
Project site: https://github.com/JoelMarcey/docusaurus-testing/tree/gh-pages (https://JoelMarcey.github.io/docusaurus-testing)

Related PRs

N/A

The symptom was that if we had a user or org page (e.g., https://JoelMarcey.github.io), we would try to copy files to a directory within a directory, getting errors like:

```
Error: Copying build assets failed with error 'Error: Cannot copy '/Users/joelm/dev/JoelMarcey.github.io/website/build' to a subdirectory of itself, '/Users/joelm/dev/JoelMarcey.github.io/website/build/JoelMarcey.github.io-master'.'
```

This is because we were setting the end of `fromPath` to empty if we were using an org or user page.

But we don't need to do that. The `PROJECT_NAME` (set in `siteConfig.js` as `projectName`) is the user or org repo

e.g., https://github.com/JoelMarcey/JoelMarcey.github.io/ has a `projectName` of `JoelMarcey.github.io` with an `organizationName` of `JoelMarcey`.

So now the `fromPath` and `toPath` look like:

`fromPath`: `build/JoelMarcey.github.io`
`toPath`: `buuid/JoelMarcey.github.io-master`
Was looking at other copying solutions. Do not need it.
@rickyvetter
Copy link
Contributor

Looks good! Thanks for cleaning this up and testing it out.

@JoelMarcey
Copy link
Contributor Author

Closes #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants