Skip to content

Commit

Permalink
refactor: improve tsconfig include warn logic
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Jan 28, 2023
1 parent 9e3e38b commit 6235ace
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/features/derivative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ export default (api: IApi) => {
const tsconfig = require(path.join(api.cwd, 'tsconfig.json'));
const expected = ['.dumi/**/*'];

if (api.service.configManager?.mainConfigFile) {
const { mainConfigFile } = api.service.configManager;

if (mainConfigFile.endsWith('.ts')) {
expected.push(winPath(path.relative(api.cwd, mainConfigFile)));
} else {
expected.pop();
}
if (api.service.configManager?.mainConfigFile?.endsWith('.ts')) {
expected.push(
winPath(
path.relative(api.cwd, api.service.configManager.mainConfigFile),
),
);
}

if (!expected.every((f) => tsconfig.include?.includes(f))) {
Expand All @@ -83,7 +81,7 @@ export default (api: IApi) => {
.map((e) => `\`${e}\``)
.join(
' & ',
)} into \`include\` option of \`tsconfig.json\`, to make sure \`defineConfig\` works.`,
)} into \`include\` option of \`tsconfig.json\`, to make sure the types exported by framework works.`,
);
}
} catch {}
Expand Down

0 comments on commit 6235ace

Please sign in to comment.