Skip to content

Commit

Permalink
fix(storybook): optional chain all includes (#9707)
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #9702
  • Loading branch information
mandarini committed Apr 6, 2022
1 parent 704b6c8 commit d5e7af0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/storybook/src/executors/utils.ts
Expand Up @@ -280,7 +280,7 @@ function normalizeTargetString(
appName: string,
defaultTarget: string = 'build'
) {
if (appName.includes(':')) {
if (appName?.includes(':')) {
return appName;
}
return `${appName}:${defaultTarget}`;
Expand Down Expand Up @@ -308,7 +308,7 @@ export function customProjectBuildConfigIsValid(
tree: Tree,
projectBuildConfig: string
): boolean {
if (projectBuildConfig.includes(':')) {
if (projectBuildConfig?.includes(':')) {
const { project, target } = parseTargetString(projectBuildConfig);
const projectConfig = readProjectConfiguration(tree, project);
if (projectConfig?.targets?.[target]) {
Expand Down
Expand Up @@ -231,8 +231,8 @@ function configureTsProjectConfig(
}

if (
!tsConfigContent.exclude.includes('**/*.stories.ts') &&
!tsConfigContent.exclude.includes('**/*.stories.js')
!tsConfigContent?.exclude?.includes('**/*.stories.ts') &&
!tsConfigContent?.exclude?.includes('**/*.stories.js')
) {
tsConfigContent.exclude = [
...(tsConfigContent.exclude || []),
Expand Down Expand Up @@ -260,7 +260,7 @@ function configureTsSolutionConfig(
if (
!tsConfigContent?.references
?.map((reference) => reference.path)
.includes('./.storybook/tsconfig.json')
?.includes('./.storybook/tsconfig.json')
) {
tsConfigContent.references = [
...(tsConfigContent.references || []),
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/src/generators/init/init.ts
Expand Up @@ -203,7 +203,7 @@ export function addCacheableOperation(tree: Tree) {
workspace.tasksRunnerOptions.default.options.cacheableOperations =
workspace.tasksRunnerOptions.default.options.cacheableOperations || [];
if (
!workspace.tasksRunnerOptions.default.options.cacheableOperations.includes(
!workspace.tasksRunnerOptions.default.options.cacheableOperations?.includes(
'build-storybook'
)
) {
Expand Down

0 comments on commit d5e7af0

Please sign in to comment.