add missing dependencies to repo-tools

Signed-off-by: Juan Pablo Garcia Ripa <juanpablog@spotify.com>
This commit is contained in:
Juan Pablo Garcia Ripa
2022-12-19 23:31:08 +01:00
parent 10320fd82e
commit 9b1193f277
4 changed files with 39 additions and 6 deletions
+11
View File
@@ -37,6 +37,7 @@
"@microsoft/api-extractor": "^7.23.0",
"@microsoft/api-extractor-model": "^7.17.2",
"@microsoft/tsdoc": "0.14.1",
"@microsoft/tsdoc-config": "0.16.1",
"chalk": "^4.0.0",
"commander": "^9.1.0",
"fs-extra": "10.1.0",
@@ -51,6 +52,16 @@
"@types/mock-fs": "^4.13.0",
"mock-fs": "^5.1.0"
},
"peerDependencies": {
"@rushstack/node-core-library": "*",
"prettier": "^2.8.1",
"typescript": "> 3.0.0"
},
"peerDependenciesMeta": {
"prettier": {
"optional": true
}
},
"files": [
"bin",
"dist/**/*.js"
@@ -22,7 +22,7 @@ import {
join,
} from 'path';
import { execFile } from 'child_process';
import prettier from 'prettier';
import type prettierType from 'prettier';
import fs from 'fs-extra';
import {
Extractor,
@@ -211,10 +211,19 @@ ApiReportGenerator.generateReviewFileContent =
collector,
...moreArgs,
);
return prettier.format(content, {
...require('@spotify/prettier-config'),
parser: 'markdown',
});
try {
const prettier = require('prettier') as typeof prettierType;
const config = prettier.resolveConfig.sync(cliPaths.targetRoot) ?? {};
return prettier.format(content, {
...config,
parser: 'markdown',
});
} catch (e) {
// console.warn('Failed to format API report with prettier', e);
return content;
}
};
export async function createTemporaryTsConfig(includedPackageDirs: string[]) {