Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storybook): make sure skipLibCheck is true #18212

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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