Skip to content

Commit

Permalink
fix: ga tracking commands compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Mar 22, 2022
1 parent b81aaa0 commit 3a31a0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion messages/compatibility.json
@@ -1,5 +1,5 @@
{
"sourceTrackingFileVersionMismatch": "This project uses the %s version of source tracking files.",
"clearSuggestion": "Clear the %s version of the tracking files by running '%s'",
"clearSuggestion": "Pull any changes in your org. Then, clear the %s version of the tracking files by running '%s' followed by '%s'.",
"useOtherVersion": "Use the %s version of the command, '%s' with your existing tracking files."
}
17 changes: 11 additions & 6 deletions src/compatibility.ts
Expand Up @@ -73,6 +73,7 @@ export const throwIfInvalid = ({
)}.\n${messages.getMessage('clearSuggestion', [
'new/beta',
replaceRenamedCommands('sfdx force:source:tracking:clear'),
replaceRenamedCommands('sfdx force:source:tracking:reset', true),
])}.`,
'SourceTrackingFileVersionMismatch'
);
Expand All @@ -84,7 +85,11 @@ export const throwIfInvalid = ({
'SourceTrackingFileVersionMismatch',
[
messages.getMessage('useOtherVersion', ['old/legacy', replaceRenamedCommands(command, true)]),
messages.getMessage('clearSuggestion', ['old/legacy', 'sfdx force:source:tracking:clear']),
messages.getMessage('clearSuggestion', [
'old/legacy',
'sfdx force:source:legacy:tracking:clear',
'sfdx force:source:tracking:reset',
]),
]
);
}
Expand All @@ -104,9 +109,9 @@ export const replaceRenamedCommands = (input: string, reverse = false): string =
};

const renames = new Map([
['force:source:status', 'force:source:beta:status'],
['force:source:push', 'force:source:beta:push'],
['force:source:pull', 'force:source:beta:pull'],
['force:source:tracking:reset', 'force:source:beta:tracking:reset'],
['force:source:tracking:clear', 'force:source:beta:tracking:clear'],
['force:source:legacy:status', 'force:source:status'],
['force:source:legacy:push', 'force:source:push'],
['force:source:legacy:pull', 'force:source:pull'],
['force:source:legacy:tracking:reset', 'force:source:tracking:reset'],
['force:source:legacy:tracking:clear', 'force:source:tracking:clear'],
]);

0 comments on commit 3a31a0d

Please sign in to comment.