Skip to content

Commit

Permalink
fix(storybook): change storybook tsconfig path in eslint file too (#1…
Browse files Browse the repository at this point in the history
…8101)

(cherry picked from commit e545db7)
  • Loading branch information
mandarini authored and FrozenPandaz committed Jul 13, 2023
1 parent 2093ccc commit 12aa582
Showing 1 changed file with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -719,17 +719,29 @@ export function renameAndMoveOldTsConfig(

const projectTsConfig = joinPathFragments(projectRoot, 'tsconfig.json');

if (!tree.exists(projectTsConfig)) {
return;
if (tree.exists(projectTsConfig)) {
updateJson(tree, projectTsConfig, (json) => {
for (let i = 0; i < json.references?.length; i++) {
if (json.references[i].path === './.storybook/tsconfig.json') {
json.references[i].path = './tsconfig.storybook.json';
break;
}
}
return json;
});
}

updateJson(tree, projectTsConfig, (json) => {
for (let i = 0; i < json.references?.length; i++) {
if (json.references[i].path === './.storybook/tsconfig.json') {
json.references[i].path = './tsconfig.storybook.json';
break;
}
}
return json;
});
const projectEsLintFile = joinPathFragments(projectRoot, '.eslintrc.json');

if (tree.exists(projectEsLintFile)) {
updateJson(tree, projectEsLintFile, (json) => {
const jsonString = JSON.stringify(json);
const newJsonString = jsonString.replace(
/\.storybook\/tsconfig\.json/g,
'tsconfig.storybook.json'
);
json = JSON.parse(newJsonString);
return json;
});
}
}

0 comments on commit 12aa582

Please sign in to comment.