Skip to content

Commit

Permalink
Fix Storybook Configuration for Windows Development Environment (twen…
Browse files Browse the repository at this point in the history
…tyhq#7904)

#### Description
This PR resolves issue twentyhq#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 twentyhq#7903
  • Loading branch information
uluckydev authored Oct 21, 2024
1 parent 4578674 commit 5416773
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"scroll-into-view": "^1.16.2",
"semver": "^7.5.4",
"sharp": "^0.32.1",
"slash": "^5.1.0",
"stripe": "^14.17.0",
"ts-key-enum": "^2.0.12",
"tslib": "^2.3.0",
Expand Down
7 changes: 4 additions & 3 deletions packages/twenty-ui/scripts/generateBarrels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import path from 'path';
import slash from 'slash';

const extensions = ['.ts', '.tsx'];
const excludedExtensions = [
Expand Down Expand Up @@ -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))
Expand All @@ -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');
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41555,7 +41555,7 @@ __metadata:
languageName: node
linkType: hard

"slash@npm:^5.0.0":
"slash@npm:^5.0.0, slash@npm:^5.1.0":
version: 5.1.0
resolution: "slash@npm:5.1.0"
checksum: 10c0/eb48b815caf0bdc390d0519d41b9e0556a14380f6799c72ba35caf03544d501d18befdeeef074bc9c052acf69654bc9e0d79d7f1de0866284137a40805299eb3
Expand Down Expand Up @@ -44314,6 +44314,7 @@ __metadata:
scroll-into-view: "npm:^1.16.2"
semver: "npm:^7.5.4"
sharp: "npm:^0.32.1"
slash: "npm:^5.1.0"
source-map-support: "npm:^0.5.20"
storybook: "npm:^7.6.3"
storybook-addon-cookie: "npm:^3.2.0"
Expand Down

0 comments on commit 5416773

Please sign in to comment.