Skip to content

Commit

Permalink
feat: basic push-status command implementation and extended push comm…
Browse files Browse the repository at this point in the history
…and (#1321)

Co-authored-by: IhorKarpiuk <[email protected]>
Co-authored-by: SmoliyY <[email protected]>
  • Loading branch information
3 people authored Jan 26, 2024
1 parent 0a65c35 commit f070c3d
Show file tree
Hide file tree
Showing 51 changed files with 1,983 additions and 125 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-eyes-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": minor
---

Added a `push` and `push-status` command for use with future Redocly products.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'!packages/**/__tests__/**/*',
'!packages/core/src/benchmark/**/*',
'!packages/cli/src/index.ts',
'!packages/cli/src/assert-node-version.ts',
'!packages/cli/src/utils/assert-node-version.ts',
],
coverageThreshold: {
'packages/core/': {
Expand Down
99 changes: 65 additions & 34 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
],
"dependencies": {
"@redocly/openapi-core": "1.7.0",
"abort-controller": "^3.0.0",
"chokidar": "^3.5.1",
"colorette": "^1.2.0",
"core-js": "^3.32.1",
"form-data": "^4.0.0",
"get-port-please": "^3.0.1",
"glob": "^7.1.6",
"handlebars": "^4.7.6",
Expand All @@ -59,7 +61,7 @@
"@types/react": "^17.0.0 || ^18.2.21",
"@types/react-dom": "^17.0.0 || ^18.2.7",
"@types/semver": "^7.5.0",
"@types/yargs": "17.0.5",
"@types/yargs": "17.0.32",
"typescript": "^5.2.2"
}
}
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/build-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { renderToString } from 'react-dom/server';
import { handlerBuildCommand } from '../../commands/build-docs';
import { BuildDocsArgv } from '../../commands/build-docs/types';
import { getPageHTML } from '../../commands/build-docs/utils';
import { getFallbackApisOrExit } from '../../utils';
import { getFallbackApisOrExit } from '../../utils/miscellaneous';

jest.mock('redoc');
jest.mock('fs');
jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');

const config = {
output: '',
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/bundle.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { lint, bundle, getTotals, getMergedConfig } from '@redocly/openapi-core';

import { BundleOptions, handleBundle } from '../../commands/bundle';
import { handleError } from '../../utils';
import { handleError } from '../../utils/miscellaneous';
import { commandWrapper } from '../../wrapper';
import SpyInstance = jest.SpyInstance;
import { Arguments } from 'yargs';

jest.mock('@redocly/openapi-core');
jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');

(getMergedConfig as jest.Mock).mockImplementation((config) => config);

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/join.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { handleJoin } from '../../commands/join';
import { exitWithError, writeToFileByExtension, writeYaml } from '../../utils';
import { exitWithError, writeToFileByExtension, writeYaml } from '../../utils/miscellaneous';
import { yellow } from 'colorette';
import { detectSpec } from '@redocly/openapi-core';
import { loadConfig } from '../../__mocks__/@redocly/openapi-core';
import { ConfigFixture } from '../fixtures/config';

jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');

jest.mock('colorette');

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/__tests__/commands/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ import {
exitWithError,
loadConfigAndHandleErrors,
checkIfRulesetExist,
} from '../../utils';
} from '../../utils/miscellaneous';
import { ConfigFixture } from '../fixtures/config';
import { performance } from 'perf_hooks';
import { commandWrapper } from '../../wrapper';
import { Arguments } from 'yargs';
import { blue } from 'colorette';

jest.mock('@redocly/openapi-core');
jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');
jest.mock('perf_hooks');

jest.mock('../../update-version-notifier', () => ({
jest.mock('../../utils/update-version-notifier', () => ({
version: '1.0.0',
}));

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/push-region.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jest.mock('node-fetch', () => ({
}));
jest.mock('@redocly/openapi-core');
jest.mock('../../commands/login');
jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');

(getMergedConfig as jest.Mock).mockImplementation((config) => config);

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/__tests__/commands/push.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import { Config, getMergedConfig } from '@redocly/openapi-core';
import { exitWithError } from '../../utils';
import { exitWithError } from '../../utils/miscellaneous';
import { getApiRoot, getDestinationProps, handlePush, transformPush } from '../../commands/push';
import { ConfigFixture } from '../fixtures/config';
import { yellow } from 'colorette';
Expand All @@ -13,7 +13,7 @@ jest.mock('node-fetch', () => ({
})),
}));
jest.mock('@redocly/openapi-core');
jest.mock('../../utils');
jest.mock('../../utils/miscellaneous');

(getMergedConfig as jest.Mock).mockImplementation((config) => config);

Expand Down
Loading

1 comment on commit f070c3d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.19% 4306/5652
🟡 Branches 65.76% 2236/3400
🟡 Functions 68.81% 695/1010
🟡 Lines 76.4% 4049/5300

Test suite run success

699 tests passing in 100 suites.

Report generated by 🧪jest coverage report action from f070c3d

Please sign in to comment.