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

chore: major bump of oclif/core #1328

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
196 changes: 191 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@amplitude/analytics-node": "^1.3.3",
"@amplitude/analytics-types": "^2.1.2",
"@coveo/platform-client": "44.1.0",
"@oclif/core": "1.24.0",
"@oclif/core": "2.15.0",
"abortcontroller-polyfill": "1.7.5",
"chalk": "4.1.2",
"fs-extra": "11.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commons/src/command/cliCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Trackable} from '../preconditions/trackable';
* @extends {Command}
*/
export abstract class CLICommand extends Command {
public abstract run(): PromiseLike<any>;
public abstract run(): Promise<any>;

/**
* If you extend or overwrite the catch method in your command class, make sure it returns `return super.catch(err)`
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commons/src/config/config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const mockedUxError = jest.fn();
jest.mock('@oclif/core', () => ({
CliUx: {ux: {error: mockedUxError}},
ux: {error: mockedUxError},
}));
jest.mock('./configErrors');
jest.mock('fs-extra');
Expand Down
13 changes: 6 additions & 7 deletions packages/cli/commons/src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Region} from '@coveo/platform-client';
import {CliUx} from '@oclif/core';
import {ux} from '@oclif/core';
import {
pathExistsSync,
createFileSync,
Expand Down Expand Up @@ -52,20 +52,19 @@ export class Config {
return content;
} catch (e) {
if (e instanceof IncompatibleConfigurationError) {
CliUx.ux.error(
ux.error(
dedent`
The configuration at ${this.configPath} is not compatible with this version of the CLI:
${e.message}`,
{exit: false}
);
} else {
CliUx.ux.error(
`Error while reading configuration at ${this.configPath}`,
{exit: false}
);
ux.error(`Error while reading configuration at ${this.configPath}`, {
exit: false,
});
}
this.replace(DefaultConfig);
CliUx.ux.error(
ux.error(
`Configuration has been reset to default value: ${JSON.stringify(
DefaultConfig
)}`,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commons/src/config/configRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CliUx} from '@oclif/core';
import {ux} from '@oclif/core';
import {BaseConfiguration, Config} from './config';

export class ConfigRenderer {
Expand All @@ -17,6 +17,6 @@ export class ConfigRenderer {
{}
);

CliUx.ux.styledJSON(allowedConfig);
ux.styledJSON(allowedConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PlatformClient, {
PrivilegeEvaluatorModel,
PrivilegeModel,
} from '@coveo/platform-client';
import {FlagOutput} from '@oclif/core/lib/interfaces';
import {FlagOutput} from '@oclif/core/lib/interfaces/parser';
import {CLICommand} from '../command/cliCommand';
import {Config} from '../config/config';
import globalConfig from '../config/globalConfig';
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/commons/src/utils/ux.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CliUx} from '@oclif/core';
import {ux} from '@oclif/core';
import {CLICommand} from '../command/cliCommand';
import {stderr} from 'stdout-stderr';
import {startSpinner, stopSpinner, shouldUseColor, formatOrgId} from './ux';
Expand Down Expand Up @@ -31,8 +31,8 @@ describe('ux', () => {
// @oclif/core has an issue preventing the first stream write to be properly mocked.
// This is a bodge.
stderr.start();
CliUx.ux.action.start('test');
CliUx.ux.action.stop();
ux.action.start('test');
ux.action.stop();
stderr.stop();
});
beforeEach(() => {
Expand All @@ -48,14 +48,14 @@ describe('ux', () => {
describe('startSpinner() & stopSpinner()', () => {
describe('when spinner is ended with no argument', () => {
it('no spinner should be running', () => {
expect(CliUx.ux.action.running).toBe(false);
expect(ux.action.running).toBe(false);
});

it('should start a spinner instance', () => {
startSpinner('something');
expect(CliUx.ux.action.running).toBe(true);
expect(ux.action.running).toBe(true);
stopSpinner();
expect(CliUx.ux.action.running).toBe(false);
expect(ux.action.running).toBe(false);
});

it('should stop running task without error', () => {
Expand Down
Loading
Loading