Skip to content

Commit

Permalink
fragments setup: newline fix + refactor->rename (#9821)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Jan 12, 2024
1 parent 74db5b5 commit cb44899
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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

0 comments on commit cb44899

Please sign in to comment.