Skip to content

Commit 194ba4b

Browse files
committed
fix: message formatting for GA
1 parent fc9b92c commit 194ba4b

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

messages/compatibility.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sourceTrackingFileVersionMismatch": "This project uses the %s version of source tracking files.",
33
"clearSuggestion": "Clear the %s version of the tracking files by running '%s'",
4-
"useOtherVersion": "Use the %s version of the command, '%s' to preserve the tracking files"
4+
"useOtherVersion": "Use the %s version of the command, '%s' with your existing tracking files"
55
}

src/compatibility.ts

+16-13
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ export const throwIfInvalid = ({
6565

6666
// We expected it to be the toolbelt version but it is using the new tracking files
6767
if (toValidate === 'toolbelt') {
68+
// some of the toolbelt commands aren't using SfdxCommand and the SfdxError actions won't be automatically displayed
6869
throw new SfdxError(
69-
messages.getMessage('sourceTrackingFileVersionMismatch', ['new']),
70-
'SourceTrackingFileVersionMismatch',
71-
[
72-
messages.getMessage('useOtherVersion', ['new', replaceRenamedCommands(command)]),
73-
messages.getMessage('clearSuggestion', ['new', replaceRenamedCommands('sfdx force:source:tracking:clear')]),
74-
]
70+
`${messages.getMessage('sourceTrackingFileVersionMismatch', ['new'])}\n\nTry this:\n${messages.getMessage(
71+
'useOtherVersion',
72+
['new', replaceRenamedCommands(command, true)]
73+
)}.\n${messages.getMessage('clearSuggestion', [
74+
'new',
75+
replaceRenamedCommands('sfdx force:source:tracking:clear', true),
76+
])}.`,
77+
'SourceTrackingFileVersionMismatch'
7578
);
7679
}
7780
// We expected it to be the plugin-source version but it is using the old tracking files
@@ -80,8 +83,8 @@ export const throwIfInvalid = ({
8083
messages.getMessage('sourceTrackingFileVersionMismatch', ['old']),
8184
'SourceTrackingFileVersionMismatch',
8285
[
83-
messages.getMessage('useOtherVersion', ['old', replaceRenamedCommands(command, true)]),
84-
messages.getMessage('clearSuggestion', ['old', 'sfdx force:source:tracking:clear']),
86+
messages.getMessage('useOtherVersion', ['old', replaceRenamedCommands(command)]),
87+
messages.getMessage('clearSuggestion', ['old', replaceRenamedCommands('sfdx force:source:tracking:clear')]),
8588
]
8689
);
8790
}
@@ -101,9 +104,9 @@ export const replaceRenamedCommands = (input: string, reverse = false): string =
101104
};
102105

103106
const renames = new Map([
104-
['force:source:status', 'force:source:beta:status'],
105-
['force:source:push', 'force:source:beta:push'],
106-
['force:source:pull', 'force:source:beta:pull'],
107-
['force:source:tracking:reset', 'force:source:beta:tracking:reset'],
108-
['force:source:tracking:clear', 'force:source:beta:tracking:clear'],
107+
['force:source:status', 'force:source:legacy:status'],
108+
['force:source:push', 'force:source:legacy:push'],
109+
['force:source:pull', 'force:source:legacy:pull'],
110+
['force:source:tracking:reset', 'force:source:legacy:tracking:reset'],
111+
['force:source:tracking:clear', 'force:source:legacy:tracking:clear'],
109112
]);

0 commit comments

Comments
 (0)