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

Migrate JSON configs to YAML #106

Merged
merged 32 commits into from
Apr 24, 2020
Merged

Conversation

gomorizsolt
Copy link
Collaborator

Issue #91.

config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
src/components/Header/TeamMembers/TeamMembers.js Outdated Show resolved Hide resolved
src/components/Header/Header.js Outdated Show resolved Hide resolved
@@ -1,7 +1,7 @@
import React, { Fragment } from "react";
import styled from "styled-components";
import { teamMembersStyle } from "./TeamMembers.style";
import settings from "../../../../settings/settings";
import config from "../../../../config/config.yml";
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if it's a good idea to read the config from yml all the time. How about a wrapper that reads it once?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please take a look at the changes. I've created a top-level context that's responsible for reading the file once and expose it to its child components. I don't think it's required to use memoization though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it's required to use memoization though.

Yea, I've rather removed useMemo().

config/config.yml Outdated Show resolved Hide resolved
config/config.yml Outdated Show resolved Hide resolved
@gomorizsolt
Copy link
Collaborator Author

Tasks that have yet to be done to make the PR ready for review:

package.json Outdated Show resolved Hide resolved
@gomorizsolt gomorizsolt marked this pull request as ready for review April 15, 2020 09:08
README.md Outdated Show resolved Hide resolved
@gomorizsolt
Copy link
Collaborator Author

Screenshot 2020-04-15 at 20 22 36

This error pops up for some reason. AFAICT it originates from the <Medium /> component. I'll look into it.

@gomorizsolt
Copy link
Collaborator Author

gomorizsolt commented Apr 15, 2020

#106 (comment) => fc9d9e7

It'd be great to make it less error-prone though, i.e. the / at the end of the URL might not be added.

const slashRequired = proxy[proxy.length -1] === "/";
const feedUrl = `${proxy}{${slashRequired} ? "/" : ""}https://medium.com/feed/${username}`;

How about something like the above? Or let's just mention it somewhere in the doc.

@thisismydesign
Copy link
Member

It'd be great to make it less error-prone though, i.e. the / at the end of the URL might not be added.

The proper way of dealing with this is through a library that can parse and construct URLs/URIs. They should have a method for adding paths.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Expose the 'CONFIG' secret for the 'pre:deploy' script.
It's no longer required to ouput a `.nojekyll` file.
Deployment keys should be used for deployment because server-to-server requests don't trigger a page build.
@gomorizsolt
Copy link
Collaborator Author

It'd be great to make it less error-prone though, i.e. the / at the end of the URL might not be added.

The proper way of dealing with this is through a library that can parse and construct URLs/URIs. They should have a method for adding paths.

Gotcha, thanks.

const proxify = (proxy, url) => {
const proxifiedUrl = new Url(proxy);
proxifiedUrl.set("pathname", url);
return proxifiedUrl.toString();
};
.

src/components/Medium/utils/MediumUtils.js Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
config/config.example.yml Show resolved Hide resolved
@gomorizsolt gomorizsolt merged commit fb27e6a into master Apr 24, 2020
@gomorizsolt gomorizsolt deleted the issue-91_migrate-to-yaml-config branch April 24, 2020 07:43
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.

2 participants