-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Skip load config.yml
config
#1866
Conversation
Deploy preview for netlify-cms-www ready! Built with commit 59340ad |
accc5ed
to
39acd47
Compare
Can you explain with an example of what it changes? Not sure I am following how your change improves the current process. Specifically, I want to make sure we are not breaking current functionality. Also want to see what it adds also. |
@talves Sure! Sorry if it is not clear. Don't hesitate to take me back if it's still not. My ambition is the declare the whole config in JS. Since whole config is loaded at init time, this is not necessary to load an empty Another thing is that configuration will be centralized in one file. If you use a "dynamic" backend configuration, for example, switch to different branch from environment variable, you will have a project like:
Configuration is split in 2 folders located at the opposite side of the project. I want to use JS only for configuration because my collections are very similar and I would like to generate them from utilities functions: const createFooCollection = (options) => ({ name: options.name, fields: ... }) |
39acd47
to
bc05701
Compare
Deploy preview for cms-demo ready! Built with commit 59340ad |
bc05701
to
bea25af
Compare
@@ -111,12 +106,15 @@ export function loadConfig() { | |||
try { | |||
const preloadedConfig = getState().config; |
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.
I don't believe this has a role any longer with the changes in this PR.
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.
Surely, I confess that I can't say if it is still relevant. Do you confirm that we can remove this ?
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.
Yeah, passing bootstrapConfig
into loadConfig
supersedes the old preloadedConfig
behavior, you can drop it.
@talves would you have time to give this a quick review? |
@erquhart isn't this still waiting for your requested changes? |
He added commits to resolve those. Sent with GitHawk |
#1866 (comment) has been resolved? Sorry, I am not seeing a commit for it. |
Ah, that one is just eliminating dead code, no actual impact on behavior. Sent with GitHawk |
I just can't get my head around why we want to pass the bootstrapConfig object to the App component as a prop to make this change. We can already load a config using the import of init/bootstrap.
I do like the idea of ignoring the config.yml based on a flag in the init config, because we can avoid the error of a missing config.yml and request. I think we can do it with just the simple check proposed. The only change really needed is:
|
Really good point @talves, didn't even notice that. @LoicMahieu any thoughts on Tony's comment? We should remove any unnecessary changes to reduce risk. |
cf3ace6
to
09ad3c3
Compare
Indeed...
I confess that I am lacking of time to refactor this changes in a new branch with only these "small" changes. |
…-config * official/master: (48 commits) docs: fix broken link to dev configuration file (decaporg#1941) docs: link releases to tag comparisons update release ticker Publish feat: add cloudinary support (decaporg#1932) fix(netlify-cms-core): duplicate key warning (decaporg#1930) Update image.md (decaporg#1923) chore(netlify-cms-core): upgrade react-frame-component to 4.x (decaporg#1925) chore(netlify-cms-core): upgrade gray-matter to 4.x (decaporg#1924) feat(netlify-cms-widget-select): add support for multiple selection (decaporg#1901) chore: improve publish scripts Publish chore: test before publishing chore(netlify-cms-core): upgrade react-dnd to 7.x (decaporg#1922) chore(netlify-cms-widget-text): upgrade to react-textarea-autosize 7.x (decaporg#1921) chore(netlify-cms-core): upgrade to react-waypoint 8.x (decaporg#1920) fix(backend): use singular label in custom commit message (decaporg#1917) docs: add GAE-specific oAuth client (decaporg#1918) fix(netlify-cms-widget-text): set correct font family (decaporg#1916) chore(netlify-cms-core): upgrade redux and related dependencies (decaporg#1914) ...
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.
@talves after revisiting, this does seem a worthwhile improvement, especially considering our Netlify-CMS-as-a-component ambitions. It does include a breaking change, so considering just dropping as abandoned for now and revisiting in the future. What do you think?
|
||
/** | ||
* Merge any existing configuration so the result can be validated. | ||
*/ | ||
const mergedConfig = mergePreloadedConfig(preloadedConfig, loadedConfig); | ||
const mergedConfig = mergePreloadedConfig(bootstrapConfig, loadedConfig, window.CMS_CONFIG); |
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.
This is breaking, window.CMS_CONFIG
currently overrides any other config loading if present.
I agree. Do you want me to send a PR to only do what I said in this comment, since it would not be a breaking change? |
That'd be awesome 👍 |
Closing in favor of #2053. |
Summary
I would like to make config more "programmable". Collections may comes from functions, uses reusable fields etc...
With this PR, we'll be able to specify config only by JS with a manual init.