Skip to content

Commit

Permalink
fix(storybook): dont throw if no project-level tsconfig (#18027)
Browse files Browse the repository at this point in the history
(cherry picked from commit 878955b)
  • Loading branch information
mandarini authored and FrozenPandaz committed Jul 10, 2023
1 parent 25263f7 commit 1a0e65a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ export function renameAndMoveOldTsConfig(
pathToStorybookConfigFile: string,
tree: Tree
) {
if (pathToStorybookConfigFile) {
if (pathToStorybookConfigFile && tree.exists(pathToStorybookConfigFile)) {
updateJson(tree, pathToStorybookConfigFile, (json) => {
if (json.extends?.startsWith('../')) {
// drop one level of nesting
Expand Down Expand Up @@ -718,6 +718,11 @@ export function renameAndMoveOldTsConfig(
}

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

if (!tree.exists(projectTsConfig)) {
return;
}

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

0 comments on commit 1a0e65a

Please sign in to comment.