-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(gatsby-core-utils,gatsby-cli): Allow write to gatsby-config.ts #35074
Conversation
path.stop() | ||
}, | ||
}, | ||
function addPluginsToConfig({ |
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 extracted out from existing transform so it can be used for gatsby-config.js
and gatsby-config.ts
, nothing should be changed
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.
Didn't get to a full review yet, wanted to mention two things already
Co-authored-by: Lennart <lekoarts@gmail.com>
@@ -0,0 +1,104 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
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.
For anyone reading this (or my future self), I took a look at making the quote type of the output strings in the transform consistent (e.g. all backticks).
The only obstacle is in the buildPluginNode
function we JSON.stringify
the options object, and if we try to make object keys backticks then the transform fails since that's invalid JSON (and we can't expect keys to only be alphabetic).
Anyhow not a huge deal, but wanted to leave this for posterity. Will leave this out of 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.
It just hit me: We can’t merge yet with the changed ts starter as otherwise until this is released the workflow is broken
That's true, good catch. I suppose we could separate out just the TS starter change, we'd have to remove or comment out the new test for that as well. Or keep it all together here and merge this after the release. Either way we'd have to merge at least one PR after the release 🤔 |
Description
Allow customers using
create-gatsby
to have their preferences selected during the questionnaire written programatically to the (new)gatsby-config.ts
file ingatsby-starter-minimal-ts
.TS Gatsby config extracted out to #35128.
Documentation
No updates required, relevant doc is https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/#gatsby-configts
Related Issues
[sc-47001]
Tests
As far as I can tell there aren't any tests for existing functionality, so I'll add those and also cover this new case.
Will probably import the starter configs in tests so that if we change the starter configs in the future, the test breaks and we make sure we update the transform if need be.