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

fragments setup: newline fix + refactor->rename #9821

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ test('redwood.toml is updated even if `fragments = true` exists for other sectio
await handler({ force: false })

expect(vol.toJSON()[FIXTURE_PATH + '/redwood.toml']).toEqual(
toml + '\n\n[graphql]\n fragments = true'
toml + '\n[graphql]\n fragments = true'
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export async function handler({ force }: Args) {
const hasExistingGraphqlSection = !!redwoodTomlObject?.graphql

let newTomlContent =
originalTomlContent + '\n\n[graphql]\n fragments = true'
originalTomlContent.replace(/\n$/, '') +
'\n\n[graphql]\n fragments = true'

if (hasExistingGraphqlSection) {
const existingGraphqlSetting = Object.keys(
Expand Down Expand Up @@ -121,13 +122,13 @@ export async function handler({ force }: Args) {
{
title: 'Add possibleTypes to the GraphQL cache config',
task: async () => {
const result = await runTransform({
const transformResult = await runTransform({
transformPath: path.join(__dirname, 'appGqlConfigTransform.js'),
targetPaths: [getPaths().web.app],
})

if (result.error) {
throw new Error(result.error)
if (transformResult.error) {
throw new Error(transformResult.error)
}

const appPath = getPaths().web.app
Expand Down
Loading