Skip to content

Commit

Permalink
fix(storybook): make sure skipLibCheck is true (#18212)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini authored Jul 20, 2023
1 parent c97a8ac commit d942e7b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
configureTsSolutionConfig,
createProjectStorybookDir,
createStorybookTsconfigFile,
editTsconfigBaseJson,
getE2EProjectName,
getViteConfigFilePath,
projectIsRootProjectInStandaloneWorkspace,
Expand Down Expand Up @@ -128,6 +129,7 @@ export async function configurationGenerator(
);
}
configureTsProjectConfig(tree, schema);
editTsconfigBaseJson(tree);
configureTsSolutionConfig(tree, schema);
updateLintConfig(tree, schema);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { StorybookConfigureSchema } from '../schema';
import { UiFramework7 } from '../../../utils/models';
import { nxVersion } from '../../../utils/versions';
import ts = require('typescript');

const DEFAULT_PORT = 4400;

Expand Down Expand Up @@ -259,6 +260,23 @@ export function createStorybookTsconfigFile(
writeJson(tree, storybookTsConfigPath, storybookTsConfig);
}

export function editTsconfigBaseJson(tree: Tree) {
let tsconfigBasePath = 'tsconfig.base.json';

// standalone workspace maybe
if (!tree.exists(tsconfigBasePath)) tsconfigBasePath = 'tsconfig.json';

if (!tree.exists(tsconfigBasePath)) return;

const tsconfigBaseContent = readJson<TsConfig>(tree, tsconfigBasePath);

if (!tsconfigBaseContent.compilerOptions)
tsconfigBaseContent.compilerOptions = {};
tsconfigBaseContent.compilerOptions.skipLibCheck = true;

writeJson(tree, tsconfigBasePath, tsconfigBaseContent);
}

export function configureTsProjectConfig(
tree: Tree,
schema: StorybookConfigureSchema
Expand Down

1 comment on commit d942e7b

@vercel
Copy link

@vercel vercel bot commented on d942e7b Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app

Please sign in to comment.