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

feat: Add target as option to deploy cli command. #9766

Closed

Conversation

SandPod
Copy link
Contributor

@SandPod SandPod commented Jan 21, 2024

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

The deploy script makes a hard assumption that the remote repository only stores Docusaurus files.

In our case we have a CNAME file in the root of the repo and therefore have placed all Docusaurus files in a docs folder. Therefore, we cannot utilize this scripts since we can't specify the target directory.

This PR adds a CLI option to specify the target directory and ensures that one the target directory is cleared out while the rest of the repo is left intact.

Review guidelines

This is an initial attempt to see if it is something that is worth finalizing and goes in the direction the maintainers of the project would like to see.

The PR is best reviewed commit by commit where each commit attempts to apply a single change. Hopefully this can help clarify if I have misunderstood how things should be implemented.

Test Plan

Would have loved to have #7714 merged for automatic validation of these changes.

Failing a snapshot test right now, I'm not a Javascript native developer and don't feel comfortable updating snapshots without understanding the implication.

The test that is currently failing should fail since I have actually added a new prop.

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

@facebook-github-bot
Copy link
Contributor

Hi @SandPod!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign 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 to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

netlify bot commented Jan 21, 2024

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 335412c
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/65acf01343769300088be7f0
😎 Deploy Preview https://deploy-preview-9766--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 81 🟢 98 🟢 100 🟢 100 🟠 89 Report
/docs/installation 🟠 88 🟢 98 🟢 100 🟢 100 🟠 89 Report
/docs/category/getting-started 🟠 75 🟢 100 🟢 100 🟢 90 🟠 89 Report
/blog 🟠 69 🟢 100 🟢 100 🟢 90 🟠 89 Report
/blog/preparing-your-site-for-docusaurus-v3 🟠 61 🟢 97 🟢 100 🟢 100 🟠 89 Report
/blog/tags/release 🟠 71 🟢 100 🟢 100 🟠 80 🟠 89 Report
/blog/tags 🟠 75 🟢 100 🟢 100 🟢 90 🟠 89 Report

Comment on lines +204 to +205
shellExecLog(`git checkout -B ${deploymentBranch}`);
shellExecLog(`git remote add origin ${deploymentRepoURL}`);
Copy link
Contributor Author

@SandPod SandPod Jan 21, 2024

Choose a reason for hiding this comment

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

Chore: need to correct these lines here, this will always create a new branch since we fetch with depth 1 on the line above. Need to fetch information about any existing branch before calling checkout with -B.

We also need to bind the remote correctly in all cases.

@SandPod SandPod closed this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants