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

Add support for optional local backend #474

Merged
merged 2 commits into from
May 4, 2020

Conversation

chosak
Copy link
Member

@chosak chosak commented May 1, 2020

Add support for and document running against a local GitHub proxy server instead of against the live branch on GitHub.com.

This is a beta feature of Netlify CMS:

https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository

I've pushed this commit to master on my fork, and you can see that my fork's GH pages edit buttons still try to authenticate to GitHub.com; but if you run this branch locally, it will use the local proxy server, but only if is running. If you're not running a local proxy server, local development still falls back to the GitHub backend.

Per the netlify-cms code, the CMS only looks for the local proxy if running on localhost.

I don't love the recommendation of npx to run random code from npm. Is there a better way to do this?

Add support for and document running against a local GitHub proxy server
instead of against the live branch on GitHub.com.

This is a beta feature of Netlify CMS:

https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository
@netlify
Copy link

netlify bot commented May 1, 2020

View a preview of the Design System website with your changes using the following link.

Built with commit f772b88

https://deploy-preview-474--cfpb-design-system.netlify.app

Copy link
Member

@contolini contolini left a comment

Choose a reason for hiding this comment

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

I love this idea and think we should enable it by default with yarn start. It solves the annoyance of local testing modifying the live repo.

Instead of npx I'd recommend:

  1. Installing the proxy as a dev dependency by running yarn add netlify-cms-proxy-server --dev from the docs/ directory
  2. Adding a new script called something like start-netlify. (Note: the proxy has to be run from the git repo's root, hence the cd ../)
  3. Adding that new script to the start script.

Our package.json scripts are starting to get a bit too messy for my comfort but I don't think that should delay this PR.

@chosak
Copy link
Member Author

chosak commented May 4, 2020

@contolini thanks, that's a great improvement! It runs locally for me using just yarn start, very nicely (although required me upgrading my local Node to the latest 10.x, 10.10.1). Would you mind giving another quick look at how I've merged your changes?

@contolini
Copy link
Member

Yeeeee :shipit:

@chosak chosak merged commit b02e644 into cfpb:master May 4, 2020
@chosak chosak deleted the feature/local-proxy-server branch May 4, 2020 20:09
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