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

feat: upgrading oas-normalize to pull in its new TS typings #564

Merged
merged 1 commit into from
Aug 10, 2022
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
30 changes: 15 additions & 15 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"isemail": "^3.1.3",
"mime-types": "^2.1.35",
"node-fetch": "^2.6.1",
"oas-normalize": "^6.0.0",
"oas-normalize": "^7.0.0",
"open": "^8.2.1",
"ora": "^5.4.1",
"parse-link-header": "^2.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/.sink.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// These packages don't have any TS types so we need to declare a module in order to use them.
declare module '@npmcli/ci-detect';
declare module 'editor';
declare module 'oas-normalize';
5 changes: 2 additions & 3 deletions src/lib/prepareOas.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import fs from 'fs';

import chalk from 'chalk';
import ora from 'ora';

import OASNormalize from 'oas-normalize';
Copy link
Member Author

Choose a reason for hiding this comment

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

This wasn't being sorted before ora before because the sinkhole exclusion was causing the import/order rule to think that it was a local package.

import ora from 'ora';

import { debug, info, oraOptions } from './logger';

Expand Down Expand Up @@ -69,7 +68,7 @@ export default async function prepareOas(path: string, command: 'openapi' | 'val
let bundledSpec = '';

if (command === 'openapi') {
bundledSpec = await oas.bundle().then((res: Record<string, unknown>) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the type here because OASNormalize.bundle returns an OpenAPI.Document now and Record is incompatible with that.

Copy link
Member

Choose a reason for hiding this comment

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

:hell-yeah:

bundledSpec = await oas.bundle().then(res => {
return JSON.stringify(res);
});

Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"outDir": "dist/",
"paths": {
"@npmcli/ci-detect": [".sink.d.ts"],
"editor": [".sink.d.ts"],
"oas-normalize": [".sink.d.ts"]
"editor": [".sink.d.ts"]
},
"resolveJsonModule": true,
"target": "ES5"
Expand Down