Skip to content

Commit

Permalink
fix(module-names): Fix module name transformation (#8)
Browse files Browse the repository at this point in the history
- Fix module name transformation breaking when the path contains slashes instead of backslashes

Closes #7.
  • Loading branch information
dominique-mueller committed May 3, 2017
1 parent 39a51d4 commit 3fc27d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion logger/compact-logger.js
Expand Up @@ -75,7 +75,9 @@ module.exports = function CompactLogger() {

// Transform absolute paths into relative ones (to shorten the so so incredible long path)
if ( betterModuleName.indexOf( absoluteProjectPath ) !== -1 ) {
betterModuleName = betterModuleName.split( `${ absoluteProjectPath }\\` )[ 1 ];
betterModuleName = betterModuleName
.split( `${ absoluteProjectPath }` )[ 1 ] // Transform absolute path to relative one
.substring( 1 ); // Remove leading path slash
}

// Improve the path presentation further by enforcing style consistency and removing unnecessary details
Expand Down
4 changes: 3 additions & 1 deletion logger/expanded-logger.js
Expand Up @@ -62,7 +62,9 @@ module.exports = function ExpandedLogger() {

// Transform absolute paths into relative ones (to shorten the so so incredible long path)
if ( betterModuleName.indexOf( absoluteProjectPath ) !== -1 ) {
betterModuleName = betterModuleName.split( `${ absoluteProjectPath }\\` )[ 1 ];
betterModuleName = betterModuleName
.split( `${ absoluteProjectPath }` )[ 1 ] // Transform absolute path to relative one
.substring( 1 ); // Remove leading path slash
}

// Improve the path presentation further by enforcing style consistency and removing unnecessary details
Expand Down
4 changes: 3 additions & 1 deletion logger/minimal-logger.js
Expand Up @@ -66,7 +66,9 @@ module.exports = function MinimalLogger() {

// Transform absolute paths into relative ones (to shorten the so so incredible long path)
if ( betterModuleName.indexOf( absoluteProjectPath ) !== -1 ) {
betterModuleName = betterModuleName.split( `${ absoluteProjectPath }\\` )[ 1 ];
betterModuleName = betterModuleName
.split( `${ absoluteProjectPath }` )[ 1 ] // Transform absolute path to relative one
.substring( 1 ); // Remove leading path slash
}

// Improve the path presentation further by enforcing style consistency and removing unnecessary details
Expand Down

0 comments on commit 3fc27d9

Please sign in to comment.