-
Notifications
You must be signed in to change notification settings - Fork 1
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
Create write redirects build task #4
base: master
Are you sure you want to change the base?
Conversation
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.
In addition to the minor changes requested, please add documentation in the README for how this is used and configured, with a sample of the input JSON, and an example of the output structure. Also, how is that file consumed? Is that a netlify thing? If so, please explain that in the README as well.
Thanks!
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const localeSettings: any = await getSettings({ | ||
include: _.get(buildConfig, 'settingsInclude'), | ||
contentTypeId: _.get(buildConfig, 'settingsContentType') |
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.
to make this more efficient, you should add a select argument: select: 'fields.redirects'.
}; | ||
|
||
const writeRedirects: BuildTask = async (buildConfig, { adapterConfig }): Promise<void> => { | ||
const getSettings = buildConfig.useAdapter ? Contentful(adapterConfig).getGlobalSettings : getGlobalSettings; |
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.
Since we are just parsing the response, I don't think we need to have both of these. If we don't need the adapter, we can just use the standard globalSettings request and parse it accordingly ({ fields : { redirects } }). Either way, whether you use the adapter or not, I would just stick to a single retrieval method. Because the line below (32) looks to me like it would fail if useAdapter != true...
await mkdirIfNotExists(CONTENT_DIR); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const localeSettings: any = await getSettings({ |
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 doesn't seem to have anything to do specifically with locales. Maybe call this variable globalSettings, or just settings?
No description provided.