Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: devScripts update #629

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^3.26.5",
"@oclif/core": "^4",
"@salesforce/core": "^7.3.9",
"@salesforce/sf-plugins-core": "^9.0.7",
"@salesforce/sf-plugins-core": "^10.0.0",
"fast-levenshtein": "^3.0.0"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.2.0",
"@oclif/test": "^3.2.15",
"@salesforce/cli-plugins-testkit": "^5.3.6",
"@salesforce/dev-scripts": "^9.1.3",
"@salesforce/dev-scripts": "^10.1.0",
"@salesforce/plugin-command-reference": "^3.0.85",
"@salesforce/plugin-deploy-retrieve": "^3.8.3",
"@salesforce/ts-sinon": "^1.4.17",
Expand Down
11 changes: 9 additions & 2 deletions src/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { ux } from '@oclif/core';
import { SfCommand } from '@salesforce/sf-plugins-core';

export type AliasResult = {
Expand All @@ -21,14 +20,21 @@ export type AliasResult = {

export type AliasResults = AliasResult[];

type AliasColumns = {
alias: { header: string };
value: { header: string };
success?: { header: string };
message?: { header: string };
};

export abstract class AliasCommand<T> extends SfCommand<T> {
protected output(title: string, results: AliasResults): void {
if (results.length === 0) {
this.log('No results');
return;
}

const columns: ux.Table.table.Columns<AliasResult> = {
const columns: AliasColumns = {
alias: { header: 'Alias' },
value: { header: 'Value' },
};
Expand All @@ -43,6 +49,7 @@ export abstract class AliasCommand<T> extends SfCommand<T> {

columns.message = { header: 'Message' };

// results.map((r) => ({ ...r, message: r.error?.message }));
results.map((result) => (result.message = result.error?.message));
}

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/init/load_config_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ModuleLoader } from '@oclif/core';

const OCLIF_META_PJSON_KEY = 'configMeta';

const hook: Hook<'init'> = async ({ config, context }): Promise<void> => {
const hook: Hook.Init = async ({ config, context }): Promise<void> => {
const flattenedConfigMetas = (
await Promise.all(
(config.getPluginsList() || []).flatMap(async (plugin) => {
Expand Down
10 changes: 7 additions & 3 deletions test/commands/config/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,18 @@ describe('config:get', () => {
.do((ctx) => {
const mockPluginRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../../config-meta-mocks/typescript-src'
'../../config-meta-mocks/javascript-lib'
);
ctx.config.plugins.set('sfdx-cli-ts-plugin-2', {

// @ts-expect-error because oclif/test v3 uses oclif/core v3 but plugin-settings is using oclif/core v4
// We can resolve the type error once we migrate these tests to oclif/test v4
ctx.config.plugins.set('sfdx-cli-js-plugin-2', {
root: mockPluginRoot,
hooks: {},
pjson: JSON.parse(readFileSync(path.resolve(mockPluginRoot, 'package.json'), 'utf-8')),
name: 'sfdx-cli-ts-plugin-2',
name: 'sfdx-cli-js-plugin-2',
commands: [],
topics: [],
} as unknown as Plugin);
})
.stdout()
Expand Down
Loading
Loading