Skip to content

Commit

Permalink
feat: add checkPackageUsage
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 10, 2024
1 parent 3b95f43 commit b44f3df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/doctor/checkPackageUsage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import assert from 'assert';

export function checkPackageUsage(opts: { usedPkgs: string[] }) {
const { usedPkgs } = opts;
assert(
!usedPkgs.includes('@tanstack/react-router'),
'@tanstack/react-router should not be used, use @umijs/tnf/router instead',
);
}
4 changes: 4 additions & 0 deletions src/doctor/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'pathe';
import { sync as runSync } from '../sync/sync';
import type { Context } from '../types';
import { buildSrc } from './buildSrc';
import { checkPackageUsage } from './checkPackageUsage';
import { checkPhantomDeps } from './checkPhantomDeps';
import { checkReactConflicts } from './checkPkg';

Expand Down Expand Up @@ -38,6 +39,9 @@ export async function doctor(opts: DoctorOptions) {
),
pkg: context.pkg,
});
checkPackageUsage({
usedPkgs: buildSrcResult.pkgs,
});
checkReactConflicts({
pkg: context.pkg,
reactPath:
Expand Down

0 comments on commit b44f3df

Please sign in to comment.