Skip to content

Commit 7fdfc4c

Browse files
committed
fix: deduplicate commands
1 parent abe6903 commit 7fdfc4c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
"dependencies": {
88
"@salesforce/command": "^5.2.6",
99
"@salesforce/core": "^3.25.0",
10+
"@types/lodash.uniqby": "^4.7.7",
1011
"chalk": "^3.0.0",
1112
"handlebars": "4.7.7",
13+
"lodash.uniqby": "^4.7.0",
1214
"shelljs": "^0.8.5",
1315
"tslib": "^1"
1416
},

src/commands/commandreference/generate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { Ditamap } from '../../ditamap/ditamap';
1717
import { Docs } from '../../docs';
1818
import { events, mergeDeep } from '../../utils';
1919

20+
// eslint-disable-next-line @typescript-eslint/no-var-requires
21+
const uniqBy = require('lodash.uniqby');
22+
2023
// Initialize Messages with the current plugin directory
2124
Messages.importMessagesDirectory(__dirname);
2225

@@ -176,7 +179,8 @@ export default class CommandReferenceGenerate extends SfdxCommand {
176179
return Object.assign({} as JsonMap, cmd);
177180
}
178181
});
179-
return Promise.all(promises);
182+
const commands = await Promise.all(promises);
183+
return uniqBy(commands, 'id');
180184
}
181185

182186
private async loadCommand(command) {

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,13 @@
13961396
dependencies:
13971397
"@types/node" "*"
13981398

1399+
"@types/lodash.uniqby@^4.7.7":
1400+
version "4.7.7"
1401+
resolved "https://registry.yarnpkg.com/@types/lodash.uniqby/-/lodash.uniqby-4.7.7.tgz#48dbb652c41cc8fb30aa61a44174368081835ab5"
1402+
integrity sha512-sv2g6vkCIvEUsK5/Vq17haoZaisfj2EWW8mP7QWlnKi6dByoNmeuHDDXHR7sabuDqwO4gvU7ModIL22MmnOocg==
1403+
dependencies:
1404+
"@types/lodash" "*"
1405+
13991406
"@types/lodash@*":
14001407
version "4.14.184"
14011408
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe"
@@ -6225,7 +6232,7 @@ lodash.uniq@~4.5.0:
62256232
lodash.uniqby@^4.7.0:
62266233
version "4.7.0"
62276234
resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302"
6228-
integrity sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=
6235+
integrity sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==
62296236

62306237
lodash.without@~4.4.0:
62316238
version "4.4.0"

0 commit comments

Comments
 (0)