Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(store): normalize pattern ids across platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
faselbaum committed Mar 8, 2018
1 parent cc1d2af commit 298654a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/store/styleguide/typescript-react-analyzer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ function detectPatternsInDirectory(
return patterns;
}

const PATH_SEPARATOR = new RegExp(PathUtils.sep);

function generatePatternId(
basePath: string,
fileInfo: PatternFileInfo,
Expand All @@ -147,7 +149,10 @@ function generatePatternId(
const baseName = PathUtils.basename(fileInfo.jsFilePath, '.js');
const relativeDirectoryPath = PathUtils.relative(basePath, fileInfo.directory);

const baseIdentifier = PathUtils.join(relativeDirectoryPath, baseName);
const baseIdentifier = PathUtils.join(relativeDirectoryPath, baseName).replace(
PATH_SEPARATOR,
'/'
);
const exportIdentifier = exportInfo.name ? `@${exportInfo.name}` : '';

const id = `${baseIdentifier}${exportIdentifier}`;
Expand Down

0 comments on commit 298654a

Please sign in to comment.