Merge pull request #15206 from backstage/include-asset-type
fix: include asset types for repo tools package
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/repo-tools': patch
|
||||
---
|
||||
|
||||
Include asset-types.d.ts while running the api report command
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable no-restricted-imports */
|
||||
|
||||
import {
|
||||
resolve as resolvePath,
|
||||
relative as relativePath,
|
||||
@@ -66,7 +65,6 @@ import {
|
||||
import { IMarkdownEmitterContext } from '@microsoft/api-documenter/lib/markdown/MarkdownEmitter';
|
||||
import { AstDeclaration } from '@microsoft/api-extractor/lib/analyzer/AstDeclaration';
|
||||
import { paths as cliPaths } from '../../lib/paths';
|
||||
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
const tmpDir = cliPaths.resolveTargetRoot(
|
||||
@@ -228,13 +226,25 @@ export async function createTemporaryTsConfig(includedPackageDirs: string[]) {
|
||||
fs.removeSync(path);
|
||||
});
|
||||
|
||||
let assetTypeFile: string[] = [];
|
||||
|
||||
try {
|
||||
assetTypeFile = [
|
||||
require.resolve('@backstage/cli/asset-types/asset-types.d.ts'),
|
||||
];
|
||||
} catch {
|
||||
/** ignore */
|
||||
}
|
||||
|
||||
await fs.writeJson(path, {
|
||||
extends: './tsconfig.json',
|
||||
include: [
|
||||
// These two contain global definitions that are needed for stable API report generation
|
||||
'packages/cli/asset-types/asset-types.d.ts',
|
||||
...assetTypeFile,
|
||||
...includedPackageDirs.map(dir => join(dir, 'src')),
|
||||
],
|
||||
// we don't exclude node_modules so that we can use the asset-types.d.ts file
|
||||
exclude: [],
|
||||
});
|
||||
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user