Skip to content

Commit 7284643

Browse files
authored
Merge pull request #509 from salesforcecli/sm/ensureArray
refactor: ensureArray from kit
2 parents f254061 + 75eb246 commit 7284643

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@octokit/core": "^4.0.4",
1313
"@salesforce/command": "^5.2.3",
1414
"@salesforce/core": "^3.26.0",
15-
"@salesforce/kit": "^1.5.22",
15+
"@salesforce/kit": "^1.6.0",
1616
"@salesforce/plugin-trust": "^2.0.3",
1717
"@salesforce/ts-types": "^1.5.20",
1818
"agent-base": "^6.0.2",
@@ -34,7 +34,6 @@
3434
"yarn-deduplicate": "^3.1.0"
3535
},
3636
"devDependencies": {
37-
"oclif": "^3.1.2",
3837
"@oclif/plugin-command-snapshot": "^3",
3938
"@salesforce/dev-config": "^3.0.0",
4039
"@salesforce/dev-scripts": "^2.0.3",
@@ -62,6 +61,7 @@
6261
"husky": "^7.0.4",
6362
"mocha": "^9.1.3",
6463
"nyc": "^15.1.0",
64+
"oclif": "^3.1.2",
6565
"prettier": "^2.4.1",
6666
"pretty-quick": "^3.1.0",
6767
"shx": "0.3.4",

src/commands/cli/versions/inspect.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
1515
import { Messages, SfError } from '@salesforce/core';
1616
import { green, red, cyan, yellow, bold } from 'chalk';
1717
import { ensure } from '@salesforce/ts-types';
18-
import { parseJson } from '@salesforce/kit';
18+
import { ensureArray, parseJson } from '@salesforce/kit';
1919
import { PackageJson } from '../../../package';
2020
import { CLI } from '../../../types';
2121

@@ -135,10 +135,6 @@ const CLI_META = {
135135
},
136136
};
137137

138-
function toArray(arrOrString: string | string[]): string[] {
139-
return Array.isArray(arrOrString) ? arrOrString : [arrOrString];
140-
}
141-
142138
export default class Inspect extends SfdxCommand {
143139
public static readonly description = messages.getMessage('description');
144140
public static readonly examples = messages.getMessage('examples').split(os.EOL);
@@ -179,8 +175,8 @@ export default class Inspect extends SfdxCommand {
179175
public archives: Archives;
180176

181177
public async run(): Promise<Info[]> {
182-
const locations = toArray(this.flags.locations) as Location[];
183-
const channels = toArray(this.flags.channels) as Channel[];
178+
const locations = ensureArray(this.flags.locations) as Location[];
179+
const channels = ensureArray(this.flags.channels) as Channel[];
184180

185181
if (this.flags.cli === CLI.SF && channels.includes(Channel.LEGACY)) {
186182
throw new SfError('the sf CLI does not have a legacy channel');

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,10 +1234,10 @@
12341234
typedoc-plugin-missing-exports "0.23.0"
12351235
typescript "^4.1.3"
12361236

1237-
"@salesforce/kit@^1.5.22", "@salesforce/kit@^1.5.34", "@salesforce/kit@^1.5.41":
1238-
version "1.5.45"
1239-
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.5.45.tgz#200a85f75681f4567820cf206a04b3d44e43e0b0"
1240-
integrity sha512-e7iER8s/f8N52rSRZ7uJXSKnOTDTH9NHfGnmkFXPuz/1Waaeqso+CxqmqCh8aVe//frj11NGkazR0rJPuF/bfA==
1237+
"@salesforce/kit@^1.5.34", "@salesforce/kit@^1.5.41", "@salesforce/kit@^1.6.0":
1238+
version "1.6.0"
1239+
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.6.0.tgz#0305dea2c9847d4b08068c4a9d436da5c9a5ce5e"
1240+
integrity sha512-8VZvWYl61jBaUIqo+pNoDvVqaZKPmqauvkhJHvcr/+D7+EXsjne9PDMggy5mNQJvonD6iegR/h3BqcWrppSaeQ==
12411241
dependencies:
12421242
"@salesforce/ts-types" "^1.5.20"
12431243
shx "^0.3.3"

0 commit comments

Comments
 (0)