Fix Storybook Configuration for Windows Development Environment (#7904)

#### Description
This PR resolves issue #7903 regarding the Storybook configuration for
Windows development environments. Previously, the configuration script
generated forward slashes instead of backslashes, leading to errors when
running the command `npx nx run twenty-front:storybook:serve:dev
--configuration=modules` on Windows systems.

#### Changes Made
- Updated the Storybook configuration to ensure that backslashes are
used in file paths for Windows environments, preventing command
execution errors.

#### How to Test
1. **Run Storybook Command**:
   - On a Windows machine, execute the command:
     ```
     npx nx run twenty-front:storybook:serve:dev --configuration=modules
     ```
- Ensure that the command runs successfully without any path-related
errors.

2. **Verify Configuration**:
- Check the Storybook configuration files to confirm that paths are
using backslashes where applicable.
- Test the same command on non-Windows environments to verify that there
are no regressions.

#### Related Issue
- Fixes #7903
This commit is contained in:
uluckydev
2024-10-21 21:58:31 +05:30
committed by GitHub
parent 4578674e30
commit 5416773951
3 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import * as fs from 'fs';
import path from 'path';
import slash from 'slash';
const extensions = ['.ts', '.tsx'];
const excludedExtensions = [
@ -73,10 +74,10 @@ moduleDirectories.forEach((moduleDirectoryPath) => {
return directFilesPaths.map((filePath) => {
const fileName = filePath.split('.').slice(0, -1).join('.');
return `export * from './${path.relative(
return `export * from './${slash(path.relative(
moduleDirectoryPath,
path.join(directoryPath, fileName),
)}';`;
))}';`;
});
})
.sort((a, b) => a.localeCompare(b))
@ -92,7 +93,7 @@ moduleDirectories.forEach((moduleDirectoryPath) => {
const mainBarrelExports = moduleDirectories
.map(
(moduleDirectoryPath) =>
`export * from './${path.relative(srcPath, moduleDirectoryPath)}';`,
`export * from './${slash(path.relative(srcPath, moduleDirectoryPath))}';`,
)
.sort((a, b) => a.localeCompare(b))
.join('\n');