committed by
Heikki Hellgren
parent
60a68f10e9
commit
b38d6b1e66
@@ -60,10 +60,17 @@
|
||||
| @vitejs/plugin-react | package.json |
|
||||
| vite-plugin-node-polyfills | package.json |
|
||||
|
||||
## Unlisted dependencies (11)
|
||||
## Unlisted dependencies (18)
|
||||
|
||||
| Name | Location |
|
||||
|:----------------------------------|:-------------------------------------------------------------------------------------------------|
|
||||
| rollup-plugin-polyfill-node | dist/cjs/build-5e63d42c.cjs.js |
|
||||
| rollup-plugin-polyfill-node | dist/cjs/buildWorkspace-47e09dac.cjs.js |
|
||||
| rollup-plugin-polyfill-node | dist/cjs/createDistWorkspace-09d75851.cjs.js |
|
||||
| rollup-plugin-polyfill-node | dist/cjs/index-4cb89d61.cjs.js |
|
||||
| react/package.json | dist/cjs/index-7e560cd7.cjs.js |
|
||||
| react-dom/client | dist/cjs/packageDetection-6cb79707.cjs.js |
|
||||
| prettier | dist/cjs/packageLintConfigs-eceb588c.cjs.js |
|
||||
| prettier | src/commands/migrate/packageLintConfigs.ts |
|
||||
| react-dom/client | src/lib/bundler/hasReactDomClient.ts |
|
||||
| react/package.json | src/lib/bundler/server.ts |
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|:------------------------|:-------------|
|
||||
| @backstage/core-app-api | package.json |
|
||||
|
||||
## Unused devDependencies (8)
|
||||
## Unused devDependencies (9)
|
||||
|
||||
| Name | Location |
|
||||
|:--------------------------------------|:-------------|
|
||||
@@ -15,6 +15,7 @@
|
||||
| @testing-library/jest-dom | package.json |
|
||||
| @backstage/plugin-catalog | package.json |
|
||||
| @backstage/plugin-puppetdb | package.json |
|
||||
| @backstage/frontend-app-api | package.json |
|
||||
| @backstage/plugin-stackstorm | package.json |
|
||||
| @backstage/frontend-test-utils | package.json |
|
||||
| @oriflame/backstage-plugin-score-card | package.json |
|
||||
|
||||
@@ -30,6 +30,8 @@ import {
|
||||
ExtractorLogLevel,
|
||||
ExtractorMessage,
|
||||
} from '@microsoft/api-extractor';
|
||||
import os from 'os';
|
||||
import pLimit from 'p-limit';
|
||||
import { Program } from 'typescript';
|
||||
import {
|
||||
DocBlockTag,
|
||||
@@ -1454,55 +1456,60 @@ export async function runKnipReports({
|
||||
isLocalBuild,
|
||||
}: KnipExtractionOptions) {
|
||||
const knipDir = cliPaths.resolveTargetRoot('./node_modules/knip/bin/');
|
||||
const limiter = pLimit(os.cpus().length);
|
||||
|
||||
for (const packageDir of packageDirs) {
|
||||
console.log(`## Processing ${packageDir}`);
|
||||
const fullDir = cliPaths.resolveTargetRoot(packageDir);
|
||||
const reportPath = resolvePath(fullDir, 'knip-report.md');
|
||||
const run = createBinRunner(fullDir, '');
|
||||
await Promise.all(
|
||||
packageDirs.map(packageDir =>
|
||||
limiter(async () => {
|
||||
console.log(`## Processing ${packageDir}`);
|
||||
const fullDir = cliPaths.resolveTargetRoot(packageDir);
|
||||
const reportPath = resolvePath(fullDir, 'knip-report.md');
|
||||
const run = createBinRunner(fullDir, '');
|
||||
|
||||
const report = await run(
|
||||
`${knipDir}/knip.js`,
|
||||
`--directory ${fullDir}`, // Run in the package directory
|
||||
'--no-exit-code', // Removing this will end the process in case there are findings by knip
|
||||
'--no-progress', // Remove unnecessary debugging from output
|
||||
// TODO: Add more checks when dependencies start to look ok, see https://knip.dev/reference/cli#--include
|
||||
'--include dependencies,unlisted',
|
||||
'--reporter markdown',
|
||||
);
|
||||
const report = await run(
|
||||
`${knipDir}/knip.js`,
|
||||
`--directory ${fullDir}`, // Run in the package directory
|
||||
'--no-exit-code', // Removing this will end the process in case there are findings by knip
|
||||
'--no-progress', // Remove unnecessary debugging from output
|
||||
// TODO: Add more checks when dependencies start to look ok, see https://knip.dev/reference/cli#--include
|
||||
'--include dependencies,unlisted',
|
||||
'--reporter markdown',
|
||||
);
|
||||
|
||||
const existingReport = await fs
|
||||
.readFile(reportPath, 'utf8')
|
||||
.catch(error => {
|
||||
if (error.code === 'ENOENT') {
|
||||
return undefined;
|
||||
const existingReport = await fs
|
||||
.readFile(reportPath, 'utf8')
|
||||
.catch(error => {
|
||||
if (error.code === 'ENOENT') {
|
||||
return undefined;
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
|
||||
if (existingReport !== report) {
|
||||
if (isLocalBuild) {
|
||||
console.warn(`Knip report changed for ${packageDir}`);
|
||||
await fs.writeFile(reportPath, report);
|
||||
} else {
|
||||
logApiReportInstructions();
|
||||
|
||||
if (existingReport) {
|
||||
console.log('');
|
||||
console.log(
|
||||
`The conflicting file is ${relativePath(
|
||||
cliPaths.targetRoot,
|
||||
reportPath,
|
||||
)}, expecting the following content:`,
|
||||
);
|
||||
console.log('');
|
||||
|
||||
console.log(report);
|
||||
|
||||
logApiReportInstructions();
|
||||
}
|
||||
throw new Error(`Knip report changed for ${packageDir}, `);
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
|
||||
if (existingReport !== report) {
|
||||
if (isLocalBuild) {
|
||||
console.warn(`Knip report changed for ${packageDir}`);
|
||||
await fs.writeFile(reportPath, report);
|
||||
} else {
|
||||
logApiReportInstructions();
|
||||
|
||||
if (existingReport) {
|
||||
console.log('');
|
||||
console.log(
|
||||
`The conflicting file is ${relativePath(
|
||||
cliPaths.targetRoot,
|
||||
reportPath,
|
||||
)}, expecting the following content:`,
|
||||
);
|
||||
console.log('');
|
||||
|
||||
console.log(report);
|
||||
|
||||
logApiReportInstructions();
|
||||
}
|
||||
throw new Error(`Knip report changed for ${packageDir}, `);
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# Knip report
|
||||
|
||||
## Unused devDependencies (3)
|
||||
## Unused devDependencies (4)
|
||||
|
||||
| Name | Location |
|
||||
|:------------------------------|:-------------|
|
||||
| jest-date-mock | package.json |
|
||||
| @backstage/cli | package.json |
|
||||
| @backstage/core-app-api | package.json |
|
||||
| @backstage/backend-test-utils | package.json |
|
||||
|
||||
Reference in New Issue
Block a user