Skip to content

Commit

Permalink
Extend conflict resolver on promote to handle all pages-graphql files
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorflg committed Oct 3, 2024
1 parent 97354bb commit b2056e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/modules/promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import {
workspaceUse,
COLORS,
} from 'vtex'
import { MineWinsConflictsResolver } from '@vtex/api'

const { checkForConflicts } = VBase.createClient()
const vbase = VBase.createClient()
const { promote, get } = createWorkspacesClient()
const { account, workspace: currentWorkspace } = SessionManager.getSingleton()
const workspaceUrl = authUrl()
Expand All @@ -26,11 +27,17 @@ const throwIfIsMaster = (workspace: string) => {
}

const handleConflict = async () => {
const conflictsFound = await checkForConflicts()
const conflictsFound = await vbase.checkForConflicts()

if (conflictsFound) {
await axios.get(workspaceUrl)
}

// @vtex/api expects a full implementation of the client, so we need to cast it to any.
// The partial implementation is enough to solve conflicts.
const conflictsResolver = new MineWinsConflictsResolver((vbase as Partial<VBase>) as any, 'userData', '')

await conflictsResolver.resolveAll()
}

const isPromotable = async (workspace: string) => {
Expand Down

0 comments on commit b2056e6

Please sign in to comment.